comparison deploy/linux/deploy-deb.sh @ 700:21e4df9865af

Some work on Linux packaging
author Chris Cannam
date Wed, 12 Dec 2018 10:16:11 +0000
parents
children a13d89b87c2c
comparison
equal deleted inserted replaced
699:646e48a0d3a5 700:21e4df9865af
1 #!/bin/bash
2 #
3 # Run this from the build root (with sudo, I think)
4
5 usage() {
6 echo
7 echo "Usage:"
8 echo
9 echo "$0 <version> <architecture>"
10 echo
11 echo "For example: $0 1.4cc1-1 amd64"
12 echo
13 exit 2
14 }
15
16 version="$1"
17 arch="$2"
18
19 if [ -z "$version" ] || [ -z "$arch" ]; then
20 usage
21 fi
22
23 set -eu
24
25 program=EasyMercurial
26 depdir=deploy/linux
27
28 targetdir="${program}_${version}_${arch}"
29
30 echo "Target dir is $targetdir"
31
32 if [ -d "$targetdir" ]; then
33 echo "Target directory exists, not overwriting"
34 exit
35 fi
36
37 mkdir "$targetdir"
38
39 mkdir "$targetdir/DEBIAN"
40
41 cp "$depdir"/control "$targetdir"/DEBIAN/
42
43 mkdir -p "$targetdir"/usr/bin "$targetdir"/usr/share/pixmaps "$targetdir"/usr/share/applications "$targetdir"/usr/share/doc/"$program"
44
45 cp "$program" "$targetdir"/usr/bin/
46
47 cp images/icon/scalable/easyhg-icon.svg "$targetdir"/usr/share/pixmaps/
48 cp images/icon/128/easyhg-icon.png "$targetdir"/usr/share/pixmaps/
49 cp deploy/linux/"$program".desktop "$targetdir"/usr/share/applications/
50 cp README.txt "$targetdir"/usr/share/doc/"$program"/
51
52 perl -i -p -e "s/Architecture: .*/Architecture: $arch/" "$targetdir"/DEBIAN/control
53
54 deps=`bash "$depdir"/debian-dependencies.sh "$program"`
55
56 perl -i -p -e "s/Depends: .*/$deps/" "$targetdir"/DEBIAN/control
57
58 control_ver=${version%-?}
59
60 perl -i -p -e "s/Version: .*/Version: $control_ver/" "$targetdir"/DEBIAN/control
61
62 bash "$depdir"/fix-lintian-bits.sh "$targetdir"
63
64 dpkg-deb --build "$targetdir" && lintian "$targetdir".deb
65