home · contact · privacy
Fix. master
authorChristian Heller <c.heller@plomlompom.de>
Wed, 16 Apr 2025 05:28:41 +0000 (07:28 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Wed, 16 Apr 2025 05:28:41 +0000 (07:28 +0200)
bookworm/scripts/lib/copy_dirtree
bookworm/scripts/lib/ensure_packages_of_tags
bookworm/scripts/lib/init_packages
bookworm/scripts/lib/mkdir_p_for_user
testing/scripts/init_server_access.sh

index 5c7a2273c90249721c74f2ecca1169146ed5b6f0..7a3a1732a124f5b8a6c5e3110b0c6f47c9d16761 100644 (file)
@@ -15,7 +15,7 @@ copy_dirtree() {
         fi
         cd "${_PATH_TAG}"
         for _PATH_REL in $(find . -type f,l); do
-            _PATH_TARGET="${_TARGET_ROOT}"$(echo "${_PATH_REL}" | cut -c2-)
+            _PATH_TARGET="${_TARGET_ROOT}"$(echo "${_PATH_REL}" | cut -c 2-)
             _PATH_SOURCE=$(realpath "${_PATH_REL}")
             _DIRECTORY=$(dirname "${_PATH_TARGET}")
             if [ ! -z "${_OWNER}" ]; then
index c79b1f0c305391232124e3a06ea807956d268425..92805321b108c72492f449a0e569683a8aa2cd40 100644 (file)
@@ -9,7 +9,7 @@ ensure_packages_of_tags() {
         echo "For tag '"${_TAG}"', installing"
         cat "${_PATH_APTMARK_TAG}" | while read _LINE; do
             if [ ! $(echo "${_LINE}" | cut -c1) = "#" ]; then
-                apt-get -q -y -o Dpkg::Options::="--force-confnew" install "${_LINE}"
+                apt-get -qq -y -o Dpkg::Options::="--force-confnew" install "${_LINE}"
             fi
         done
         echo '\n'
index b77dfc1c122af125528ac82ef25a1b54a4e2846c..5e65144bf39fb0e5163201e5352940fe81b69797 100644 (file)
@@ -22,7 +22,7 @@ init_packages() {
     # before purging, ensure tagged packages installed
     ensure_packages_of_tags $@ 
     echo "Autoremove and purge …"
-    apt-get -qq -y --purge autoremove
+    apt-get -qqq -y --purge autoremove
     echo "And now: dist-upgrade …"
-    apt-get -qq -y dist-upgrade
+    apt-get -qqq -y dist-upgrade
 }
index 0fde79acc447a334417e29969e53b2f7830b64cb..ad0e4a91d1e605d30f899e005259e1ac3e606a6d 100644 (file)
@@ -1,7 +1,7 @@
 mkdir_p_for_user() {
     _USER="$1"
-    _TO_SHORTEN=$(mkdir -pv "$1" | sed "s/mkdir: created directory '//g" | head -1)
-    if [ -z "${_TO_SHORTEN}" ]; then
+    _TO_SHORTEN=$(mkdir -pv "$2" | sed "s/mkdir: created directory '//g" | head -1)
+    if [ -z "${_TO_SHORTEN}" ]; then
         _LENGTH=$(echo -n "${_TO_SHORTEN}" | wc -c)
         _TARGET_LENGTH=$(calc "${_LENGTH} - 1" | cut -f2)
         _TARGET_DIR=$(echo "${_TO_SHORTEN}" | cut -c "-${_TARGET_LENGTH}")
index 97ac66cdf3738e89fdb52401082bd0ce443743ee..54332b635401383cb4cefc2a68cf18005c64453f 100755 (executable)
@@ -1,6 +1,5 @@
 #!/bin/sh
 set -e
-set -x
 cd $(dirname "$0")
 . lib/constants_ssh  # PATH_USER_SSH
 . lib/expect_min_n_args
@@ -15,8 +14,8 @@ set +e
 ssh-keygen -f "${PATH_KNOWN_HOSTS}" -R "${SERVER}"
 ssh-keyscan "${SERVER}" >> "${PATH_KNOWN_HOSTS}"
 RESULT=$?
-echo "DEBUG (why does script sometimes stop here if 'set -e' a bit earlier?): ${RESULT}"
 if [ "${RESULT}" != "0" ]; then
+    echo "ERROR: For some reason ssh-keyscan returned non-zero exit code, here's what a re-run with -v looks like:"
     ssh-keyscan -v "${SERVER}"
     exit 1 
 fi
@@ -28,6 +27,6 @@ ssh "root@${SERVER}" 'printf "\n\n" && passwd'
 stty echo
 
 echo '\nSetting up config repo.'
-ssh "root@${SERVER}" 'apt update && apt install -y git && git clone https://plomlompom.com/repos/clone/config'
+ssh "root@${SERVER}" 'apt-get -q update && apt-get -q -y install git && git clone https://plomlompom.com/repos/clone/config'
 
 echo "\nServer ready, log in with: ssh root@${SERVER}"