forked from Vladimir-csp/uwsm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-deb.sh
executable file
·61 lines (47 loc) · 1.48 KB
/
build-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
#!/bin/sh
# Updates debian/changelog with actual version from git
# Installs build tools (devscripts)
# Generates and installs uwsm-build-dep metapackage
# Builds package
# Installs package if -i|--install argument is given
set -e
cd "$(dirname "$0")"
. ./version.sh
DEBVERSION=${VERSION}-1~local0
IFS='()' read -r _ DCHVERSION _ < debian/changelog
if [ "$DEBVERSION" != "$DCHVERSION" ]; then
echo "Generating debian/changelog"
cat <<- EOF > debian/changelog
uwsm ($DEBVERSION) UNRELEASED; urgency=medium
* Upstream build.
-- Vladimir-csp <[email protected]> $(date "+%a, %d %b %Y %T %z")
EOF
else
echo "debian/changelog already has correct version"
fi
case "$(dpkg-query -Wf '${db:Status-Abbrev}' devscripts)" in
ii*) echo "devscripts already installed" ;;
*)
echo "Installing devscripts"
sudo apt-get install devscripts
;;
esac
case "$(dpkg-query -Wf '${db:Status-Abbrev};${source:Version}' uwsm-build-deps)" in
"ii"*";$DEBVERSION") echo "uwsm-build-deps metapackage already installed" ;;
*)
if [ ! -f "uwsm-build-deps_${DEBVERSION}_all.deb" ]; then
echo "Creating uwsm-build-deps metapackage"
mk-build-deps
fi
echo "Installing uwsm-build-deps_${DEBVERSION}_all.deb"
sudo apt-get install "./uwsm-build-deps_${DEBVERSION}_all.deb"
;;
esac
echo "Building"
dpkg-buildpackage -b -tc --no-sign
case "$1" in
-i | --install)
echo "Installing uwsm_${DEBVERSION}_all.deb"
sudo apt-get install --reinstall "../uwsm_${DEBVERSION}_all.deb"
;;
esac