This commit is contained in:
Marc Beninca 2024-11-12 06:03:36 +01:00
parent 918090d9be
commit 084c92e50a
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F
3 changed files with 40 additions and 46 deletions

View file

@ -3,6 +3,30 @@ apt_clean() {
clean
}
apt_install_backports() {
apt_install_target "${DEBIAN_CODENAME}-backports" "${@}"
}
apt_install_release() {
apt_install_target "${DEBIAN_CODENAME}" "${@}"
}
apt_install_target() {
local target="${1}"
shift
local package
for package in "${@}"; do
log_info
log_info "${package}${target}"
apt-get \
install \
--assume-yes \
--target-release "${target}" \
"${package}"
apt_clean
done
}
apt_update() {
apt-get \
update
@ -12,4 +36,5 @@ apt_upgrade() {
apt-get \
upgrade \
--assume-yes
apt_clean
}

View file

@ -1,3 +1,8 @@
function debian_disable_frontend {
DEBIAN_CODENAME="$(
grep "VERSION_CODENAME" "/etc/os-release" |
cut --delimiter "=" --fields "2"
)"
debian_disable_frontend() {
export DEBIAN_FRONTEND='noninteractive'
}

View file

@ -1,7 +1,5 @@
rescue_configure() {
local hostname="${1}"
local release="bookworm"
local package
# apt / conf
printf "\
Acquire::AllowInsecureRepositories False;
@ -17,13 +15,13 @@ Dpkg::Progress True;
# apt / sources
printf "%s" "\
deb https://deb.debian.org/debian \
${release} main non-free-firmware contrib non-free
${DEBIAN_CODENAME} main non-free-firmware contrib non-free
deb https://deb.debian.org/debian \
${release}-backports main non-free-firmware contrib non-free
${DEBIAN_CODENAME}-backports main non-free-firmware contrib non-free
deb https://deb.debian.org/debian \
${release}-updates main non-free-firmware contrib non-free
${DEBIAN_CODENAME}-updates main non-free-firmware contrib non-free
deb https://deb.debian.org/debian-security \
${release}-security main non-free-firmware contrib non-free
${DEBIAN_CODENAME}-security main non-free-firmware contrib non-free
" >"/etc/apt/sources.list"
# bash / rc
main_link_bashrc
@ -42,41 +40,22 @@ fr_FR.UTF-8 UTF-8
# disable frontend
debian_disable_frontend
# install backports
set "tmux"
for package in "${@}"; do
echo
echo "${package}"
apt-get install --assume-yes \
--target-release "${release}-backports" \
"${package}"
apt_clean
done
apt_install_backports "tmux"
# install packages
set "apt-file" "mosh" "screen" "byobu"
for package in "${@}"; do
echo
echo "${package}"
apt-get install --assume-yes \
"${package}"
apt_clean
done
apt_install_release "apt-file" "mosh" "screen" "byobu"
# update catalog
apt_update
}
rescue_install() {
local package
local release="bookworm"
# update catalog
apt_update
# disable frontend
debian_disable_frontend
# upgrade packages
apt_upgrade
# clean cache
apt_clean
# install packages
set \
apt_install_release \
"man-db" \
"dmidecode" "efibootmgr" "lshw" "pciutils" "usbutils" \
"parted" "mdadm" "cryptsetup-bin" "lvm2" \
@ -84,26 +63,11 @@ rescue_install() {
"git" "micro" "nano" "python3" "rsync" "vim" \
"exa" "lf" "ncdu" "nnn" "ranger" "tree" \
"file" "htop" "iotop" "ipcalc" "libdigest-sha3-perl" "lsof"
for package in "${@}"; do
echo
echo "${package}"
apt-get install --assume-yes \
"${package}"
apt_clean
done
# install backports
set \
apt_install_backports \
"grub-pc-bin" \
\
"grub-efi-amd64-bin"
for package in "${@}"; do
echo
echo "${package}"
apt-get install --assume-yes \
--target-release "${release}-backports" \
"${package}"
apt_clean
done
}
rescue_upload() {