From 6d34566d5bd46966d33fefb1efb456bf2702689e Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Tue, 25 Feb 2025 04:09:29 +0100 Subject: [PATCH] Improve new testing setup. --- many_releases/aptmark/all | 3 +-- many_releases/scripts/_misc.sh | 7 +++++-- testing/apt-mark/all | 2 ++ testing/apt-mark/t490s | 3 +++ testing/scripts/misc.sh | 12 ++++++++++-- testing/scripts/setup_desktop.sh | 25 ++++++++++++++++++++++--- 6 files changed, 43 insertions(+), 9 deletions(-) create mode 100644 testing/apt-mark/t490s diff --git a/many_releases/aptmark/all b/many_releases/aptmark/all index e0dc9ee..41bd4a9 100644 --- a/many_releases/aptmark/all +++ b/many_releases/aptmark/all @@ -1,5 +1,4 @@ -# connectivity: ifupdown seems necessary everyhwere, isc-dhcp-client -# unpredictably so +# connectivity: ifupdown seems necessary everyhwere, isc-dhcp-client unpredictably so ifupdown isc-dhcp-client # git for the setup directory; cloning works with ca-certificates diff --git a/many_releases/scripts/_misc.sh b/many_releases/scripts/_misc.sh index 8cf0ca7..0b86948 100755 --- a/many_releases/scripts/_misc.sh +++ b/many_releases/scripts/_misc.sh @@ -30,8 +30,11 @@ copy_dirtree() { modules="$@" initial_directory="$(pwd)" for module in ${modules}; do - mkdir -p "${source_root}/${module}" - cd "${source_root}/${module}" + module_path="${source_root}/${module}" + if [ ! -d "${module_path}" ]; then + continue + fi + cd "${module_path}" for path in $(find . -type f); do target_path="${target_root}"$(echo "${path}" | cut -c2-) source_path=$(realpath "${path}") diff --git a/testing/apt-mark/all b/testing/apt-mark/all index 617b707..cf4af24 100644 --- a/testing/apt-mark/all +++ b/testing/apt-mark/all @@ -10,3 +10,5 @@ locales # extremely useful for basic network debugging; missed these more than once in an emergency netcat-traditional iputils-ping +# to set the time +ntpsec-ntpdate diff --git a/testing/apt-mark/t490s b/testing/apt-mark/t490s new file mode 100644 index 0000000..9be8397 --- /dev/null +++ b/testing/apt-mark/t490s @@ -0,0 +1,3 @@ +# so we can work without the Ethernet adapter +network-manager + diff --git a/testing/scripts/misc.sh b/testing/scripts/misc.sh index ad1d4d6..71f8ba8 100644 --- a/testing/scripts/misc.sh +++ b/testing/scripts/misc.sh @@ -13,17 +13,25 @@ config_tree_prefix="${repo_path}/testing" setup_scripts_dir="${config_tree_prefix}/scripts" get_system_name_arg() { - legal_system_names="t490s" + thinkpad_names="x220 w530 t490s" + legal_system_names="${thinkpad_names} h610m" found=0 for system_name_i in $legal_system_names; do if [ "$1" = "$system_name_i" ]; then found=1 system_name="${system_name_i}" - continue + break fi done if [ "$found" = 0 ]; then echo "Need legal system name." false fi + system_class_name= + for thinkpad_name in $thinkpad_names; do + if [ "${system_name}" = "${thinkpad_name}" ]; then + system_class_name=thinkpad + break + fi + done } diff --git a/testing/scripts/setup_desktop.sh b/testing/scripts/setup_desktop.sh index d739593..c017095 100755 --- a/testing/scripts/setup_desktop.sh +++ b/testing/scripts/setup_desktop.sh @@ -5,11 +5,12 @@ set -x expect_min_n_args 1 "(system name)" "$@" get_system_name_arg "$1" +min_modules="all ${system_class_name} ${system_name}" # Adapt /etc/ to our needs by copying from ./etc_files. This will set # basic configurations affecting following steps, such as setup of APT # and the locale selection, so needs to be right at the beginning. -copy_dirtree.sh "${config_tree_prefix}/${PATH_REL_ETC}" "" all +copy_dirtree "${config_tree_prefix}/${PATH_REL_ETC}" "" ${min_modules} # Migrate to testing. upgrade_from_older_release @@ -45,12 +46,16 @@ echo "${final_ip} ${system_name}" >> /etc/hosts # Ensure package installation state as defined by what packages are # defined as required by Debian policy and by settings in ./apt-mark/. 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 for root in "${PATH_MANY}" '..'; do - install_for_modules "${root}/${PATH_REL_APTMARK}" all + install_for_modules "${root}/${PATH_REL_APTMARK}" ${min_modules} done apt -y --purge autoremove for root in "${PATH_MANY}" '..'; do - copy_dirtree "${root}/${PATH_REL_ETC}" '/etc' all + copy_dirtree "${root}/${PATH_REL_ETC}" '/etc' ${min_modules} done # Ensure our desired locale is available. @@ -59,3 +64,17 @@ locale-gen # Set Berlin localtime. ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime ntpdate-debian + +# Set up root environment. +for root in "${PATH_MANY}" '..'; do + copy_dirtree "${root}/${PATH_REL_HOME}" '/root' ${min_modules} minimal root +done + +# Set up user and their environment. +adduser --disabled-password --gecos "" "${USERNAME}" +usermod -a -G sudo "${USERNAME}" +for root in "${PATH_MANY}" '..'; do + copy_dirtree "${root}/${PATH_REL_HOME}" "${PATH_USER_HOME}" ${min_modules} desktop +done +chown -R "${USERNAME}:${USERNAME}" "${PATH_USER_HOME}" +passwd "${USERNAME}" -- 2.30.2