-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmake_deb.sh
executable file
·54 lines (39 loc) · 1.9 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
#!/bin/bash
# Requires: apt-get install libmysqlclient-dev libffi-dev python-dev libjpeg-dev
CUR_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
LAST_COMMIT_HASH=`git rev-parse HEAD`
rm -Rf debian/usr/
rm -Rf debian/etc/
mkdir -p debian/usr/share/openalpr-hotlist/
mkdir -p debian/etc/openalpr/
mkdir -p debian/etc/cron.d/
mkdir -p debian/usr/share/openalpr-hotlist/parsers
cp $CUR_DIR/hotlistimport.py debian/usr/share/openalpr-hotlist/
cp $CUR_DIR/print_alert_lists.py debian/usr/share/openalpr-hotlist/
cp $CUR_DIR/parsers/*.py debian/usr/share/openalpr-hotlist/parsers/
cp $CUR_DIR/config/hotlist.yaml.sample debian/etc/openalpr/hotlist.yaml.sample
cp $CUR_DIR/deploy/openalpr-hotlistimport.cron debian/etc/cron.d/openalpr-hotlist
# Copy GUI components
mkdir -p debian/usr/share/openalpr-hotlist/ui
mkdir -p debian/usr/share/openalpr-hotlist/utils
cp $CUR_DIR/gui.py debian/usr/share/openalpr-hotlist/
cp $CUR_DIR/gui_settings.py debian/usr/share/openalpr-hotlist/
cp $CUR_DIR/ui/*.py debian/usr/share/openalpr-hotlist/ui/
cp $CUR_DIR/utils/*.py debian/usr/share/openalpr-hotlist/utils/
cp $CUR_DIR/utils/logging.ini debian/usr/share/openalpr-hotlist/utils/
chmod 644 debian/etc/cron.d/openalpr-hotlist
# Insert the git hash into settings.py
echo "$LAST_COMMIT_HASH" > debian/usr/share/openalpr-hotlist/githash
VERSION=`dpkg-parsechangelog -ldebian/DEBIAN/changelog --show-field Version`
VERSION_WITHOUT_BUILD=`echo $VERSION | sed 's/\-.*$//'`
#Swap in a build number based on the current date/time.
if [ -z "$BUILD_NUMBER" ]; then
BUILD_NUMBER=`date "+%Y%m%d%H%M%S"`
fi
VER_WITH_BUILD="${VERSION_WITHOUT_BUILD}-${BUILD_NUMBER}"
sed -i "s/$VERSION/$VER_WITH_BUILD/" debian/DEBIAN/changelog
sed -i "s/^Version:.*/Version: $VER_WITH_BUILD/" debian/DEBIAN/control
fakeroot dpkg-deb --verbose --build debian || exit 1
DEB_FILE=openalpr-hotlist_${VER_WITH_BUILD}.deb
mkdir -p out/
mv debian.deb out/$DEB_FILE || exit 1