Chris@700
|
1 #!/bin/bash
|
Chris@700
|
2 #
|
Chris@700
|
3 # Run this from the build root (with sudo, I think)
|
Chris@700
|
4
|
Chris@700
|
5 usage() {
|
Chris@700
|
6 echo
|
Chris@700
|
7 echo "Usage:"
|
Chris@700
|
8 echo
|
Chris@700
|
9 echo "$0 <version> <architecture>"
|
Chris@700
|
10 echo
|
Chris@700
|
11 echo "For example: $0 1.4cc1-1 amd64"
|
Chris@700
|
12 echo
|
Chris@700
|
13 exit 2
|
Chris@700
|
14 }
|
Chris@700
|
15
|
Chris@700
|
16 version="$1"
|
Chris@700
|
17 arch="$2"
|
Chris@700
|
18
|
Chris@700
|
19 if [ -z "$version" ] || [ -z "$arch" ]; then
|
Chris@700
|
20 usage
|
Chris@700
|
21 fi
|
Chris@700
|
22
|
Chris@700
|
23 set -eu
|
Chris@700
|
24
|
Chris@700
|
25 program=EasyMercurial
|
Chris@711
|
26 package=easymercurial
|
Chris@700
|
27 depdir=deploy/linux
|
Chris@700
|
28
|
Chris@711
|
29 targetdir="${package}_${version}_${arch}"
|
Chris@700
|
30
|
Chris@700
|
31 echo "Target dir is $targetdir"
|
Chris@700
|
32
|
Chris@700
|
33 if [ -d "$targetdir" ]; then
|
Chris@700
|
34 echo "Target directory exists, not overwriting"
|
Chris@700
|
35 exit
|
Chris@700
|
36 fi
|
Chris@700
|
37
|
Chris@700
|
38 mkdir "$targetdir"
|
Chris@700
|
39
|
Chris@700
|
40 mkdir "$targetdir/DEBIAN"
|
Chris@700
|
41
|
Chris@700
|
42 cp "$depdir"/control "$targetdir"/DEBIAN/
|
Chris@700
|
43
|
Chris@711
|
44 mkdir -p "$targetdir"/usr/bin "$targetdir"/usr/share/pixmaps "$targetdir"/usr/share/applications "$targetdir"/usr/share/doc/"$package"
|
Chris@700
|
45
|
Chris@700
|
46 cp "$program" "$targetdir"/usr/bin/
|
Chris@700
|
47
|
Chris@700
|
48 cp images/icon/scalable/easyhg-icon.svg "$targetdir"/usr/share/pixmaps/
|
Chris@700
|
49 cp images/icon/128/easyhg-icon.png "$targetdir"/usr/share/pixmaps/
|
Chris@711
|
50 cp deploy/linux/"$program".desktop "$targetdir"/usr/share/applications/"$package".desktop
|
Chris@711
|
51 cp README.txt "$targetdir"/usr/share/doc/"$package"/
|
Chris@711
|
52 cat > "$targetdir"/usr/share/doc/"$package"/copyright <<EOF
|
Chris@711
|
53 EasyMercurial is free software; you can redistribute it and/or modify
|
Chris@711
|
54 it under the terms of the GNU General Public License as published by
|
Chris@711
|
55 the Free Software Foundation; either version 2 of the License, or (at
|
Chris@711
|
56 your option) any later version. See the file /usr/share/common-licenses/GPL-2
|
Chris@711
|
57 for more information.
|
Chris@711
|
58 EOF
|
Chris@711
|
59 touch "$targetdir"/usr/share/doc/"$package"/changelog.Debian
|
Chris@711
|
60 gzip -9 "$targetdir"/usr/share/doc/"$package"/changelog.Debian
|
Chris@700
|
61
|
Chris@700
|
62 perl -i -p -e "s/Architecture: .*/Architecture: $arch/" "$targetdir"/DEBIAN/control
|
Chris@700
|
63
|
Chris@700
|
64 deps=`bash "$depdir"/debian-dependencies.sh "$program"`
|
Chris@700
|
65
|
Chris@700
|
66 perl -i -p -e "s/Depends: .*/$deps/" "$targetdir"/DEBIAN/control
|
Chris@700
|
67
|
Chris@700
|
68 control_ver=${version%-?}
|
Chris@700
|
69
|
Chris@700
|
70 perl -i -p -e "s/Version: .*/Version: $control_ver/" "$targetdir"/DEBIAN/control
|
Chris@700
|
71
|
Chris@700
|
72 bash "$depdir"/fix-lintian-bits.sh "$targetdir"
|
Chris@700
|
73
|
Chris@700
|
74 dpkg-deb --build "$targetdir" && lintian "$targetdir".deb
|
Chris@700
|
75
|