rwx/sh/debian.sh

77 lines
1.6 KiB
Bash
Raw Normal View History

2024-11-20 08:27:41 +00:00
SH_DEBIAN_CODENAME="$(
2024-11-12 05:03:36 +00:00
grep "VERSION_CODENAME" "/etc/os-release" |
cut --delimiter "=" --fields "2"
)"
2024-11-19 09:37:35 +00:00
sh_apt_clean() {
2024-11-15 18:20:55 +00:00
apt-get \
clean
}
2024-11-19 09:39:25 +00:00
sh_apt_conf_write() {
2024-11-15 18:24:48 +00:00
printf "\
Acquire::AllowInsecureRepositories False;
Acquire::AllowWeakRepositories False;
Acquire::AllowDowngradeToInsecureRepositories False;
Acquire::Check-Valid-Until True;
APT::Install-Recommends False;
APT::Install-Suggests False;
APT::Get::Show-Versions True;
Dir::Etc::SourceParts \"\";
Dpkg::Progress True;
" >"/etc/apt/apt.conf.d/apt.conf"
}
2024-11-19 09:46:30 +00:00
sh_apt_install_backports() {
2024-11-20 08:27:41 +00:00
sh_apt_install_target "${SH_DEBIAN_CODENAME}-backports" "${@}"
2024-11-15 18:20:55 +00:00
}
2024-11-19 09:45:49 +00:00
sh_apt_install_release() {
2024-11-20 08:27:41 +00:00
sh_apt_install_target "${SH_DEBIAN_CODENAME}" "${@}"
2024-11-15 18:20:55 +00:00
}
2024-11-19 09:41:16 +00:00
sh_apt_install_target() {
2024-11-15 18:20:55 +00:00
local target="${1}"
shift
local package
for package in "${@}"; do
2024-11-18 11:15:29 +00:00
sh_log_info
sh_log_info "${package}${target}"
2024-11-15 18:20:55 +00:00
apt-get \
install \
--assume-yes \
--target-release "${target}" \
"${package}"
2024-11-19 09:37:35 +00:00
sh_apt_clean
2024-11-15 18:20:55 +00:00
done
}
2024-11-19 09:36:35 +00:00
sh_apt_sources_write() {
2024-11-15 18:23:33 +00:00
printf "%s" "\
deb https://deb.debian.org/debian \
2024-11-20 08:27:41 +00:00
${SH_DEBIAN_CODENAME} main non-free-firmware contrib non-free
2024-11-15 18:23:33 +00:00
deb https://deb.debian.org/debian \
2024-11-20 08:27:41 +00:00
${SH_DEBIAN_CODENAME}-backports main non-free-firmware contrib non-free
2024-11-15 18:23:33 +00:00
deb https://deb.debian.org/debian \
2024-11-20 08:27:41 +00:00
${SH_DEBIAN_CODENAME}-updates main non-free-firmware contrib non-free
2024-11-15 18:23:33 +00:00
deb https://deb.debian.org/debian-security \
2024-11-20 08:27:41 +00:00
${SH_DEBIAN_CODENAME}-security main non-free-firmware contrib non-free
2024-11-15 18:23:33 +00:00
" >"/etc/apt/sources.list"
}
2024-11-19 09:33:56 +00:00
sh_apt_update() {
2024-11-15 18:20:55 +00:00
apt-get \
update
}
2024-11-19 09:25:22 +00:00
sh_apt_upgrade() {
2024-11-15 18:20:55 +00:00
apt-get \
upgrade \
--assume-yes
2024-11-19 09:37:35 +00:00
sh_apt_clean
2024-11-15 18:20:55 +00:00
}
2024-11-19 09:24:05 +00:00
sh_debian_frontend_disable() {
2024-11-12 08:31:24 +00:00
export DEBIAN_FRONTEND="noninteractive"
2023-05-14 09:48:35 +00:00
}