From: Christian Heller Date: Thu, 24 Apr 2025 04:57:51 +0000 (+0200) Subject: Fix. X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/calendar_export?a=commitdiff_plain;h=refs%2Fheads%2Fmaster;p=config Fix. --- diff --git a/bookworm/copy/catgirl/home/plom/.config/catgirl/libera b/bookworm/copy/catgirl/home/plom/.config/catgirl/libera index 45a1c6a..3b97c2f 100644 --- a/bookworm/copy/catgirl/home/plom/.config/catgirl/libera +++ b/bookworm/copy/catgirl/home/plom/.config/catgirl/libera @@ -1,5 +1,5 @@ host = irc.libera.chat -join = #plomtest +join = #plomtest,##plomtest,#mnt-reform sasl-plain = plomtest:REPLACE_WITH_IRC_PASSWORD nick = plomtest log diff --git a/bookworm/scripts/lib/core_setup b/bookworm/scripts/lib/core_setup new file mode 100644 index 0000000..4a8cdf7 --- /dev/null +++ b/bookworm/scripts/lib/core_setup @@ -0,0 +1,59 @@ +. lib/constants_etc # PATH_ETC +. lib/constants_user # USERNAME +. lib/copy_dirtrees_of_tags +. lib/ensure_packages_of_tags + +core_setup() { + _HOSTNAME="$1" + _FQDN="$2" + _EXTERNAL_IP="$3" + _INSTALL_TAGS="$4" + + echo "Installing and/or keeping only what's required by us or Debian." + + # mark non-requireds auto + _PATH_LIST_PREFIX=/tmp/list_ + _PATH_LIST_UNSORTED="${_PATH_LIST_PREFIX}unsorted" + _PATH_LIST_ALL_PACKAGES="${_PATH_LIST_PREFIX}all_packages" + _PATH_LIST_WHITE="${_PATH_LIST_PREFIX}white" + _PATH_LIST_BLACK="${_PATH_LIST_PREFIX}black" + _TOK_REQ=' required' + dpkg-query -Wf '${Package} ${Priority}\n' | grep "${_TOK_REQ}" | cut -d' ' -f1 > "${_PATH_LIST_UNSORTED}" + sort "${_PATH_LIST_UNSORTED}" > "${_PATH_LIST_WHITE}" + 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}" + apt-mark auto `cat "${_PATH_LIST_BLACK}"` > /dev/null + rm "${_PATH_LIST_UNSORTED}" "${_PATH_LIST_ALL_PACKAGES}" "${_PATH_LIST_WHITE}" "${_PATH_LIST_BLACK}" + + # before purging, ensure tagged packages installed + ensure_packages_of_tags ${_INSTALL_TAGS} + echo "Autoremove and purge …" + apt-get -y autopurge > /dev/null + echo "And now: dist-upgrade …" + apt-get -y dist-upgrade > /dev/null + + echo "Setting up user: ${USERNAME}" + adduser --quiet --disabled-password --gecos "" "${USERNAME}" + usermod -a -G sudo "${USERNAME}" + + echo '\nCopying over files, directories.' + copy_dirtrees_of_tags ${_INSTALL_TAGS} + + echo 'Setting hostname …' + echo "${_HOSTNAME}" > "${PATH_ETC}/hostname" + hostname "${_HOSTNAME}" + + echo "Adapting ${_PATH_HOSTS} …" + _PATH_HOSTS="${PATH_ETC}/hosts" + if [ -z "${_FQDN}" ]; then + sed -i 's/REPLACE_WITH_FQDN/REPLACE_WITH_HOSTNAME.local REPLACE_WITH_HOSTNAME.localdomain/g' "${_PATH_HOSTS}" + else + sed -i 's/REPLACE_WITH_FQDN/'"${_FQDN}"'/g' "${_PATH_HOSTS}" + sed -i "s/#REPLACE_WITH_EXTERNAL_IP/${_EXTERNAL_IP}/g" "${_PATH_HOSTS}" + fi + sed -i 's/REPLACE_WITH_HOSTNAME/'"${_HOSTNAME}"'/g' "${_PATH_HOSTS}" + + echo 'Syncing clock.' + ntpdate-debian -s +} diff --git a/bookworm/scripts/setup_server.sh b/bookworm/scripts/setup_server.sh index a27dd87..68158f4 100755 --- a/bookworm/scripts/setup_server.sh +++ b/bookworm/scripts/setup_server.sh @@ -4,12 +4,10 @@ cd $(dirname "$0") . lib/constants_etc # PATH_ETC . lib/constants_ssh # PATH_REL_SSH, PATH_USER_SSH . lib/copy_dirtrees_of_tags +. lib/core_setup . lib/expect_n_args -. lib/init_packages . lib/path_tmp_timestamped . lib/put_finished_marker -. lib/setup_user -. lib/set_hostname_and_hosts INSTALL_TAGS='all server user' @@ -51,16 +49,7 @@ PATH_APT_CADDY_REPO='/etc/apt/sources.list.d/caddy-stable.list' echo "Adding caddy repo to ${PATH_APT_CADDY_REPO} …" curl -1LfsS "${PATH_CADDY_REPO}/debian.deb.txt" > "${PATH_APT_CADDY_REPO}" -init_packages "${INSTALL_TAGS}" -setup_user - -echo 'Copying over files, directories …' -copy_dirtrees_of_tags ${INSTALL_TAGS} - -set_hostname_and_hosts "${HOSTNAME}" "${EXTERNAL_IP}" "${FQDN}" - -echo 'Syncing clock …' -ntpdate-debian -s +core_setup "${HOSTNAME}" "${FQDN}" "${EXTERNAL_IP}" "${INSTALL_TAGS}" echo 'Moving SSH data from root to user …' mkdir -p "${PATH_USER_SSH}" diff --git a/testing/scripts/lib/core_setup b/testing/scripts/lib/core_setup new file mode 120000 index 0000000..57b9805 --- /dev/null +++ b/testing/scripts/lib/core_setup @@ -0,0 +1 @@ +../../../trixie/scripts/lib/core_setup \ No newline at end of file diff --git a/testing/scripts/setup_desktop.sh b/testing/scripts/setup_desktop.sh index b43be60..f58924c 100755 --- a/testing/scripts/setup_desktop.sh +++ b/testing/scripts/setup_desktop.sh @@ -6,11 +6,9 @@ cd $(dirname "$0") . lib/constants_etc # PATH_ETC . lib/constants_user # USERNAME . lib/copy_dirtrees_of_tags +. lib/core_setup . lib/expect_n_args -. lib/init_packages . lib/put_finished_marker -. lib/setup_user -. lib/set_hostname_and_hosts PATH_NETWORK_INTERFACES="${PATH_ETC}/network/interfaces" THINKPAD_NAMES="x220 w530 t490s" @@ -70,16 +68,7 @@ else echo "\nAlready know wifi connection, nothing to add." fi -init_packages "${INSTALL_TAGS}" -setup_user - -echo '\nCopying over files, directories.' -copy_dirtrees_of_tags ${INSTALL_TAGS} - -set_hostname_and_hosts "${SYSTEM_NAME}" - -echo '\nSyncing clock.' -ntpdate-debian -s +core_setup "${SYSTEM_NAME}" "" "" "${INSTALL_TAGS}" echo "\nEnsuring our desired locale is available." locale-gen