1500-reconfigure-APT 2.23 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 15 16 17 18 19 20 21 22 23 24 25
echo '

### Time-based snapshots

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

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

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

### Tagged snapshots

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

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

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

### Custom APT repository

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

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

92
echo "- configuring APT preferences"
93 94

echo '
95
### Custom APT repository
96 97 98

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

104 105 106 107 108 109
### Fix origin for backports

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

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