76 lines
1.7 kB
1
RWX_DEBIAN_CODENAME="$(
2
grep "VERSION_CODENAME" "/etc/os-release" |
3
cut --delimiter "=" --fields "2"
4
)"
5
6
rwx_apt_clean() {
7
apt-get \
8
clean
9
}
10
11
rwx_apt_conf_write() {
12
printf "\
13
Acquire::AllowInsecureRepositories False;
14
Acquire::AllowWeakRepositories False;
15
Acquire::AllowDowngradeToInsecureRepositories False;
16
Acquire::Check-Valid-Until True;
17
APT::Install-Recommends False;
18
APT::Install-Suggests False;
19
APT::Get::Show-Versions True;
20
Dir::Etc::SourceParts \"\";
21
Dpkg::Progress True;
22
" >"/etc/apt/apt.conf.d/apt.conf"
23
}
24
25
rwx_apt_install_backports() {
26
rwx_apt_install_target "${RWX_DEBIAN_CODENAME}-backports" "${@}"
27
}
28
29
rwx_apt_install_release() {
30
rwx_apt_install_target "${RWX_DEBIAN_CODENAME}" "${@}"
31
}
32
33
rwx_apt_install_target() {
34
local target="${1}"
35
shift
36
local package
37
for package in "${@}"; do
38
rwx_log "" \
39
"${package} ← ${target}"
40
apt-get \
41
install \
42
--assume-yes \
43
--target-release "${target}" \
44
"${package}"
45
rwx_apt_clean
46
done
47
}
48
49
rwx_apt_sources_write() {
50
printf "%s" "\
51
deb https://deb.debian.org/debian \
52
${RWX_DEBIAN_CODENAME} main non-free-firmware contrib non-free
53
deb https://deb.debian.org/debian \
54
${RWX_DEBIAN_CODENAME}-backports main non-free-firmware contrib non-free
55
deb https://deb.debian.org/debian \
56
${RWX_DEBIAN_CODENAME}-updates main non-free-firmware contrib non-free
57
deb https://deb.debian.org/debian-security \
58
${RWX_DEBIAN_CODENAME}-security main non-free-firmware contrib non-free
59
" >"/etc/apt/sources.list"
60
}
61
62
rwx_apt_update() {
63
apt-get \
64
update
65
}
66
67
rwx_apt_upgrade() {
68
apt-get \
69
upgrade \
70
--assume-yes
71
rwx_apt_clean
72
}
73
74
rwx_debian_frontend_disable() {
75
export DEBIAN_FRONTEND="noninteractive"
76
}
77