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 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_update() {
apt-get \ apt-get \
update update
@ -12,4 +36,5 @@ apt_upgrade() {
apt-get \ apt-get \
upgrade \ upgrade \
--assume-yes --assume-yes
apt_clean
} }

View file

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