-
Notifications
You must be signed in to change notification settings - Fork 2
/
apt-sources-gen.sh
executable file
·100 lines (93 loc) · 3.44 KB
/
apt-sources-gen.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/bin/bash
#
# Generate debian sources.list
# You need all these keys for the drivers to work properly
KEYS="contrib non-free non-free-firmware"
read -p "Start mirror benchmark (y)? " bench
if [ "$bench" = "y" ]; then
sudo apt -y install netselect-apt
sudo netselect-apt
fi
read -p "Mirror URL (enter=http://deb.debian.org/debian/): " mirror
if [ "$mirror" = "" ]; then
mirror="http://deb.debian.org/debian/"
fi
# create backup
sudo cp -rf /etc/apt/sources.list /etc/apt/sources.list.bkp
echo Backup created: /etc/apt/sources.list.bkp
read -p "press enter to continue ..." p
echo 1. stable \(bookworm - main only\)
echo 2. stable \(bookworm - $KEYS\)
echo 3. stable-proposed \(bookworm - $KEYS\)
echo 4. stable-proposed-backports \(bookworm - $KEYS\)
echo 5. testing \(trixie - lazy security - $KEYS\)
echo 6. unstable \(sid - no security - $KEYS\)
read -p "Branch: " branch
echo
if [ "$branch" -eq 1 ]; then
cat <<EOF | sudo tee /etc/apt/sources.list
deb $mirror stable main
deb-src $mirror stable main
deb $mirror stable-updates main
deb-src $mirror stable-updates main
deb http://security.debian.org/debian-security/ stable-security main
deb-src http://security.debian.org/debian-security/ stable-security main
EOF
echo;echo saved to /etc/apt/sources.list
elif [ "$branch" -eq 2 ]; then
cat <<EOF | sudo tee /etc/apt/sources.list
deb $mirror stable main $KEYS
deb-src $mirror stable main $KEYS
deb $mirror stable-updates main $KEYS
deb-src $mirror stable-updates main $KEYS
deb http://security.debian.org/debian-security/ stable-security main $KEYS
deb-src http://security.debian.org/debian-security/ stable-security main $KEYS
EOF
echo;echo saved to /etc/apt/sources.list
elif [ "$branch" -eq 3 ]; then
cat <<EOF | sudo tee /etc/apt/sources.list
deb $mirror stable main $KEYS
deb-src $mirror stable main $KEYS
deb $mirror stable-updates main $KEYS
deb-src $mirror stable-updates main $KEYS
deb $mirror bookworm-proposed-updates main $KEYS
deb-src $mirror bookworm-proposed-updates main $KEYS
deb http://security.debian.org/debian-security/ stable-security main $KEYS
deb-src http://security.debian.org/debian-security/ stable-security main $KEYS
EOF
echo;echo saved to /etc/apt/sources.list
elif [ "$branch" -eq 4 ]; then
cat <<EOF | sudo tee /etc/apt/sources.list
deb $mirror stable main $KEYS
deb-src $mirror stable main $KEYS
deb $mirror stable-updates main $KEYS
deb-src $mirror stable-updates main $KEYS
deb $mirror bookworm-proposed-updates main $KEYS
deb-src $mirror bookworm-proposed-updates main $KEYS
deb $mirror bookworm-backports main $KEYS
deb-src $mirror bookworm-backports main $KEYS
deb http://security.debian.org/debian-security/ stable-security main $KEYS
deb-src http://security.debian.org/debian-security/ stable-security main $KEYS
EOF
echo;echo saved to /etc/apt/sources.list
elif [ "$branch" -eq 5 ]; then
cat <<EOF | sudo tee /etc/apt/sources.list
deb $mirror testing main $KEYS
deb-src $mirror testing main $KEYS
deb $mirror testing-updates main $KEYS
deb-src $mirror testing-updates main $KEYS
deb http://security.debian.org/debian-security/ testing-security main $KEYS
deb-src http://security.debian.org/debian-security/ testing-security main $KEYS
EOF
echo;echo saved to /etc/apt/sources.list
elif [ "$branch" -eq 6 ]; then
cat <<EOF | sudo tee /etc/apt/sources.list
deb $mirror unstable main $KEYS
deb-src $mirror unstable main $KEYS
EOF
echo;echo saved to /etc/apt/sources.list
fi
read -p "run 'sudo apt update' (y)? " up
if [ "$up" = "y" ]; then
sudo apt update
fi