. 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)'
_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'
+++ /dev/null
-. 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
-}
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() {
--- /dev/null
+#!/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
. 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'
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
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
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}"
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
--- /dev/null
+../../../trixie/scripts/lib/apt_get_digested
\ No newline at end of file
+++ /dev/null
-../../../trixie/scripts/lib/minimize_installation
\ No newline at end of file
--- /dev/null
+../../../trixie/scripts/lib/prefixed_msg
\ No newline at end of file
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
. 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'
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 …'
+++ /dev/null
-../../../bookworm/scripts/lib/minimize_installation
\ No newline at end of file