From: Christian Heller Date: Thu, 24 Oct 2024 19:39:34 +0000 (+0200) Subject: Improve Raspi setup. X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/%7B%7B%20web_path%20%7D%7D/decks/%7B%7Bprefix%7D%7D/tasks?a=commitdiff_plain;h=6a4730e7cba9709474a0bedb858a2938e3d3f77f;p=config Improve Raspi setup. --- diff --git a/many_releases/aptmark/all b/many_releases/aptmark/all deleted file mode 100644 index 617b707..0000000 --- a/many_releases/aptmark/all +++ /dev/null @@ -1,12 +0,0 @@ -# connectivity: ifupdown seems necessary everyhwere, isc-dhcp-client -# unpredictably so -ifupdown -isc-dhcp-client -# git for the setup directory; cloning works with ca-certificates -ca-certificates -git -# to avoid constant warnings about no locale being found -locales -# extremely useful for basic network debugging; missed these more than once in an emergency -netcat-traditional -iputils-ping diff --git a/many_releases/etc/all/etc/locale.conf b/many_releases/etc/all/etc/locale.conf deleted file mode 100644 index dd6eee3..0000000 --- a/many_releases/etc/all/etc/locale.conf +++ /dev/null @@ -1 +0,0 @@ -LANG="en_US.UTF-8" diff --git a/many_releases/scripts/_misc.sh b/many_releases/scripts/_misc.sh index d1aa606..a1bf381 100755 --- a/many_releases/scripts/_misc.sh +++ b/many_releases/scripts/_misc.sh @@ -53,7 +53,7 @@ install_for_modules() { shift 1 modules="$@" for module in "${modules}"; do - path="${aptmark_dir}/${module}" + path="${apt_mark_dir}/${module}" if [ ! -f "${path}" ]; then continue fi @@ -67,15 +67,30 @@ install_for_modules() { } mark_nonrequireds_auto() { - path_list_unsorted="/tmp/list_unsorted" - path_list_all_packages="/tmp/list_all_packages" - path_list_white="/tmp/list_white" - path_list_black="/tmp/list_black" + path_list_unsorted='/tmp/list_unsorted' + path_list_all_packages='/tmp/list_all_packages' + path_list_white='/tmp/list_white' + path_list_black='/tmp/list_black' dpkg-query -Wf '${Package} ${Priority}\n' | grep ' required' | sed 's/ required//' > "${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}" + 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_white}" + rm "${path_list_unsorted}" "${path_list_all_packages}" "${path_list_white}" "${path_list_black}" +} + +upgrade_from_older_release() { + # Upgrade system to calling context's Debian release. + # Caution: Don't expect any customized /etc files to surivive this! + path_sources_list='/etc/apt/sources.list' + apt update + apt -y -o Dpkg::Options::='--force-confnew' upgrade + apt -y -o Dpkg::Options::='--force-confnew' full-upgrade + cp "../etc/all${path_sources_list}" "${path_sources_list}" + apt clean + apt update + apt -y -o Dpkg::Options::='--force-confnew' upgrade + apt -y -o Dpkg::Options::='--force-confnew' full-upgrade + apt -y autoremove } diff --git a/testing/aptmark/all b/testing/aptmark/all new file mode 100644 index 0000000..e0dc9ee --- /dev/null +++ b/testing/aptmark/all @@ -0,0 +1,13 @@ +# connectivity: ifupdown seems necessary everyhwere, isc-dhcp-client +# unpredictably so +ifupdown +isc-dhcp-client +# git for the setup directory; cloning works with ca-certificates +ca-certificates +git +# to avoid constant warnings about no locale being found +locales +# extremely useful for basic network debugging; missed these more than once in an emergency +netcat-traditional +iputils-ping + diff --git a/testing/aptmark/raspi b/testing/aptmark/raspi new file mode 100644 index 0000000..eab877a --- /dev/null +++ b/testing/aptmark/raspi @@ -0,0 +1,5 @@ +# so we can still connect +openssh-server +# this gotta be good for _something_ … +raspi-firmware + diff --git a/testing/etc/all/etc/locale.conf b/testing/etc/all/etc/locale.conf new file mode 100644 index 0000000..dd6eee3 --- /dev/null +++ b/testing/etc/all/etc/locale.conf @@ -0,0 +1 @@ +LANG="en_US.UTF-8" diff --git a/testing/scripts/setup_raspi.sh b/testing/scripts/setup_raspi.sh index 84c3f8a..e0966c6 100755 --- a/testing/scripts/setup_raspi.sh +++ b/testing/scripts/setup_raspi.sh @@ -13,18 +13,20 @@ cat "${FILENAME_PUBLIC_KEY}" >> ~/.ssh/authorized_keys rm "${FILENAME_PUBLIC_KEY}" # service sshd restart +upgrade_from_older_release + # properly apt system for root in "${PATH_MANY}" '..'; do - copy_dirtree "${root}/${NAME_ETC_DIR}" "" all + copy_dirtree "${root}/${NAME_ETC_DIR}" "" all raspi done apt update mark_nonrequireds_auto for root in "${PATH_MANY}" '..'; do - install_for_modules "${root}/${NAME_APTMARK_DIR}" all + install_for_modules "${root}/${NAME_APTMARK_DIR}" all raspi done apt -y --purge autoremove -apt -y -o Dpkg::Options::='--force-confnew' upgrade -apt -y -o Dpkg::Options::='--force-confnew' full-upgrade + +# TODO test if isc-dhcp-client necessary (ifupdown certainly is) # Ensure our desired locale is available. # locale-gen