home · contact · privacy
Improve Raspi setup. master
authorChristian Heller <c.heller@plomlompom.de>
Thu, 24 Oct 2024 19:39:34 +0000 (21:39 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Thu, 24 Oct 2024 19:39:34 +0000 (21:39 +0200)
many_releases/aptmark/all [deleted file]
many_releases/etc/all/etc/locale.conf [deleted file]
many_releases/scripts/_misc.sh
testing/aptmark/all [new file with mode: 0644]
testing/aptmark/raspi [new file with mode: 0644]
testing/etc/all/etc/locale.conf [new file with mode: 0644]
testing/scripts/setup_raspi.sh

diff --git a/many_releases/aptmark/all b/many_releases/aptmark/all
deleted file mode 100644 (file)
index 617b707..0000000
+++ /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 (file)
index dd6eee3..0000000
+++ /dev/null
@@ -1 +0,0 @@
-LANG="en_US.UTF-8"
index d1aa60684c368d80822769c71f6989b30078b5c8..a1bf381974db9b67c1da2914359af55a9b956028 100755 (executable)
@@ -53,7 +53,7 @@ install_for_modules() {
     shift 1
     modules="$@"
     for module in "${modules}"; do
     shift 1
     modules="$@"
     for module in "${modules}"; do
-        path="${aptmark_dir}/${module}"
+        path="${apt_mark_dir}/${module}"
         if [ ! -f "${path}" ]; then
             continue
         fi
         if [ ! -f "${path}" ]; then
             continue
         fi
@@ -67,15 +67,30 @@ install_for_modules() {
 }
 
 mark_nonrequireds_auto() {
 }
 
 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}"
     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}"`
     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 (file)
index 0000000..e0dc9ee
--- /dev/null
@@ -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 (file)
index 0000000..eab877a
--- /dev/null
@@ -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 (file)
index 0000000..dd6eee3
--- /dev/null
@@ -0,0 +1 @@
+LANG="en_US.UTF-8"
index 84c3f8a4989525d625aea73215d967e0c03a53ae..e0966c6b1634c4dd18702fa5f8236f33b6128a38 100755 (executable)
@@ -13,18 +13,20 @@ cat "${FILENAME_PUBLIC_KEY}" >> ~/.ssh/authorized_keys
 rm "${FILENAME_PUBLIC_KEY}" 
 # service sshd restart
 
 rm "${FILENAME_PUBLIC_KEY}" 
 # service sshd restart
 
+upgrade_from_older_release
+
 # properly apt system
 for root in "${PATH_MANY}" '..'; do
 # 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
 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
 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
 
 # Ensure our desired locale is available.
 # locale-gen