Skip to content

Commit 2e7e3be

Browse files
committed
Refactor build script following work done on GlobaLeaks
1 parent 7ffbfdf commit 2e7e3be

File tree

1 file changed

+51
-14
lines changed

1 file changed

+51
-14
lines changed

scripts/build.sh

Lines changed: 51 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,27 +33,64 @@ while getopts "d:n:th" opt; do
3333
esac
3434
done
3535

36-
if [ "$DISTRIBUTION" != "precise" ] &&
36+
if [ "$DISTRIBUTION" != "all" ] &&
37+
[ "$DISTRIBUTION" != "precise" ] &&
3738
[ "$DISTRIBUTION" != "trusty" ] &&
3839
[ "$DISTRIBUTION" != "wheezy" ] &&
3940
[ "$DISTRIBUTION" != "jessie" ]; then
40-
usage
41-
exit 1
41+
usage
42+
exit 1
4243
fi
4344

44-
echo "Packaging Tor2web for:" $DISTRIBUTION
45+
if [ "$DISTRIBUTION" == "all" ]; then
46+
TARGETS="precise trusty wheezy jessie"
47+
else
48+
TARGETS=$DISTRIBUTION
49+
fi
4550

46-
[ -d T2WRelease ] && rm -rf T2WRelease
51+
# Preliminary Requirements Check
52+
ERR=0
53+
echo "Checking preliminary Tor2web Build requirements"
54+
for REQ in git debuild
55+
do
56+
if which $REQ >/dev/null; then
57+
echo " + $REQ requirement meet"
58+
else
59+
ERR=$(($ERR+1))
60+
echo " - $REQ requirement not meet"
61+
fi
62+
done
4763

48-
mkdir T2WRelease
49-
cd T2WRelease
50-
git clone [email protected]:globaleaks/Tor2web.git
64+
if [ $ERR -ne 0 ]; then
65+
echo "Error: Found ${ERR} unmet requirements"
66+
echo "Information on how to setup tor2web development environment at: https://github.com/globaleaks/Tor2web/wiki/setting-up-globaleaks-development-environment"
67+
exit 1
68+
fi
69+
70+
BUILDSRC="T2WRelease"
71+
[ -d $BUILDSRC ] && rm -rf $BUILDSRC
72+
mkdir $BUILDSRC && cd $BUILDSRC
73+
git clone https://github.com/globaleaks/Tor2web.git
5174
cd Tor2web
5275
git checkout $TAG
53-
sed -i "s/stable; urgency=/$DISTRIBUTION; urgency=/g" debian/changelog
76+
cd ../../
5477

55-
if [ $NOSIGN -eq 1 ]; then
56-
debuild -i -us -uc -b
57-
else
58-
debuild
59-
fi
78+
for TARGET in $TARGETS; do
79+
echo "Packaging Tor2web for:" $TARGET
80+
81+
BUILDDIR="T2WRelease-$TARGET"
82+
83+
[ -d $BUILDDIR ] && rm -rf $BUILDDIR
84+
85+
cp -r $BUILDSRC $BUILDDIR
86+
cd $BUILDDIR/Tor2web
87+
sed -i "s/stable; urgency=/$TARGET; urgency=/g" debian/changelog
88+
89+
if [ $NOSIGN -eq 1 ]; then
90+
debuild -i -us -uc -b
91+
else
92+
debuild
93+
fi
94+
95+
cd ../../
96+
done

0 commit comments

Comments
 (0)