bootstrap added
This commit is contained in:
@@ -0,0 +1,96 @@
|
||||
#!/bin/sh
|
||||
|
||||
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||
export PATH
|
||||
|
||||
LANG="en_US.UTF-8"
|
||||
export LANG
|
||||
|
||||
if [ -s "/etc/os-release" ]; then
|
||||
. /etc/os-release
|
||||
if [ "${ID}" != "debian" ]; then
|
||||
echo "*** NOT DEBIAN ***"
|
||||
echo "*** ABORTING *****"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "*** UNKNOWN DIST ***"
|
||||
echo "*** ABORTING *******"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "*** START ***"
|
||||
|
||||
DEBIAN_FRONTEND=noninteractive
|
||||
export DEBIAN_FRONTEND
|
||||
|
||||
trap "dpkg --configure -a" 1 2 3 9 11 15
|
||||
|
||||
echo "## updating repos"
|
||||
apt-get -y update | grep -v -e "^Hit:" -e "^Get:"
|
||||
|
||||
echo "## upgrading system"
|
||||
apt-get -y dist-upgrade
|
||||
|
||||
echo "## updating locales"
|
||||
apt-get -q -y install locales | grep -v -e "is already the newest version"
|
||||
LOC1=$(md5sum /etc/locale.gen | cut -b 1-32)
|
||||
sed -i 's/^# *de_DE.UTF-8 UTF-8/de_DE.UTF-8 UTF-8/g' /etc/locale.gen
|
||||
sed -i 's/^# *en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g' /etc/locale.gen
|
||||
LOC2=$(md5sum /etc/locale.gen | cut -b 1-32)
|
||||
if [ "${LOC1}" != "${LOC2}" ]; then
|
||||
locale-gen | grep -v -e "^ "
|
||||
fi
|
||||
update-locale LANG=de_DE.UTF-8
|
||||
|
||||
echo "## installing tools"
|
||||
dpkg --configure -a
|
||||
apt-get -q -y install \
|
||||
net-tools \
|
||||
uptimed \
|
||||
unattended-upgrades \
|
||||
curl \
|
||||
ntpdate \
|
||||
wget \
|
||||
rsyslog \
|
||||
vim \
|
||||
psmisc \
|
||||
rsync \
|
||||
bmon \
|
||||
tcpdump \
|
||||
mtr-tiny \
|
||||
moreutils \
|
||||
ifenslave \
|
||||
pigz \
|
||||
git | grep -v -e "is already the newest version"
|
||||
|
||||
echo "## enabling unattended-upgrades"
|
||||
echo unattended-upgrades unattended-upgrades/enable_auto_updates boolean true | debconf-set-selections
|
||||
dpkg-reconfigure -f noninteractive unattended-upgrades
|
||||
|
||||
echo "## deleting default user"
|
||||
if id user >/dev/null 2>&1; then
|
||||
userdel -rf user
|
||||
fi
|
||||
|
||||
echo "## setting vim config"
|
||||
truncate -s0 /root/.vimrc
|
||||
echo "set mouse=" >>/root/.vimrc
|
||||
echo "syntax on" >>/root/.vimrc
|
||||
|
||||
echo "## setting ssh keys"
|
||||
mkdir -p /root/.ssh/
|
||||
chmod 700 /root/ /root/.ssh/
|
||||
truncate -s0 /root/.ssh/authorized_keys
|
||||
|
||||
echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICFP1rThjJUx618ao9fmvLCTAvMdIyPLz5DTFZsfo6fo jenni@jenni-Latitude-5420" >>/root/.ssh/authorized_keys
|
||||
echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOEXgwNeuzCW6NG5gLDcq/YIsy3LifxtuesAUkYHNNKV root@backup" >>/root/.ssh/authorized_keys
|
||||
|
||||
chmod 600 /root/.ssh/authorized_keys
|
||||
chown -R root:root /root/.ssh /root/.vimrc
|
||||
|
||||
echo "## syncing time"
|
||||
ntpdate pool.ntp.org
|
||||
hwclock --systohc
|
||||
|
||||
echo "*** DONE ***"
|
||||
Reference in New Issue
Block a user