home · contact · privacy
Fix.
authorChristian Heller <c.heller@plomlompom.de>
Mon, 5 May 2025 22:14:51 +0000 (00:14 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Mon, 5 May 2025 22:14:51 +0000 (00:14 +0200)
bookworm/scripts/lib/apt_get_digested
bookworm/scripts/lib/core_setup
bookworm/scripts/lib/ensure_packages_of_tags
bookworm/scripts/lib/install_tags
bookworm/scripts/lib/minimize_installation
bookworm/scripts/lib/prefixed_msg
bookworm/scripts/setup_catgirl.sh
bookworm/scripts/setup_seedbox.sh
bookworm/scripts/setup_server.sh

index 30ed81ec3b0bc72f913389451eab7ddf9e91bae2..ca65f5c3676970b147f7062510b41797f9a64246 100644 (file)
@@ -2,7 +2,7 @@
 . lib/prefixed_msg
 
 apt_get_digested() {
-prefixed_msg_init 'apt_get_digested'
+prefixed_msg_init 'apt_get_digested'
 
 abort_if_command_unknown calc
 
index 44b7552fcdfe8964c491c693bfa5bcef35986750..a8ed30154bec42b614224ccebaf5f0dc885436d3 100644 (file)
@@ -4,7 +4,7 @@
 . lib/minimize_installation
 . lib/prefixed_msg
 core_setup() {
-prefixed_msg_init 'core_setup'
+prefixed_msg_init 'core_setup'
 prefixed_msg 'starting (performing standard installation setup steps)'
 
 _HOSTNAME="$1"
index 06eb91b47d213dc86dcb59a3ae576bed2143d617..310a2cc545f4246131066d1420013979ac2f7dce 100644 (file)
@@ -2,21 +2,34 @@
 . lib/prefixed_msg
 
 ensure_packages_of_tags() {
-prefixed_msg_init 'ensure_packages_of_tags'
-prefixed_msg 'starting (walking through package names in ../aptmark/ files to ensure respective packages are installed'
+prefixed_msg_init 'ensure_packages_of_tags'
+prefixed_msg 'starting'
 
+_INSTALL_CMD='apt_get_digested "-q -q -o Dpkg::Options::=--force-confnew install'
 for _TAG in $@; do
+    prefixed_msg_no_nl "For tag '${_TAG}', "
+    if [ "$(echo ${_TAG} | cut -d':' -f1)" = 'keep_if_installed' ]; then
+        _PACKAGE=$(echo ${_TAG} | cut -d':' -f2)
+        printf 'checking if installed … '
+        if dpkg-query -Wf '${Package}\n' | grep '^'"${_PACKAGE}"'$' > /dev/null; then
+            echo 'yup, keeping!'
+            ${_INSTALL_CMD} ${_PACKAGE}
+        else 
+            echo 'nope, nothing to keep.'
+        fi
+        continue
+    fi
     _PATH_APTMARK_TAG="../aptmark/${_TAG}"
     if [ ! -f "${_PATH_APTMARK_TAG}" ]; then
+        echo 'no file, ignoring.'
         continue
     fi
     _PACKAGES=$(cat "${_PATH_APTMARK_TAG}" | sed -E 's/#.*//g' | sed -z 's/\n/ /g' | sed 's/  */ /g' | cut -c 2-)
-    prefixed_msg_no_nl "For tag '${_TAG}', "
     if [ -z "${_PACKAGES}" ]; then
-        echo "nothing to install."
+        echo 'nothing to install.'
     else
-        echo "ensuring installation of: ${_PACKAGES}"
-        apt_get_digested "-q -q -o Dpkg::Options::=--force-confnew install ${_PACKAGES}"
+        echo 'ensuring installation of: ${_PACKAGES}'
+        ${_INSTALL_CMD} ${_PACKAGES}
     fi
 done
 prefixed_msg 'finished'
index 39c0f4e67512b7fb3e7e55b6353f898635482e41..4169bd689a00b7840c506eef7ba11cba9930aff0 100644 (file)
@@ -2,7 +2,7 @@
 . lib/ensure_packages_of_tags
 . lib/prefixed_msg
 install_tags() {
-    prefixed_msg_init 'install_tags'
+    prefixed_msg_init 'install_tags'
 
     _INSTALL_TAGS="$@"
     prefixed_msg "Installing packages and files for: ${_INSTALL_TAGS}"
index 67050acd79ffd9687e3b6c77017465c99cc6f276..2f1a2bb52dbff38c0cb863c388d28e788aa581f6 100644 (file)
@@ -3,7 +3,7 @@
 . lib/prefixed_msg
 
 minimize_installation() {
-prefixed_msg_init 'minimize_installation'
+prefixed_msg_init 'minimize_installation'
 _INSTALL_TAGS="$@"
 prefixed_msg "starting (narrow system to what is required explicitly by Debian and by us, as per these INSTALL_TAGS: ${_INSTALL_TAGS})"
 
index 4ac74eddd96b1eda4d8e7791eb42c979bc7d7803..d29d6bfd5899dde398370885d87ca414fc474646 100644 (file)
@@ -15,7 +15,7 @@ prefixed_msg_no_nl() {
         _INDENT="${_INDENT}${_INDENTOR}"
         _SEPARATORS=$(echo -n "${_SEPARATORS}" | cut -d'|' -f2-)
     done
-    printf '%s%s%s' "${_INDENT}" "${prefixed_msg_PREFIX}" "$1"
+    printf '%s%s%s' "${_INDENT}" "${prefixed_msg_PREFIX}" "$1"
 }
 prefixed_msg() {
     prefixed_msg_no_nl "$1"
index fff8ed7c1936d900f203827b4c9fd87db98b663d..e7d64350e86672ead1a08c74bb5eb045cd458d37 100755 (executable)
@@ -7,7 +7,7 @@ cd $(dirname "$0")
 . lib/install_tags
 . lib/prefixed_msg
 
-prefixed_msg_init 'setup_catgirl.sh'
+prefixed_msg_init 'setup_catgirl.sh'
 prefixed_msg 'starting'
 
 expect_n_args 1 1 'IRC_PASSWORD' $@
index f4e5ddbbad555ca5acbfff0b139eadf28f963d6f..c3124712568fdd38d3b74affa88f05c886d60b03 100755 (executable)
@@ -6,7 +6,7 @@ cd $(dirname "$0")
 . lib/install_tags
 . lib/prefixed_msg
 
-prefixed_msg_init 'setup_seedbox.sh'
+prefixed_msg_init 'setup_seedbox.sh'
 prefixed_msg 'starting'
 
 expect_n_args 0 0 '' $@
index da170745b1857a469fa519560339106874479f02..cce061e5ac211847bd9947eb450564230d728a8d 100755 (executable)
@@ -11,10 +11,10 @@ cd $(dirname "$0")
 . lib/prefixed_msg
 . lib/put_finished_marker
 
-prefixed_msg_init 'setup_server.sh'
+prefixed_msg_init 'setup_server.sh'
 prefixed_msg 'starting (setting up basics of standard server)'
 
-INSTALL_TAGS='all server user'
+INSTALL_TAGS='all server user keep_if_installed:systemd-resolved'
 
 abort_if_command_unknown gpg
 expect_n_args 2 3 'CADDY_PASSWORD, HOSTNAME, [FQDN]' $@