annotate 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
rev   line source
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@701 14 echo
Chris@701 15 echo "Building appimage from revision $current..."
Chris@701 16
Chris@701 17 dockerdir=deploy/linux/docker
Chris@701 18
Chris@701 19 cat "$dockerdir"/Dockerfile_appimage.in | \
Chris@701 20 perl -p -e "s/\[\[REVISION\]\]/$current/g" > \
Chris@701 21 "$dockerdir"/Dockerfile_appimage.gen
Chris@701 22
Chris@701 23 cat "$dockerdir"/Dockerfile_test_appimage.in | \
Chris@701 24 perl -p -e "s/\[\[REVISION\]\]/$current/g" > \
Chris@701 25 "$dockerdir"/Dockerfile_test_appimage.gen
Chris@701 26
Chris@701 27 grep '^bitbucket.org' ~/.ssh/known_hosts > "$dockerdir"/known_hosts
Chris@701 28 cp ~/.ssh/id_dsa_build "$dockerdir"/id_dsa_build
Chris@701 29 chmod 600 "$dockerdir"/known_hosts "$dockerdir"/id_dsa_build
Chris@701 30 trap "rm $dockerdir/known_hosts $dockerdir/id_dsa_build" 0
Chris@701 31
Chris@701 32 dockertag="cannam/easymercurial-appimage-$current"
Chris@701 33
Chris@701 34 sudo docker build -t "$dockertag" -f "$dockerdir"/Dockerfile_appimage.gen "$dockerdir"
Chris@701 35
Chris@701 36 outdir="$dockerdir/output"
Chris@701 37 mkdir -p "$outdir"
Chris@701 38
Chris@701 39 container=$(sudo docker create "$dockertag")
Chris@701 40
Chris@701 41 sudo docker cp "$container":output-appimage.tar "$outdir"
Chris@701 42 sudo docker rm "$container"
Chris@701 43
Chris@701 44 ( cd "$outdir" ; tar xf output-appimage.tar && rm -f output-appimage.tar )
Chris@701 45
Chris@701 46 sudo docker build -t "$dockertag"-test -f "$dockerdir"/Dockerfile_test_appimage.gen "$dockerdir"