-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathmake_deb.sh
executable file
·114 lines (99 loc) · 3.34 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
#!/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
PRIVDIR=`ls -d privoxy*| xargs | sed "s/ .*//"`
FBOXDIR=freedombox-privoxy-${version}
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=`ls -d privoxy*| xargs | sed -e"s/ .*//" -e "s/-/_/"`.orig.tar.gz
FBOXORIG=freedombox-privoxy_`head -n 1 ${PRIVDIR}/debian/changelog | sed -e"s/.*(\([^)]*\)).*/\1/"`.orig.tar.gz
cp ${ORIG} ${FBOXORIG}
cd ${FBOXDIR}
dpatch apply-all
cd ../..
DEBDIR=`find Debian -maxdepth 1 -name "freedombox*" -type d`
#`ls -d Debian/freedombox-privoxy*| xargs | sed "s/ .*//"`
echo DEBDIR = ${DEBDIR}
}
add_patch() {
echo Adding patch $1
mkdir -p privoxy
sed -i -e's/${patchcount}_$1.dpatch//' ${DEBDIR}/debian/patches/series
DEST=${DEBDIR}/debian/patches/${patchcount}_$1.dpatch
diff -urNad ${DEBDIR}/$1 privoxy/$1 > ${DEST}
prepend "#! /bin/sh /usr/share/dpatch/dpatch-run\n## ${patchcount}_$1.dpatch by James Vasile <[email protected]>" ${DEST}
echo ${patchcount}_$1.dpatch >> ${DEBDIR}/debian/patches/series
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.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
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
}
## 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
update_changelog
update_control
update_rules
update_doc_base
cd Debian/${FBOXDIR};
dpatch apply-all
cp ../${PRIVDIR}/debian/init.d debian/init.d