Mercurial > hg > sonic-annotator
comparison deploy/linux/build-and-test-appimage.sh @ 371:a0ff34e9e86b
First cut at Linux AppImage
author | Chris Cannam |
---|---|
date | Fri, 05 Jun 2020 11:08:37 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
370:3e0133aa2354 | 371:a0ff34e9e86b |
---|---|
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 fgrep 'hg.sr.ht' ~/.ssh/known_hosts > "$dockerdir"/known_hosts | |
28 cp ~/.ssh/id_rsa_build "$dockerdir"/id_rsa_build | |
29 chmod 600 "$dockerdir"/known_hosts "$dockerdir"/id_rsa_build | |
30 trap "rm $dockerdir/known_hosts $dockerdir/id_rsa_build" 0 | |
31 | |
32 dockertag="cannam/sonic-annotator-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 -f "$dockerdir"/Dockerfile_test_appimage.gen "$dockerdir" |