sh/shell/debian.sh

63 lines
1.2 KiB
Bash
Raw Normal View History

2024-11-12 05:03:36 +00:00
DEBIAN_CODENAME="$(
grep "VERSION_CODENAME" "/etc/os-release" |
cut --delimiter "=" --fields "2"
)"
2024-11-15 18:20:55 +00:00
apt_clean() {
apt-get \
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
}
2024-11-15 18:23:33 +00:00
apt_sources_write() {
printf "%s" "\
deb https://deb.debian.org/debian \
${DEBIAN_CODENAME} main non-free-firmware contrib non-free
deb https://deb.debian.org/debian \
${DEBIAN_CODENAME}-backports main non-free-firmware contrib non-free
deb https://deb.debian.org/debian \
${DEBIAN_CODENAME}-updates main non-free-firmware contrib non-free
deb https://deb.debian.org/debian-security \
${DEBIAN_CODENAME}-security main non-free-firmware contrib non-free
" >"/etc/apt/sources.list"
}
2024-11-15 18:20:55 +00:00
apt_update() {
apt-get \
update
}
apt_upgrade() {
apt-get \
upgrade \
--assume-yes
apt_clean
}
2024-11-12 05:03:36 +00:00
debian_disable_frontend() {
2024-11-12 08:31:24 +00:00
export DEBIAN_FRONTEND="noninteractive"
2023-05-14 09:48:35 +00:00
}