home · contact · privacy
Fix.
authorChristian Heller <c.heller@plomlompom.de>
Tue, 6 May 2025 00:13:06 +0000 (02:13 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Tue, 6 May 2025 00:13:06 +0000 (02:13 +0200)
bookworm/scripts/lib/core_setup
bookworm/scripts/lib/minimize_installation [deleted file]
bookworm/scripts/lib/prefixed_msg
bookworm/scripts/minimize_installation.sh [new file with mode: 0755]
testing/scripts/init_server_access.sh
testing/scripts/lib/apt_get_digested [new symlink]
testing/scripts/lib/minimize_installation [deleted symlink]
testing/scripts/lib/prefixed_msg [new symlink]
testing/scripts/setup_desktop.sh
trixie/scripts/from_older_upgrade.sh
trixie/scripts/lib/minimize_installation [deleted symlink]

index a8ed30154bec42b614224ccebaf5f0dc885436d3..8dc1e46e1d29f610f5e3a88f54ca37ca01b2eea0 100644 (file)
@@ -1,8 +1,8 @@
 . lib/apt_get_digested
 . lib/constants_user  # USERNAME
 . lib/copy_dirtrees_of_tags
-. lib/minimize_installation
 . lib/prefixed_msg
+
 core_setup() {
 prefixed_msg_init 'core_setup'
 prefixed_msg 'starting (performing standard installation setup steps)'
@@ -12,7 +12,7 @@ _FQDN="$2"
 _EXTERNAL_IP="$3"
 _INSTALL_TAGS="$4"
 
-minimize_installation ${_INSTALL_TAGS}
+./minimize_installation.sh ${_INSTALL_TAGS}
 
 prefixed_msg 'And now: dist-upgrade …'
 apt_get_digested '-q -q dist-upgrade' 
diff --git a/bookworm/scripts/lib/minimize_installation b/bookworm/scripts/lib/minimize_installation
deleted file mode 100644 (file)
index 87e88d1..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-. lib/apt_get_digested
-. lib/ensure_packages_of_tags
-. lib/prefixed_msg
-
-minimize_installation() {
-prefixed_msg_init 'minimize_installation'
-_INSTALL_TAGS="$@"
-prefixed_msg "narrow system to what is required explicitly by Debian and by us, as per these INSTALL_TAGS: ${_INSTALL_TAGS}"
-
-_TOK_REQ='required'
-_PATH_LIST_PREFIX=/tmp/list_
-_PATH_LIST_UNSORTED="${_PATH_LIST_PREFIX}unsorted"
-_PATH_LIST_WHITE="${_PATH_LIST_PREFIX}white"
-_PATH_LIST_ALL_PACKAGES="${_PATH_LIST_PREFIX}all_packages"
-_PATH_LIST_BLACK="${_PATH_LIST_PREFIX}black"
-
-if ! which calc > /dev/null; then
-    prefixed_msg 'not found calc, which is needed, so installing …'
-    apt-get -y -q -q install calc > /dev/null
-fi
-
-prefixed_msg_no_nl "collect packages deemed '${_TOK_REQ}' by Debian: "
-dpkg-query -Wf '${Package} ${Priority}\n' | grep " ${_TOK_REQ}" | cut -d' ' -f1 > "${_PATH_LIST_UNSORTED}"
-sort "${_PATH_LIST_UNSORTED}" > "${_PATH_LIST_WHITE}"
-echo $(cat "${_PATH_LIST_WHITE}")
-
-prefixed_msg_no_nl 'collect installed packages outside this selection: '
-dpkg-query -Wf '${Package}\n' > "${_PATH_LIST_UNSORTED}"
-sort "${_PATH_LIST_UNSORTED}" > "${_PATH_LIST_ALL_PACKAGES}"
-comm -3 "${_PATH_LIST_ALL_PACKAGES}" "${_PATH_LIST_WHITE}" > "${_PATH_LIST_BLACK}"
-echo $(cat "${_PATH_LIST_BLACK}")
-
-prefixed_msg 'apt-mark auto from diff …'
-apt-mark auto `cat "${_PATH_LIST_BLACK}"` > /dev/null
-rm "${_PATH_LIST_UNSORTED}" "${_PATH_LIST_ALL_PACKAGES}" "${_PATH_LIST_WHITE}" "${_PATH_LIST_BLACK}"
-
-prefixed_msg 'install or mark as manually installed packages from our own selections …'
-ensure_packages_of_tags ${_INSTALL_TAGS} 
-
-prefixed_msg 'run autopurge to get rid of all unwanted packages …'
-apt_get_digested '-q -q autopurge'
-
-prefixed_msg_exit
-}
index d29d6bfd5899dde398370885d87ca414fc474646..8ebd15888cbcff8af88e446127687b8035c85b67 100644 (file)
@@ -1,10 +1,10 @@
 prefixed_msg_init() {
-    prefixed_msg_OLD_PREFIX="${prefixed_msg_PREFIX}|${prefixed_msg_OLD_PREFIX}"
-    prefixed_msg_PREFIX="$1"
+    export prefixed_msg_OLD_PREFIX="${prefixed_msg_PREFIX}|${prefixed_msg_OLD_PREFIX}"
+    export prefixed_msg_PREFIX="$1"
 }
 prefixed_msg_exit() {
-    prefixed_msg_PREFIX=$(echo "${prefixed_msg_OLD_PREFIX}" | cut -d'|' -f1)
-    prefixed_msg_OLD_PREFIX=$(echo "${prefixed_msg_OLD_PREFIX}" | cut -d'|' -f2-)
+    export prefixed_msg_PREFIX=$(echo "${prefixed_msg_OLD_PREFIX}" | cut -d'|' -f1)
+    export prefixed_msg_OLD_PREFIX=$(echo "${prefixed_msg_OLD_PREFIX}" | cut -d'|' -f2-)
 }
 
 prefixed_msg_no_nl() {
diff --git a/bookworm/scripts/minimize_installation.sh b/bookworm/scripts/minimize_installation.sh
new file mode 100755 (executable)
index 0000000..ae682a2
--- /dev/null
@@ -0,0 +1,45 @@
+#!/bin/sh
+set -e
+cd $(dirname "$0")
+. lib/apt_get_digested
+. lib/ensure_packages_of_tags
+. lib/prefixed_msg
+
+prefixed_msg_init 'minimize_installation'
+_INSTALL_TAGS="$@"
+prefixed_msg "narrow system to what is required explicitly by Debian and by us, as per these INSTALL_TAGS: ${_INSTALL_TAGS}"
+
+_TOK_REQ='required'
+_PATH_LIST_PREFIX=/tmp/list_
+_PATH_LIST_UNSORTED="${_PATH_LIST_PREFIX}unsorted"
+_PATH_LIST_WHITE="${_PATH_LIST_PREFIX}white"
+_PATH_LIST_ALL_PACKAGES="${_PATH_LIST_PREFIX}all_packages"
+_PATH_LIST_BLACK="${_PATH_LIST_PREFIX}black"
+
+if ! which calc > /dev/null; then
+    prefixed_msg 'not found calc, which is needed, so installing …'
+    apt-get -y -q -q install calc > /dev/null
+fi
+
+prefixed_msg_no_nl "collect packages deemed '${_TOK_REQ}' by Debian: "
+dpkg-query -Wf '${Package} ${Priority}\n' | grep " ${_TOK_REQ}" | cut -d' ' -f1 > "${_PATH_LIST_UNSORTED}"
+sort "${_PATH_LIST_UNSORTED}" > "${_PATH_LIST_WHITE}"
+echo $(cat "${_PATH_LIST_WHITE}")
+
+prefixed_msg_no_nl 'collect installed packages outside this selection: '
+dpkg-query -Wf '${Package}\n' > "${_PATH_LIST_UNSORTED}"
+sort "${_PATH_LIST_UNSORTED}" > "${_PATH_LIST_ALL_PACKAGES}"
+comm -3 "${_PATH_LIST_ALL_PACKAGES}" "${_PATH_LIST_WHITE}" > "${_PATH_LIST_BLACK}"
+echo $(cat "${_PATH_LIST_BLACK}")
+
+prefixed_msg 'apt-mark auto from diff …'
+apt-mark auto `cat "${_PATH_LIST_BLACK}"` > /dev/null
+rm "${_PATH_LIST_UNSORTED}" "${_PATH_LIST_ALL_PACKAGES}" "${_PATH_LIST_WHITE}" "${_PATH_LIST_BLACK}"
+
+prefixed_msg 'install or mark as manually installed packages from our own selections …'
+ensure_packages_of_tags ${_INSTALL_TAGS} 
+
+prefixed_msg 'run autopurge to get rid of all unwanted packages …'
+apt_get_digested '-q -q autopurge'
+
+prefixed_msg_exit
index 5fed9ee6281ae611bc7406cc03f6f4ed09fce789..612cb3fcba51200114b1461a40d816b7a4941e26 100755 (executable)
@@ -5,8 +5,12 @@ cd $(dirname "$0")
 . lib/constants_ssh  # PATH_REL_SSH, PATH_USER_SSH
 . lib/expect_n_args
 . lib/path_tmp_timestamped
+. lib/prefixed_msg
 . lib/trapp
 
+prefixed_msg_init 'init_server_access.sh'
+prefixed_msg 'starting'
+
 PATH_KNOWN_HOSTS="${PATH_USER_SSH}/known_hosts"
 URL_REPO_CLONE='https://plomlompom.com/repos/clone/config'
 
@@ -15,14 +19,14 @@ SERVER="$1"
 NEW_ROOT_PW="$2"
 OLD_ROOT_PW="$3"
 if [ ! -z "${OLD_ROOT_PW}" ]; then
-    echo '# Provided OLD_ROOT_PW, so will later try to log-in with that and place local key file …'
+    prefixed_msg 'Provided OLD_ROOT_PW, so will later try to log-in with that and place local key file …'
     abort_if_command_unknown sshpass
 fi
 
-echo "# In ${PATH_KNOWN_HOSTS}, removing previous entry for ${SERVER} if found …"
+prefixed_msg "In ${PATH_KNOWN_HOSTS}, removing previous entry for ${SERVER} if found …"
 ssh-keygen -f "${PATH_KNOWN_HOSTS}" -R "${SERVER}" > /dev/null
 
-echo '# Scanning server for new key to add to file …'
+prefixed_msg 'Scanning server for new key to add to file …'
 PATH_LOG_KEYSCAN_STDERR=$(path_tmp_timestamped)
 CMD_RM_LOG="rm ${PATH_LOG_KEYSCAN_STDERR}"
 set +e
@@ -31,7 +35,7 @@ RESULT=$?
 set -e
 trapp "${CMD_RM_LOG}"
 if [ "${RESULT}" != "0" ]; then
-    echo "# ERROR: For some reason ssh-keyscan returned non-zero exit code, here's the stderr log:"
+    prefixed_msg "ERROR: For some reason ssh-keyscan returned non-zero exit code, here's the stderr log:"
     cat "${PATH_LOG_KEYSCAN_STDERR}"
     exit "${RESULT}" 
 fi
@@ -40,13 +44,13 @@ trapp
 
 SSH_TARGET="root@${SERVER}"
 if [ ! -z "${OLD_ROOT_PW}" ]; then
-    echo '# Logging in with provided password to place local key file …'
+    prefixed_msg 'Logging in with provided password to place local key file …'
     SSHPASS="${OLD_ROOT_PW}" sshpass -e scp -q "${PATH_USER_SSH}/id_rsa.pub" "root@${SERVER}:~/${PATH_REL_SSH}/authorized_keys"
 fi
 
 CMD_SSH="ssh ${SSH_TARGET}"
 
-echo '# On server, setting new root password …'
+prefixed_msg 'On server, setting new root password …'
 PATH_NEW_ROOT_PW=$(path_tmp_timestamped new_server_root_pw)
 CMD_RM_ROOT_PW="rm ${PATH_NEW_ROOT_PW}"
 trapp "${CMD_RM_ROOT_PW}"
@@ -56,16 +60,19 @@ ${CMD_RM_ROOT_PW}
 trapp 
 ${CMD_SSH} "cat ${PATH_NEW_ROOT_PW} | chpasswd; ${CMD_RM_ROOT_PW}"
 
-echo '# On server, ensuring some minimum locale presence …'
+prefixed_msg 'On server, ensuring some minimum locale presence …'
 ${CMD_SSH} 'if [ ! -z "$(locale 2>&1 1>/dev/null)" ]; then localectl set-locale en_US.UTF-8; fi'
 
-echo '# On server, updating package database …'
+prefixed_msg 'On server, updating package database …'
 ${CMD_SSH} 'apt-get -q -q update'
 
-echo '# On server, installing git …'
+prefixed_msg 'On server, installing git …'
 ${CMD_SSH} 'DEBIAN_FRONTEND=noninteractive apt-get -y install git > /dev/null'
 
-echo '# On server, pulling config repo …' 
+prefixed_msg 'On server, pulling config repo …'
 ${CMD_SSH} "git clone -q ${URL_REPO_CLONE}"
 
-echo "# Server ready, log in with: ssh root@${SERVER}"
+prefixed_msg "Server ready, log in with: ssh root@${SERVER}"
+
+prefixed_msg 'finished'
+prefixed_msg_exit
diff --git a/testing/scripts/lib/apt_get_digested b/testing/scripts/lib/apt_get_digested
new file mode 120000 (symlink)
index 0000000..fdf81df
--- /dev/null
@@ -0,0 +1 @@
+../../../trixie/scripts/lib/apt_get_digested
\ No newline at end of file
diff --git a/testing/scripts/lib/minimize_installation b/testing/scripts/lib/minimize_installation
deleted file mode 120000 (symlink)
index e2b2ccb..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../../../trixie/scripts/lib/minimize_installation
\ No newline at end of file
diff --git a/testing/scripts/lib/prefixed_msg b/testing/scripts/lib/prefixed_msg
new file mode 120000 (symlink)
index 0000000..713bd58
--- /dev/null
@@ -0,0 +1 @@
+../../../trixie/scripts/lib/prefixed_msg
\ No newline at end of file
index 141573816fc005d7f06416b30e175dfd1660021e..c5f21be6c4bc34ff77a7ca1079c60a1e981a7138 100755 (executable)
@@ -57,8 +57,8 @@ adopt_wifi_connection() {
     fi
 }
 
-echo "\n# Upgrading to testing …"
-./from_older_upgrade.sh
+../../trixie/scripts/from_older_upgrade.sh desktop
+./from_older_upgrade.sh desktop
 
 # NB: This needs to come before steps potentially overwriting /etc/network/interfaces.
 apt-get -y install network-manager > /dev/null
index fb55105be9534642f19056e79439a9ddd3396806..ed9be549c6ddea541b1f62d06d60999a777773c8 100755 (executable)
@@ -6,7 +6,6 @@ cd $(dirname "$0")
 . lib/constants_etc  # PATH_ETC
 . lib/constants_releases  # PREV_RELEASE, THIS_RELEASE
 . lib/expect_n_args
-. lib/minimize_installation
 . lib/prefixed_msg
 
 prefixed_msg_init 'from_older_upgrade.sh'
@@ -22,7 +21,7 @@ prefixed_msg "starting (upgrading from ${PREV_RELEASE} to ${THIS_RELEASE})"
 prefixed_msg 'minimizing installation first so there is less to upgrade'
 INSTALL_TAGS='all minimal keep_if_installed:systemd_resolved'
 
-"../../${PREV_RELEASE}/minimize_installation" "${INSTALL_TAGS}"
+"../../${PREV_RELEASE}/scripts/minimize_installation.sh" "${INSTALL_TAGS}"
 
 apt_update_to_full_upgrade() {
     prefixed_msg 'Updating package database …'
diff --git a/trixie/scripts/lib/minimize_installation b/trixie/scripts/lib/minimize_installation
deleted file mode 120000 (symlink)
index b12c91d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../../../bookworm/scripts/lib/minimize_installation
\ No newline at end of file