]> git.donarmstrong.com Git - deb_pkgs/autorandr.git/blob - contrib/packaging/debian/make_deb.sh
Add xdg autostart config so that configuration will be applied on login.
[deb_pkgs/autorandr.git] / contrib / packaging / debian / make_deb.sh
1 #!/bin/sh
2 #
3
4 # Determine version
5 if git rev-parse --git-dir >/dev/null 2>&1; then
6         V="$(git describe --tags 2>/dev/null)"
7         if [ "$?" -ne 0 ]; then
8                 V=0.1
9         fi
10 else
11         V=0.1
12 fi
13
14 # Create/determine working directory
15 P="`dirname $(readlink -f "$0")`"
16 LD="autorandr-$V"
17 D="$P/$LD"
18 O="`pwd`/$LD.deb"
19
20 if [ -d "$D" ]; then
21         echo "Directory $D does already exist. Aborting.."
22         exit 1
23 fi
24
25 # Error handling: On error, abort and clear $D
26 _cleanup() {
27         rm -rf "$D"
28 }
29 trap _cleanup EXIT
30 set -e
31
32 mkdir $D
33
34 # Debian(ish) specific part
35 make -C "$P/../../../" \
36         DESTDIR="$D" \
37         TARGETS="autorandr bash_completion autostart_config pmutils systemd udev" \
38         BASH_COMPLETION_DIR=/usr/share/bash-completion/completions \
39         SYSTEMD_UNIT_DIR=/lib/systemd/system \
40         PM_UTILS_DIR=/usr/lib/pm-utils/sleep.d \
41         UDEV_RULES_DIR=/lib/udev/rules.d/ \
42         install
43
44 SIZE=$(du -s $D | awk '{print $1}')
45
46 cp -r "$P/debian" "$D/DEBIAN"
47 [ -d "$D/etc" ] && (cd $D; find etc -type f) > "$D/DEBIAN/conffiles"
48 sed -i -re "s#Version:.+#Version: $V#" "$D/DEBIAN/control"
49 echo "Installed-Size: $SIZE" >> "$D/DEBIAN/control"
50 fakeroot dpkg-deb -b "$D" "$O"