From 8305fa16cd8e44f3f88a34cfd3135fee49c67270 Mon Sep 17 00:00:00 2001 From: "Jean (east-high-Nerd)" Date: Wed, 24 Dec 2025 16:32:44 -0500 Subject: [PATCH] Split off more Debian-related tasks into 'debian.sh' --- debian.sh | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++- install.sh | 28 ++-------------- post-inst.sh | 40 ++--------------------- pre-inst.sh | 25 +------------- 4 files changed, 97 insertions(+), 88 deletions(-) diff --git a/debian.sh b/debian.sh index e9d9185..f8e69a0 100755 --- a/debian.sh +++ b/debian.sh @@ -9,7 +9,28 @@ source \ "${baseDir}/system.conf" -if [[ "${1}" == '--mmdebstrap' ]]; then +if [[ "${1}" == '--live' ]]; then + if [[ ! "$(hostname)" == "debian-live" ]]; then + cat << EOF | tee /etc/apt/sources.list.d/contrib.sources 1> /dev/null +Enabled: yes +Types: deb +URIs: http://deb.debian.org/debian/ +Suites: ${VERSION_CODENAME} +Components: contrib +Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg +EOF + fi + + apt \ + --update \ + install \ + --yes \ + mmdebstrap \ + gdisk \ + systemd-timesyncd \ + whois \ + zfsutils-linux +elif [[ "${1}" == '--mmdebstrap' ]]; then packages=(\ console-setup \ cryptsetup \ @@ -86,4 +107,73 @@ Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg EOF rm /mnt/etc/apt/sources.list +elif [[ "${1}" == '--dpkg-reconfigure' ]]; then + cat << EOF + +Regardless of the language(s) you choose, be sure to enable 'en_US.UTF-8'! +Press any key to continue... +EOF + + read -srn 1 + + dpkg-reconfigure \ + locales \ + tzdata \ + keyboard-configuration \ + console-setup +elif [[ "${1}" == '--purge-os-prober' ]]; then + apt \ + purge \ + --yes \ + os-prober +elif [[ "${1}" == '--network-manager' ]]; then + cp \ + /etc/NetworkManager/NetworkManager.conf \ + /etc/NetworkManager/NetworkManager.conf.orig + + cat \ + /etc/NetworkManager/NetworkManager.conf.orig | \ + sed 's|managed=false|managed=true|' | \ + tee /etc/NetworkManager/NetworkManager.conf &> /dev/null +elif [[ "${1}" == '--contrib' ]]; then + cat << EOF | tee --append /etc/apt/sources.list.d/${VERSION_CODENAME}.sources &> /dev/null + +# ${VERSION_CODENAME^} Backports +Enabled: yes +Types: deb deb-src +URIs: http://deb.debian.org/debian/ +Suites: ${VERSION_CODENAME}-backports +Components: main non-free-firmware contrib +Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg +EOF + + cat << EOF | tee /etc/apt/preferences.d/backports.pref &> /dev/null +Package: * +Pin: release n=${VERSION_CODENAME}* +Pin-Priority: 990 + +Package: linux-* +Pin: release n=${VERSION_CODENAME}-backports +Pin-Priority: -1 +EOF + + if [[ "${VERSION_CODENAME}" == 'bookworm' ]]; then + cat << EOF | tee --append /etc/apt/preferences.d/backports.pref &> /dev/null + +Package: /wayland/ +Pin: release n=${VERSION_CODENAME}-backports +Pin-Priority: -1 +EOF + fi +elif [[ "${1}" == '--tasksel' ]]; then + if [[ ! -f /usr/bin/tasksel ]]; then + apt \ + --update \ + install \ + --yes \ + tasksel + fi + + tasksel \ + --new-install fi diff --git a/install.sh b/install.sh index d401dd0..a5787b0 100755 --- a/install.sh +++ b/install.sh @@ -112,19 +112,7 @@ if [[ "${ID}" == 'fedora' ]]; then fi if [[ "${ID}" == 'debian' ]] || [[ "${ID}" == 'elementary' ]]; then - cat << EOF - -Regardless of the language(s) you choose, be sure to enable 'en_US.UTF-8'! -Press any key to continue... -EOF - - read -srn 1 - - dpkg-reconfigure \ - locales \ - tzdata \ - keyboard-configuration \ - console-setup + "${baseDir}/debian.sh" --dpkg-reconfigure fi if [[ "${ID}" == 'debian' ]]; then @@ -155,10 +143,7 @@ mount \ /boot/efi if [[ "${ID}" == 'debian' ]] || [[ "${ID}" == 'elementary' ]]; then - apt \ - purge \ - --yes \ - os-prober + "${baseDir}/debian.sh" --purge-os-prober fi printf \ @@ -185,14 +170,7 @@ if [[ "${enableSwap}" == "yes" ]]; then fi if [[ "${ID}" == 'debian' ]]; then - cp \ - /etc/NetworkManager/NetworkManager.conf \ - /etc/NetworkManager/NetworkManager.conf.orig - - cat \ - /etc/NetworkManager/NetworkManager.conf.orig | \ - sed 's|managed=false|managed=true|' | \ - tee /etc/NetworkManager/NetworkManager.conf &> /dev/null + "${baseDir}/debian.sh" --network-manager fi if [[ "${ID}" == 'debian' ]] || [[ "${ID}" == 'elementary' ]]; then diff --git a/post-inst.sh b/post-inst.sh index 867b392..2ea766f 100755 --- a/post-inst.sh +++ b/post-inst.sh @@ -120,35 +120,7 @@ Pin: release n=${UBUNTU_VERSION_CODENAME}-backports Pin-Priority: -1 EOF elif [[ "${ID}" == 'debian' ]]; then - cat << EOF | tee --append /etc/apt/sources.list.d/${VERSION_CODENAME}.sources &> /dev/null - -# ${VERSION_CODENAME^} Backports -Enabled: yes -Types: deb deb-src -URIs: http://deb.debian.org/debian/ -Suites: ${VERSION_CODENAME}-backports -Components: main non-free-firmware contrib -Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg -EOF - - cat << EOF | tee /etc/apt/preferences.d/backports.pref &> /dev/null -Package: * -Pin: release n=${VERSION_CODENAME}* -Pin-Priority: 990 - -Package: linux-* -Pin: release n=${VERSION_CODENAME}-backports -Pin-Priority: -1 -EOF - - if [[ "${VERSION_CODENAME}" == 'bookworm' ]]; then - cat << EOF | tee --append /etc/apt/preferences.d/backports.pref &> /dev/null - -Package: /wayland/ -Pin: release n=${VERSION_CODENAME}-backports -Pin-Priority: -1 -EOF - fi + "${baseDir}/debian.sh" --contrib fi if [[ "${ID}" == 'debian' ]] || [[ "${ID}" == 'elementary' ]]; then @@ -164,15 +136,7 @@ if [[ "${ID}" == 'elementary' ]]; then --autoremove \ elementary-desktop elif [[ "${ID}" = 'debian' ]]; then - if [[ ! -f /usr/bin/tasksel ]]; then - apt \ - install \ - --yes \ - tasksel - fi - - tasksel \ - --new-install + "${baseDir}/debian.sh" --tasksel fi if [[ "${ID}" == 'debian' ]] || [[ "${ID}" == 'elementary' ]]; then diff --git a/pre-inst.sh b/pre-inst.sh index a97a3fb..d6fe88a 100755 --- a/pre-inst.sh +++ b/pre-inst.sh @@ -31,20 +31,6 @@ source \ "${baseDir}/system.conf" -if [[ "${ID}" == 'debian' ]]; then - if [[ ! "$(hostname)" == "debian-live" ]]; then - cat << EOF | tee /etc/apt/sources.list.d/contrib.sources 1> /dev/null -Enabled: yes -Types: deb -URIs: http://deb.debian.org/debian/ -Suites: ${VERSION_CODENAME} -Components: contrib -Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg -EOF - fi -fi - - if [[ -f '/usr/bin/gsettings' ]]; then gsettings \ set \ @@ -54,16 +40,7 @@ if [[ -f '/usr/bin/gsettings' ]]; then fi if [[ "${ID}" == 'debian' ]] || [[ "${ID}" == 'elementary' ]]; then - apt \ - update && \ - apt \ - install \ - --yes \ - mmdebstrap \ - gdisk \ - systemd-timesyncd \ - whois \ - zfsutils-linux + "${baseDir}/debian.sh" --live elif [[ "${ID}" == 'fedora' ]]; then if [[ "${VERSION_ID}" -lt '41' ]]; then dnf config-manager \