-
Notifications
You must be signed in to change notification settings - Fork 0
/
make_deb.sh
executable file
·137 lines (120 loc) · 3.98 KB
/
make_deb.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#!/bin/bash
# Get version of deb we want to make
version=`cat VERSION`
patchcount=90
prepend() {
echo -e "$1"|cat - $2 > /tmp/out && mv /tmp/out $2
}
dir_setup() {
## Copy privoxy dir, set dir aliases and apply upstream dpatch patches
fakeversion=${version%-*}
origversion=${fakeversion%-*}
PRIVDIR=$PWD/privoxy-${origversion}
FBOXDIR=freedombox-privoxy-${fakeversion}
echo PRIVDIR = ${PRIVDIR}
echo FBOXDIR = ${FBOXDIR}
if [ -z ${PRIVDIR} ]; then
pwd
echo PRIVDIR is blank! Do you have a valid deb-src line in /etc/apt/sources?
exit
fi
if [ -z ${FBOXDIR} ]; then
pwd
echo FBOXDIR is blank!
exit
fi
rm -rf ${FBOXDIR}
cp -r ${PRIVDIR} ${FBOXDIR}
ORIG=privoxy_${origversion}.orig.tar.gz
FBOXORIG=freedombox-privoxy_${fakeversion}.orig.tar.gz
cp ${ORIG} ${FBOXORIG}
cd ${FBOXDIR}
QUILT_PATCHES=debian/patches quilt pop -a
sed -i -e '/^9/d' debian/patches/series
QUILT_PATCHES=debian/patches quilt push -a
cd ../..
DEBDIR=$PWD/Debian/freedombox-privoxy-${fakeversion}
echo DEBDIR = ${DEBDIR}
}
add_patch() {
echo Adding patch $1
mkdir -p privoxy
DEST=${DEBDIR}/debian/patches/${patchcount}_$1.patch
echo "${patchcount}_$1.patch" >> ${DEBDIR}/debian/patches/series
diff -urNad ${DEBDIR}/$1 privoxy/$1 > ${DEST}
patchcount=`expr ${patchcount} + 1`
}
update_control() {
echo Updating control
## update control file
cp privoxy/debian/control ${DEBDIR}/debian/control
}
update_changelog() {
echo Updating changelog
cp changelog changelog.debian
cat ${DEBDIR}/debian/changelog >> changelog.debian
mv changelog.debian ${DEBDIR}/debian/changelog
}
update_rules() {
echo Updating rules
## Update rules file
pushd ${DEBDIR}/debian
sed -i -e"s/^\(DEBDIR.*\)privoxy/\1freedombox-privoxy/" rules
sed -i -e"s/\(cd.*DEBDIR.*\)privoxy/\1freedombox-privoxy/" rules
sed -i -e"s/dh_installinit/dh_installinit --name=privoxy/" rules
mv init.d freedombox-privoxy.init
sed -i '/install -m.*trust/i \\tinstall -m 0644 https_everywhere.action $(DEBDIR)/etc/privoxy/https_everywhere.action' rules
sed -i '/install -m.*trust/i \\tinstall -m 0644 easyprivacy.action $(DEBDIR)/etc/privoxy/easyprivacy.action' rules
sed -i '/install -m.*trust/i \\tinstall -m 0644 easylist.action $(DEBDIR)/etc/privoxy/easylist.action' rules
sed -i '/install -m.*trust/i \\tinstall -m 0755 abp_import.py $(DEBDIR)/usr/share/freedombox-privoxy/abp_import.py' rules
sed -i '/install -m.*trust/i \\tinstall -m 0755 https_everywhere_import.py $(DEBDIR)/usr/share/freedombox-privoxy/https_everywhere_import.py' rules
sed -i '/install -m.*trust/i \\tinstall -m 0755 rules_update.sh $(DEBDIR)/usr/share/freedombox-privoxy/rules_update.sh' rules
popd
#sed -i -e"s/\(cd.*DEBDIR.*\)privoxy/\1; ln -s freedombox-privoxy privoxy)\n\t(\1freedombox-privoxy/" rules
}
update_doc_base() {
echo Updating doc_base
## update dirs in doc-base
pushd ${DEBDIR}/debian
sed -i -e"s/\/privoxy/\/freedombox-privoxy/" doc-base.*
popd
}
update_dirs() {
echo Updating dirs
## update dirs
pushd ${DEBDIR}/debian
echo "usr/share/freedombox-privoxy" >> dirs
popd
}
update_cron() {
echo Updating cron script
## update cron script
cp privoxy/freedombox-privoxy.cron.daily ${DEBDIR}/debian/freedombox-privoxy.cron.daily
}
## Make working dir
mkdir -p Debian
cd Debian
## Install source package
apt-get source privoxy
echo You might need to \"apt-get build-dep privoxy\" as root
dir_setup
add_patch config
add_patch match-all.action
add_patch default.action
add_patch default.filter
add_patch easyprivacy.action
add_patch easylist.action
add_patch https_everywhere.action
add_patch filters.c
add_patch abp_import.py
add_patch https_everywhere_import.py
add_patch rules_update.sh
update_changelog
update_control
update_rules
update_doc_base
update_dirs
update_cron
cd Debian/${FBOXDIR};
QUILT_PATCHES=debian/patches quilt push -a
cp ${PRIVDIR}/debian/init.d debian/init.d