comparison deploy/linux/build-and-test-appimage.sh @ 701:0720152d1914

Further Linux packaging work
author Chris Cannam
date Wed, 12 Dec 2018 10:23:55 +0000
parents
children b93d662a12df
comparison
equal deleted inserted replaced
700:21e4df9865af 701:0720152d1914
1 #!/bin/bash
2 #
3 # Docker required
4
5 set -eu
6
7 current=$(hg id | awk '{ print $1; }')
8
9 case "$current" in
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;;
11 *);;
12 esac
13
14 echo
15 echo "Building appimage from revision $current..."
16
17 dockerdir=deploy/linux/docker
18
19 cat "$dockerdir"/Dockerfile_appimage.in | \
20 perl -p -e "s/\[\[REVISION\]\]/$current/g" > \
21 "$dockerdir"/Dockerfile_appimage.gen
22
23 cat "$dockerdir"/Dockerfile_test_appimage.in | \
24 perl -p -e "s/\[\[REVISION\]\]/$current/g" > \
25 "$dockerdir"/Dockerfile_test_appimage.gen
26
27 grep '^bitbucket.org' ~/.ssh/known_hosts > "$dockerdir"/known_hosts
28 cp ~/.ssh/id_dsa_build "$dockerdir"/id_dsa_build
29 chmod 600 "$dockerdir"/known_hosts "$dockerdir"/id_dsa_build
30 trap "rm $dockerdir/known_hosts $dockerdir/id_dsa_build" 0
31
32 dockertag="cannam/easymercurial-appimage-$current"
33
34 sudo docker build -t "$dockertag" -f "$dockerdir"/Dockerfile_appimage.gen "$dockerdir"
35
36 outdir="$dockerdir/output"
37 mkdir -p "$outdir"
38
39 container=$(sudo docker create "$dockertag")
40
41 sudo docker cp "$container":output-appimage.tar "$outdir"
42 sudo docker rm "$container"
43
44 ( cd "$outdir" ; tar xf output-appimage.tar && rm -f output-appimage.tar )
45
46 sudo docker build -t "$dockertag"-test -f "$dockerdir"/Dockerfile_test_appimage.gen "$dockerdir"