1500-reconfigure-APT 2.49 KB
Newer Older
1
2
#!/bin/sh

3
4
echo "- configuring APT sources"

5
6
sed -i 's,^\(\#\?\s*deb\(-src\)\?\s\+\)http://,\1tor+http://,' \
           /etc/apt/sources.list /etc/apt/sources.list.d/*.list
7

8
9
10
sed -E -i 's,\s+non-free$,,' \
           /etc/apt/sources.list /etc/apt/sources.list.d/*.list

anonym's avatar
anonym committed
11
sed -E -i '/^deb(-src)?\s+\S+\s+\S+-proposed-updates\s+/d' \
12
13
           /etc/apt/sources.list /etc/apt/sources.list.d/*.list

14
# shellcheck disable=SC2016
15
16
17
18
19
20
21
22
23
24
25
26
echo '

### Time-based snapshots

s{
   ^
   (deb(?:-src)?\s+)
   tor[+]https?://time-based[.]snapshots[.]deb[.]tails[.]boum[.]org
   /debian
   /[0-9]{10} # serial
   /?
   (\s+)
27
}{$1tor+https://cdn-fastly.deb.debian.org/debian/$2}xms;
28
29
30
31
32
33
34
35
36

s{
   ^
   (deb(?:-src)?\s+)
   tor[+]https?://time-based[.]snapshots[.]deb[.]tails[.]boum[.]org
   /debian-security
   /[0-9]{10} # serial
   /?
   (\s+)
37
}{$1tor+https://cdn-fastly.deb.debian.org/debian-security/$2}xms;
38
39
40
41
42
43
44
45
46

s{
   ^
   (deb(?:-src)?\s+)
   tor[+]https?://time-based[.]snapshots[.]deb[.]tails[.]boum[.]org
   /torproject
   /[0-9]{10} # serial
   /?
   (\s+)
47
}{$1tor+http://apow7mjfryruh65chtdydfmqfpj5btws7nbocgtaovhvezgccyjazpqd.onion/torproject.org/$2}xms;
48
49
50
51
52
53
54
55
56
57
58

### Tagged snapshots

s{
   ^
   (deb(?:-src)?\s+)
   tor[+]https?://tagged[.]snapshots[.]deb[.]tails[.]boum[.]org
   /[0-9a-z.-]+ # tag
   /debian
   /?
   (\s+)
59
}{$1tor+https://cdn-fastly.deb.debian.org/debian/$2}xms;
60
61
62
63
64
65
66
67
68

s{
   ^
   (deb(?:-src)?\s+)
   tor[+]https?://tagged[.]snapshots[.]deb[.]tails[.]boum[.]org
   /[0-9a-z.-]+ # tag
   /debian-security
   /?
   (\s+)
69
}{$1tor+https://cdn-fastly.deb.debian.org/debian-security/$2}xms;
70
71
72
73
74
75
76
77
78

s{
   ^
   (deb(?:-src)?\s+)
   tor[+]https?://tagged[.]snapshots[.]deb[.]tails[.]boum[.]org
   /[0-9a-z.-]+ # tag
   /torproject
   /?
   (\s+)
79
}{$1tor+http://apow7mjfryruh65chtdydfmqfpj5btws7nbocgtaovhvezgccyjazpqd.onion/torproject.org/$2}xms;
80
81
82
83
84
85
86
87
88

### Custom APT repository

s{
   ^
   (deb(?:-src)?\s+)
   tor[+]https?://deb[.]tails[.]boum[.]org
   /?
   (\s+)
89
}{$1tor+http://umjqavufhoix3smyq6az2sx4istmuvsgmz4bq5u5x56rnayejoo6l2qd.onion/$2}xms;
90
91

' | perl -pi - /etc/apt/sources.list /etc/apt/sources.list.d/*.list
anonym's avatar
anonym committed
92

93
echo "- configuring APT preferences"
94

95
# shellcheck disable=SC2016
96
echo '
97
### Custom APT repository
98
99
100

s{
   ^
101
   (Pin:\s+origin\s+)
segfault's avatar
segfault committed
102
   deb[.]tails[.]boum[.]org
segfault's avatar
segfault committed
103
   $
104
}{$1umjqavufhoix3smyq6az2sx4istmuvsgmz4bq5u5x56rnayejoo6l2qd.onion}xms;
105

106
107
108
109
110
111
### Fix origin for backports

s{
   ^
   (Pin:\s+release\s+)
   o=Debian
112
   (,[an]=buster-backports)
113
114
   $
}{$1o=Debian Backports$2}xms;
115
116
' | perl -pi - /etc/apt/preferences

anonym's avatar
anonym committed
117
find /etc/apt/sources.list* -size 0 -delete