Mercurial > hg > sonic-annotator
annotate deploy/linux/build-and-test-appimage.sh @ 395:dec56c3e793b
Add a few more files to .hgignore
author | Chris Cannam |
---|---|
date | Tue, 09 Jun 2020 17:01:54 +0100 |
parents | a0ff34e9e86b |
children |
rev | line source |
---|---|
Chris@371 | 1 #!/bin/bash |
Chris@371 | 2 # |
Chris@371 | 3 # Docker required |
Chris@371 | 4 |
Chris@371 | 5 set -eu |
Chris@371 | 6 |
Chris@371 | 7 current=$(hg id | awk '{ print $1; }') |
Chris@371 | 8 |
Chris@371 | 9 case "$current" in |
Chris@371 | 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@371 | 11 *);; |
Chris@371 | 12 esac |
Chris@371 | 13 |
Chris@371 | 14 echo |
Chris@371 | 15 echo "Building appimage from revision $current..." |
Chris@371 | 16 |
Chris@371 | 17 dockerdir=deploy/linux/docker |
Chris@371 | 18 |
Chris@371 | 19 cat "$dockerdir"/Dockerfile_appimage.in | \ |
Chris@371 | 20 perl -p -e "s/\[\[REVISION\]\]/$current/g" > \ |
Chris@371 | 21 "$dockerdir"/Dockerfile_appimage.gen |
Chris@371 | 22 |
Chris@371 | 23 cat "$dockerdir"/Dockerfile_test_appimage.in | \ |
Chris@371 | 24 perl -p -e "s/\[\[REVISION\]\]/$current/g" > \ |
Chris@371 | 25 "$dockerdir"/Dockerfile_test_appimage.gen |
Chris@371 | 26 |
Chris@371 | 27 fgrep 'hg.sr.ht' ~/.ssh/known_hosts > "$dockerdir"/known_hosts |
Chris@371 | 28 cp ~/.ssh/id_rsa_build "$dockerdir"/id_rsa_build |
Chris@371 | 29 chmod 600 "$dockerdir"/known_hosts "$dockerdir"/id_rsa_build |
Chris@371 | 30 trap "rm $dockerdir/known_hosts $dockerdir/id_rsa_build" 0 |
Chris@371 | 31 |
Chris@371 | 32 dockertag="cannam/sonic-annotator-appimage-$current" |
Chris@371 | 33 |
Chris@371 | 34 sudo docker build -t "$dockertag" -f "$dockerdir"/Dockerfile_appimage.gen "$dockerdir" |
Chris@371 | 35 |
Chris@371 | 36 outdir="$dockerdir/output" |
Chris@371 | 37 mkdir -p "$outdir" |
Chris@371 | 38 |
Chris@371 | 39 container=$(sudo docker create "$dockertag") |
Chris@371 | 40 |
Chris@371 | 41 sudo docker cp "$container":output-appimage.tar "$outdir" |
Chris@371 | 42 sudo docker rm "$container" |
Chris@371 | 43 |
Chris@371 | 44 ( cd "$outdir" ; tar xf output-appimage.tar && rm -f output-appimage.tar ) |
Chris@371 | 45 |
Chris@371 | 46 sudo docker build -f "$dockerdir"/Dockerfile_test_appimage.gen "$dockerdir" |