From 476423069dd3823f0522f8c4e23f67251cfcfeb5 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Mon, 31 Mar 2025 10:00:58 +0200 Subject: [PATCH] Fixes. --- bookworm/preseed.cfg | 14 +++++---- bookworm/scripts/lib/install_aptmarkeds | 15 --------- bookworm/scripts/lib/mark_nonrequireds_auto | 15 --------- bookworm/scripts/setup_server.sh | 28 ++++++----------- testing/scripts/setup_desktop.sh | 35 ++++++--------------- 5 files changed, 27 insertions(+), 80 deletions(-) delete mode 100644 bookworm/scripts/lib/install_aptmarkeds delete mode 100644 bookworm/scripts/lib/mark_nonrequireds_auto diff --git a/bookworm/preseed.cfg b/bookworm/preseed.cfg index 481658a..82d6d68 100644 --- a/bookworm/preseed.cfg +++ b/bookworm/preseed.cfg @@ -1,6 +1,6 @@ #_preseed_V1 -d-i debian-installer/load-cdrom/title +#d-i debian-installer/load-cdrom/title d-i netcfg/choose_interface select auto d-i netcfg/link_wait_timeout string 3 @@ -13,8 +13,11 @@ d-i netcfg/get_domain string unassigned-domain d-i passwd/root-login boolean true user-setup-udeb passwd/make-user boolean false -# d-i partman-auto/method string crypto +#d-i partman-auto/method string crypto +#d-i partman-auto/select_disk /var/lib/partman/devices/=dev=nvme0n1 d-i partman-auto-lvm/guided_size string max +#d-i partman-auto-lvm/new_vg_name plomvg +#d-i partman-lvm/confirm true #d-i partman-auto/choose_recipe select atomic d-i partman-auto-crypto/erase_disks boolean false # d-i partman-lvm/confirm boolean true @@ -22,11 +25,11 @@ d-i partman-auto-crypto/erase_disks boolean false d-i base-installer/kernel/image string linux-image-amd64 d-i base-installer/initramfs-tools/driver-policy most -# d-i pkgsel/run_tasksel boolean false +#d-i pkgsel/run_tasksel boolean false -d-i apt-setup/use-mirror true +#d-i apt-setup/use-mirror true d-i mirror/protocol string http -d-i mirror/http/proxy +#d-i mirror/http/proxy #d-i mirror/http/hostname string http.us.debian.org d-i apt-setup/enable-source-repositories true d-i apt-setup/non-free-firmware boolean true @@ -34,7 +37,6 @@ d-i apt-setup/non-free boolean true d-i apt-setup/contrib boolean true d-i apt-setup/services-select security, updates -# d-i grub-installer/only_debian boolean true d-i grub-installer/force-efi-extra-removable false d-i grub-installer/update-nvram true d-i grub-installer/enable_os_prober_otheros_no false diff --git a/bookworm/scripts/lib/install_aptmarkeds b/bookworm/scripts/lib/install_aptmarkeds deleted file mode 100644 index daf91d1..0000000 --- a/bookworm/scripts/lib/install_aptmarkeds +++ /dev/null @@ -1,15 +0,0 @@ -install_aptmarkeds() { - # Walk through the package names in ../aptmark/ files to ensure the respective - # packages are installed. - for TAG in $@; do - PATH_APTMARK_TAG="${PATH_CONF}/aptmark/${TAG}" - if [ ! -f "${PATH_APTMARK_TAG}" ]; then - continue - fi - cat "${PATH_APTMARK_TAG}" | while read LINE; do - if [ ! $(echo "${LINE}" | cut -c1) = "#" ]; then - apt-get -y -o Dpkg::Options::="--force-confnew" install "${LINE}" - fi - done - done -} diff --git a/bookworm/scripts/lib/mark_nonrequireds_auto b/bookworm/scripts/lib/mark_nonrequireds_auto deleted file mode 100644 index 0b2a435..0000000 --- a/bookworm/scripts/lib/mark_nonrequireds_auto +++ /dev/null @@ -1,15 +0,0 @@ -mark_nonrequireds_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}" | sed "s/${TOK_REQ}//" > "${PATH_LIST_UNSORTED}" - sort "${PATH_LIST_UNSORTED}" | uniq > "${PATH_LIST_WHITE}" - dpkg-query -Wf '${Package}\n' > "${PATH_LIST_UNSORTED}" - sort "${PATH_LIST_UNSORTED}" | uniq > "${PATH_LIST_ALL_PACKAGES}" - comm -3 "${PATH_LIST_ALL_PACKAGES}" "${PATH_LIST_WHITE}" > "${PATH_LIST_BLACK}" - apt-mark auto `cat "${PATH_LIST_BLACK}"` - rm "${PATH_LIST_UNSORTED}" "${PATH_LIST_ALL_PACKAGES}" "${PATH_LIST_WHITE}" "${PATH_LIST_BLACK}" -} diff --git a/bookworm/scripts/setup_server.sh b/bookworm/scripts/setup_server.sh index c65fd7c..e47712e 100755 --- a/bookworm/scripts/setup_server.sh +++ b/bookworm/scripts/setup_server.sh @@ -5,8 +5,8 @@ cd $(dirname "$0") . lib/copy_dirtree . lib/determine_ip . lib/expect_min_n_args -. lib/install_aptmarkeds -. lib/mark_nonrequireds_auto +. lib/init_packages +. libs/setup_users MIN_TAGS='all server' @@ -22,17 +22,11 @@ PATH_REPO="$(dirname ${PARENT_DIR})" PATH_REL_ETC=etc PATH_CONF="${PATH_REPO}/${DEBIAN_RELEASE}" PATH_CONF_ETC="${PATH_CONF}/${PATH_REL_ETC}" -PATH_CONF_HOME="${PATH_CONF}/home" PATH_USER_SSH="${PATH_USER_HOME}/${PATH_REL_SSH}" PATH_ETC="/${PATH_REL_ETC}" PATH_HOSTS="${PATH_ETC}/hosts" -export DEBIAN_FRONTEND=noninteractive - -mark_nonrequireds_auto -install_aptmarkeds ${MIN_TAGS} -apt -y --purge autoremove -apt -y dist-upgrade +init_packages "${MIN_TAGS}" echo '\nSetting hostname and FQDN.' echo "${HOSTNAME}" > "${PATH_ETC}/hostname" @@ -42,20 +36,16 @@ echo "$(determine_ip) ${FQDN} ${HOSTNAME}" >> "${PATH_HOSTS}" echo '\nAdapting /etc to our needs.' copy_dirtree "${PATH_CONF_ETC}" "${PATH_ETC}"${MIN_TAGS} + echo '\nSetting Berlin localtime.' ln -sf /usr/share/zoneinfo/Europe/Berlin "${PATH_ETC}/localtime" ntpdate-debian -# # Enable firewall. -# systemctl enable nftables.service - -echo "\nSetting up root user's home directory." -copy_dirtree "${PATH_CONF_HOME}" '/root' ${MIN_TAGS} root +setup_users plom "${MIN_TAGS}" -echo "\nSetting up user ${USERNAME}." -adduser --disabled-password --gecos "" "${USERNAME}" -usermod -a -G sudo "${USERNAME}" -copy_dirtree "${PATH_CONF_HOME}" "${PATH_USER_HOME}" ${MIN_TAGS} user mkdir -p "${PATH_USER_SSH}" mv "${PATH_SSH}/authorized_keys" "${PATH_USER_SSH}/" -chown -R "${USERNAME}:${USERNAME}" "${PATH_USER_HOME}" +chown -R "${USERNAME}:${USERNAME}" "${PATH_USER_SSH}" + +# # Enable firewall. +# systemctl enable nftables.service diff --git a/testing/scripts/setup_desktop.sh b/testing/scripts/setup_desktop.sh index 968e560..feb3257 100755 --- a/testing/scripts/setup_desktop.sh +++ b/testing/scripts/setup_desktop.sh @@ -7,14 +7,13 @@ cd $(dirname "$0") . lib/copy_dirtree . lib/determine_ip . lib/expect_min_n_args -. lib/mark_nonrequireds_auto -. lib/install_aptmarkeds +. lib/init_packages +. libs/setup_users PARENT_DIR=$(dirname $(pwd)) DEBIAN_RELEASE=$(basename ${PARENT_DIR}) PATH_REPO=$(dirname ${PARENT_DIR}) PATH_CONF="${PATH_REPO}/${DEBIAN_RELEASE}" -PATH_CONF_HOME="${PATH_CONF}/home" PATH_REL_ETC=etc PATH_CONF_ETC="${PATH_CONF}/${PATH_REL_ETC}" @@ -26,8 +25,6 @@ TAG_ALL=all TAGS_USER='user desktop' THINKPAD_NAMES="x220 w530 t490s" -export DEBIAN_FRONTEND=noninteractive - get_system_class_for() { for THINKPAD_NAME in $THINKPAD_NAMES; do if [ "$1" = "${THINKPAD_NAME}" ]; then @@ -85,21 +82,14 @@ abort_if_illegal_system_name "${SYSTEM_NAME}" SYSTEM_CLASS_NAME="$(get_system_class_for ${SYSTEM_NAME})" MIN_TAGS="${TAG_ALL} ${SYSTEM_CLASS_NAME} ${SYSTEM_NAME}" +export DEBIAN_FRONTEND=noninteractive + echo "\nUpgrading to ${DEBIAN_RELEASE}." # For this step only very selectively prepare /etc/ files. cp "${PATH_CONF_ETC}/${TAG_ALL}/${PATH_REL_APT_CONF}/99_minimize_dependencies" "${PATH_ETC}/${PATH_REL_APT_CONF}/" upgrade_from_older_release -echo "\nInstalling and/or keeping only what's required by us or Debian." -# Ensure package installation state as defined by what packages are -# defined as required by Debian policy and by settings in ./aptmark. -mark_nonrequireds_auto -if [ "${SYSTEM_NAME}" = 'h610m' ]; then - # Hold kernel known to work with nvidia-drivers. - apt-mark hold linux-image-amd64 linux-headers-amd64 -fi -install_aptmarkeds ${MIN_TAGS} ${TAGS_USER} -apt -y --purge autoremove +init_packages "${MIN_TAGS}" # NB: This needs to come before steps potentially overwriting /etc/network/interfaces. echo "\nChecking for existing wifi config in ${PATH_NETWORK_INTERFACES}." @@ -113,18 +103,13 @@ echo "$(determine_ip) ${SYSTEM_NAME}" >> /etc/hosts echo "\nAdapting /etc to our needs." copy_dirtree "${PATH_CONF_ETC}" '/etc' ${MIN_TAGS} ${TAGS_USER} -echo "\nEnsuring our desired locale is available." -locale-gen + +# echo "\nEnsuring our desired locale is available." +# locale-gen + echo "\nSetting Berlin localtime." ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime ntpdate-debian -echo "\nSetting up root user's home directory." -copy_dirtree "${PATH_CONF_HOME}" '/root' ${MIN_TAGS} root - -echo "\nSetting up user ${USERNAME}." -adduser --disabled-password --gecos "" "${USERNAME}" -usermod -a -G sudo "${USERNAME}" -copy_dirtree "${PATH_CONF_HOME}" "${PATH_USER_HOME}" ${MIN_TAGS} ${TAGS_USER} -chown -R "${USERNAME}:${USERNAME}" "${PATH_USER_HOME}" +setup_users plom "${MIN_TAGS}" passwd "${USERNAME}" -- 2.30.2