Files
ZFSBootMenu-Root-Install/base-debian.sh

79 lines
2.2 KiB
Bash
Executable File

#!/bin/bash
set -euo pipefail
BASEDIR="$(dirname "${0}" | sed "s|^\.|${PWD}|")"
source \
/etc/os-release
source \
"${BASEDIR}/system.conf"
if [[ "${1}" == '-1' ]]; then
mmdebstrap \
--skip=check/empty \
--components=main,non-free-firmware,contrib \
--mode=root \
--format=directory \
--include=console-setup \
--include=cryptsetup \
--include=curl \
--include=dosfstools \
--include=dpkg-dev \
--include=efibootmgr \
--include=ethtool \
--include=firmware-{ast,atheros,bnx{2,2x},brcm80211,iwlwifi,libertas,linux,realtek,zd1211} \
--include=flatpak \
--include=keyboard-configuration \
--include=linux-{headers,image}-amd64 \
--include=locales \
--include=nano \
--include=network-manager \
--include=openssh-{client,server} \
--include=popularity-contest \
--include=printer-driver-all \
--include=systemd-timesyncd \
--include=tasksel \
--include=zstd \
"${VERSION_CODENAME}" \
/mnt
elif [[ "${1}" == '-2' ]]; then
NETWORK_INTERFACE=($(ip -br addr show | sed 's| .*$||g' | grep -v '^lo' | grep -v 'tailscale' | grep -v '^wg'))
shopt -s extglob
for ((i = 0; i < ${#NETWORK_INTERFACE[@]}; i++)); do
cat << EOF | tee /mnt/etc/network/interfaces.d/${NETWORK_INTERFACE[$i]} &> /dev/null
allow-hotplug ${NETWORK_INTERFACE[$i]}
iface ${NETWORK_INTERFACE[$i]} inet dhcp
EOF
done
elif [[ "${1}" == '-3' ]]; then
cat << EOF | tee /mnt/etc/apt/sources.list.d/${VERSION_CODENAME}.sources &> /dev/null
# ${VERSION_CODENAME^}
Enabled: yes
Types: deb deb-src
URIs: http://deb.debian.org/debian/
Suites: ${VERSION_CODENAME}
Components: main non-free-firmware contrib
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
# ${VERSION_CODENAME^} Security
Enabled: yes
Types: deb deb-src
URIs: http://deb.debian.org/debian-security/
Suites: ${VERSION_CODENAME}-security
Components: main non-free-firmware contrib
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
# ${VERSION_CODENAME^} Updates
Enabled: yes
Types: deb deb-src
URIs: http://deb.debian.org/debian/
Suites: ${VERSION_CODENAME}-updates
Components: main non-free-firmware contrib
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
EOF
rm /mnt/etc/apt/sources.list
fi