Chris@701
|
1 #!/bin/bash
|
Chris@701
|
2 #
|
Chris@701
|
3 # Docker required
|
Chris@701
|
4
|
Chris@701
|
5 set -eu
|
Chris@701
|
6
|
Chris@701
|
7 current=$(hg id | awk '{ print $1; }')
|
Chris@701
|
8
|
Chris@701
|
9 case "$current" in
|
Chris@701
|
10 *+) echo "ERROR: Current working copy has been modified - unmodified copy required so we know we can check it out separately and obtain the same contents"; exit 2;;
|
Chris@701
|
11 *);;
|
Chris@701
|
12 esac
|
Chris@701
|
13
|
Chris@705
|
14 if [ ! -x ./appimagetool-x86_64.AppImage ]; then
|
Chris@705
|
15 echo "Failed to find executable ./appimagetool-x86_64.AppImage, please provide that first"
|
Chris@705
|
16 exit 2
|
Chris@705
|
17 fi
|
Chris@705
|
18
|
Chris@701
|
19 echo
|
Chris@701
|
20 echo "Building appimage from revision $current..."
|
Chris@701
|
21
|
Chris@701
|
22 dockerdir=deploy/linux/docker
|
Chris@701
|
23
|
Chris@701
|
24 cat "$dockerdir"/Dockerfile_appimage.in | \
|
Chris@701
|
25 perl -p -e "s/\[\[REVISION\]\]/$current/g" > \
|
Chris@701
|
26 "$dockerdir"/Dockerfile_appimage.gen
|
Chris@701
|
27
|
Chris@701
|
28 cat "$dockerdir"/Dockerfile_test_appimage.in | \
|
Chris@701
|
29 perl -p -e "s/\[\[REVISION\]\]/$current/g" > \
|
Chris@701
|
30 "$dockerdir"/Dockerfile_test_appimage.gen
|
Chris@701
|
31
|
Chris@701
|
32 grep '^bitbucket.org' ~/.ssh/known_hosts > "$dockerdir"/known_hosts
|
Chris@701
|
33 cp ~/.ssh/id_dsa_build "$dockerdir"/id_dsa_build
|
Chris@701
|
34 chmod 600 "$dockerdir"/known_hosts "$dockerdir"/id_dsa_build
|
Chris@701
|
35 trap "rm $dockerdir/known_hosts $dockerdir/id_dsa_build" 0
|
Chris@701
|
36
|
Chris@705
|
37 cp appimagetool-x86_64.AppImage "$dockerdir/"
|
Chris@705
|
38
|
Chris@701
|
39 dockertag="cannam/easymercurial-appimage-$current"
|
Chris@701
|
40
|
Chris@701
|
41 sudo docker build -t "$dockertag" -f "$dockerdir"/Dockerfile_appimage.gen "$dockerdir"
|
Chris@701
|
42
|
Chris@701
|
43 outdir="$dockerdir/output"
|
Chris@701
|
44 mkdir -p "$outdir"
|
Chris@701
|
45
|
Chris@701
|
46 container=$(sudo docker create "$dockertag")
|
Chris@701
|
47
|
Chris@701
|
48 sudo docker cp "$container":output-appimage.tar "$outdir"
|
Chris@701
|
49 sudo docker rm "$container"
|
Chris@701
|
50
|
Chris@701
|
51 ( cd "$outdir" ; tar xf output-appimage.tar && rm -f output-appimage.tar )
|
Chris@701
|
52
|
Chris@701
|
53 sudo docker build -t "$dockertag"-test -f "$dockerdir"/Dockerfile_test_appimage.gen "$dockerdir"
|