rwx/sh/debian.sh

77 lines
1.6 KiB
Bash
Raw Normal View History

2024-11-29 18:04:20 +00:00
RWX_DEBIAN_CODENAME="$(
2024-11-12 05:03:36 +00:00
grep "VERSION_CODENAME" "/etc/os-release" |
cut --delimiter "=" --fields "2"
)"
2024-11-29 18:04:20 +00:00
rwx_apt_clean() {
2024-11-15 18:20:55 +00:00
apt-get \
clean
}
2024-11-29 18:04:20 +00:00
rwx_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-29 18:04:20 +00:00
rwx_apt_install_backports() {
rwx_apt_install_target "${RWX_DEBIAN_CODENAME}-backports" "${@}"
2024-11-15 18:20:55 +00:00
}
2024-11-29 18:04:20 +00:00
rwx_apt_install_release() {
rwx_apt_install_target "${RWX_DEBIAN_CODENAME}" "${@}"
2024-11-15 18:20:55 +00:00
}
2024-11-29 18:04:20 +00:00
rwx_apt_install_target() {
2024-11-15 18:20:55 +00:00
local target="${1}"
shift
local package
for package in "${@}"; do
2024-11-29 18:04:20 +00:00
rwx_log "" \
"${package}${target}"
2024-11-15 18:20:55 +00:00
apt-get \
install \
--assume-yes \
--target-release "${target}" \
"${package}"
2024-11-29 18:04:20 +00:00
rwx_apt_clean
2024-11-15 18:20:55 +00:00
done
}
2024-11-29 18:04:20 +00:00
rwx_apt_sources_write() {
2024-11-15 18:23:33 +00:00
printf "%s" "\
deb https://deb.debian.org/debian \
2024-11-29 18:04:20 +00:00
${RWX_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-29 18:04:20 +00:00
${RWX_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-29 18:04:20 +00:00
${RWX_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-29 18:04:20 +00:00
${RWX_DEBIAN_CODENAME}-security main non-free-firmware contrib non-free
2024-11-15 18:23:33 +00:00
" >"/etc/apt/sources.list"
}
2024-11-29 18:04:20 +00:00
rwx_apt_update() {
2024-11-15 18:20:55 +00:00
apt-get \
update
}
2024-11-29 18:04:20 +00:00
rwx_apt_upgrade() {
2024-11-15 18:20:55 +00:00
apt-get \
upgrade \
--assume-yes
2024-11-29 18:04:20 +00:00
rwx_apt_clean
2024-11-15 18:20:55 +00:00
}
2024-11-29 18:04:20 +00:00
rwx_debian_frontend_disable() {
2024-11-12 08:31:24 +00:00
export DEBIAN_FRONTEND="noninteractive"
2023-05-14 09:48:35 +00:00
}