From 0167424a76d30974b64658a81c8c7806bff0d185 Mon Sep 17 00:00:00 2001 From: jinjin Date: Thu, 28 May 2026 13:20:46 +0200 Subject: [PATCH] modified bootstrap.sh --- bootstrap.sh | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index f0c63bd..d78738d 100644 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -19,6 +19,13 @@ else exit 1 fi +MYUSER=$(whoami) +if [ "${MYUSER}" != "root" ]; then + echo "*** USER NOT ROOT ***" + echo "*** ABORTING ********" + exit 1 +fi + echo "*** START ***" echo "## cleaning sources.list" @@ -66,6 +73,19 @@ LC_MEASUREMENT=de_DE.UTF-8 LC_IDENTIFICATION=de_DE.UTF-8 EOF +echo "## setting options" +sed -i 's/^#precedence ::ffff:0:0\/96 100/precedence ::ffff:0:0\/96 100/g' /etc/gai.conf + +echo "## services mgmt" +MPT=$(dpkg -l | grep -c multipath-tools) +if [ "${MPT}" -gt 0 ]; then + for service in multipathd.service multipathd.socket multipath-tools-boot.service multipath-tools.service + do + systemctl stop "$service" 2>/dev/null || true + systemctl disable "$service" 2>/dev/null || true + done +fi + echo "## installing tools" dpkg --configure -a apt-get -q -y install \ @@ -92,9 +112,11 @@ echo unattended-upgrades unattended-upgrades/enable_auto_updates boolean true | dpkg-reconfigure -f noninteractive unattended-upgrades echo "## setting vim config" -truncate -s0 /root/.vimrc -echo "set mouse=" >>/root/.vimrc -echo "syntax on" >>/root/.vimrc +if [ ! -f "/root/.vimrc" ]; then + truncate -s0 /root/.vimrc + echo "set mouse=" >>/root/.vimrc + echo "syntax on" >>/root/.vimrc +fi echo "## setting ssh keys" mkdir -p /root/.ssh/ @@ -105,7 +127,10 @@ echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICFP1rThjJUx618ao9fmvLCTAvMdIyPLz5DTFZ 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 +chown -R root:root /root/.ssh +if [ -f "/root/.vimrc" ]; then + chown root:root /root/.vimrc +fi echo "## syncing time" ntpdate pool.ntp.org || true