-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.sh
36 lines (28 loc) · 1.11 KB
/
build.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
#!/bin/sh
sudo apt install -y debhelper virtualenv python3-virtualenv python3-all python3-setuptools
virtualenv -p python3 venv
source venv/bin/activate
pip3 install stdeb
python3 setup.py --command-packages=stdeb.command sdist_dsc --with-python2=False \
--with-python3=True bdist_deb
VER=$(cat setup.py | grep "VERSION.*=" | awk -F '"' '{print $2}')
DEB=$(ls deb_dist | grep "python3-pisugar-wifi-config.*all.deb")
# Fix post install
rm -rf build
fakeroot sh -c "
set -e
mkdir -p build/old
dpkg-deb -R deb_dist/${DEB} build/old
mkdir -p build/old/lib/systemd/system
mkdir -p build/old/etc/default
cp -f debian/pisugar-wifi-config.service build/old/lib/systemd/system
cp -f debian/pisugar-wifi-config.default build/old/etc/default/pisugar-wifi-config
(cd build/old && md5sum lib/systemd/system/pisugar-wifi-config.service >> DEBIAN/md5sums)
(cd build/old && md5sum etc/default/pisugar-wifi-config >> DEBIAN/md5sums)
for s in config templates preinst postinst prerm postrm; do
cp -f debian/\$s build/old/DEBIAN/
chmod +x build/old/DEBIAN/\$s
done
dpkg-deb -b build/old build/${DEB}
"
echo "DONE!"