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@725
|
26 kdiff=easyhg-kdiff3
|
Chris@725
|
27 merge=easyhg-merge.sh
|
Chris@725
|
28 extdiff=easyhg-extdiff.sh
|
Chris@725
|
29
|
Chris@725
|
30 programs="$program $kdiff $merge $extdiff"
|
Chris@725
|
31
|
Chris@711
|
32 package=easymercurial
|
Chris@700
|
33 depdir=deploy/linux
|
Chris@700
|
34
|
Chris@711
|
35 targetdir="${package}_${version}_${arch}"
|
Chris@700
|
36
|
Chris@700
|
37 echo "Target dir is $targetdir"
|
Chris@700
|
38
|
Chris@700
|
39 if [ -d "$targetdir" ]; then
|
Chris@700
|
40 echo "Target directory exists, not overwriting"
|
Chris@700
|
41 exit
|
Chris@700
|
42 fi
|
Chris@700
|
43
|
Chris@725
|
44 for p in $programs; do
|
Chris@725
|
45 if [ ! -x "$p" ]; then
|
Chris@725
|
46 echo "Failed to find executable ./$p, please build and check"
|
Chris@725
|
47 exit 2
|
Chris@725
|
48 fi
|
Chris@725
|
49 done
|
Chris@725
|
50
|
Chris@700
|
51 mkdir "$targetdir"
|
Chris@700
|
52
|
Chris@700
|
53 mkdir "$targetdir/DEBIAN"
|
Chris@700
|
54
|
Chris@700
|
55 cp "$depdir"/control "$targetdir"/DEBIAN/
|
Chris@700
|
56
|
Chris@711
|
57 mkdir -p "$targetdir"/usr/bin "$targetdir"/usr/share/pixmaps "$targetdir"/usr/share/applications "$targetdir"/usr/share/doc/"$package"
|
Chris@700
|
58
|
Chris@725
|
59 cp $programs "$targetdir"/usr/bin/
|
Chris@700
|
60
|
Chris@700
|
61 cp images/icon/scalable/easyhg-icon.svg "$targetdir"/usr/share/pixmaps/
|
Chris@700
|
62 cp images/icon/128/easyhg-icon.png "$targetdir"/usr/share/pixmaps/
|
Chris@711
|
63 cp deploy/linux/"$program".desktop "$targetdir"/usr/share/applications/"$package".desktop
|
Chris@711
|
64 cp README.txt "$targetdir"/usr/share/doc/"$package"/
|
Chris@711
|
65 cat > "$targetdir"/usr/share/doc/"$package"/copyright <<EOF
|
Chris@711
|
66 EasyMercurial is free software; you can redistribute it and/or modify
|
Chris@711
|
67 it under the terms of the GNU General Public License as published by
|
Chris@711
|
68 the Free Software Foundation; either version 2 of the License, or (at
|
Chris@711
|
69 your option) any later version. See the file /usr/share/common-licenses/GPL-2
|
Chris@711
|
70 for more information.
|
Chris@711
|
71 EOF
|
Chris@711
|
72 touch "$targetdir"/usr/share/doc/"$package"/changelog.Debian
|
Chris@711
|
73 gzip -9 "$targetdir"/usr/share/doc/"$package"/changelog.Debian
|
Chris@700
|
74
|
Chris@700
|
75 perl -i -p -e "s/Architecture: .*/Architecture: $arch/" "$targetdir"/DEBIAN/control
|
Chris@700
|
76
|
Chris@700
|
77 deps=`bash "$depdir"/debian-dependencies.sh "$program"`
|
Chris@700
|
78
|
Chris@700
|
79 perl -i -p -e "s/Depends: .*/$deps/" "$targetdir"/DEBIAN/control
|
Chris@700
|
80
|
Chris@700
|
81 control_ver=${version%-?}
|
Chris@700
|
82
|
Chris@700
|
83 perl -i -p -e "s/Version: .*/Version: $control_ver/" "$targetdir"/DEBIAN/control
|
Chris@700
|
84
|
Chris@700
|
85 bash "$depdir"/fix-lintian-bits.sh "$targetdir"
|
Chris@700
|
86
|
Chris@713
|
87 echo "Finished constructing control file, this is the result:" 1>&2
|
Chris@713
|
88 cat "$targetdir"/DEBIAN/control 1>&2
|
Chris@713
|
89 echo 1>&2
|
Chris@713
|
90
|
Chris@700
|
91 dpkg-deb --build "$targetdir" && lintian "$targetdir".deb
|
Chris@700
|
92
|