Chris@1924: #!/bin/bash Chris@1924: # Chris@1924: # Docker required Chris@1924: Chris@1924: set -eu Chris@1924: Chris@1924: current=$(hg id | awk '{ print $1; }') Chris@1924: Chris@1924: case "$current" in Chris@1924: *+) 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@1924: *);; Chris@1924: esac Chris@1924: Chris@1924: echo Chris@1926: echo "Building appimage from revision $current..." Chris@1924: Chris@1924: dockerdir=deploy/linux/docker Chris@1924: Chris@1924: cat "$dockerdir"/Dockerfile_appimage.in | \ Chris@1924: perl -p -e "s/\[\[REVISION\]\]/$current/g" > \ Chris@1924: "$dockerdir"/Dockerfile_appimage.gen Chris@1924: Chris@1924: cat "$dockerdir"/Dockerfile_test_appimage.in | \ Chris@1924: perl -p -e "s/\[\[REVISION\]\]/$current/g" > \ Chris@1924: "$dockerdir"/Dockerfile_test_appimage.gen Chris@1924: Chris@2353: fgrep 'hg.sr.ht' ~/.ssh/known_hosts > "$dockerdir"/known_hosts Chris@2353: cp ~/.ssh/id_rsa_build "$dockerdir"/id_rsa_build Chris@2353: chmod 600 "$dockerdir"/known_hosts "$dockerdir"/id_rsa_build Chris@2353: trap "rm $dockerdir/known_hosts $dockerdir/id_rsa_build" 0 Chris@2144: Chris@1925: dockertag="cannam/sonic-visualiser-appimage-$current" Chris@1925: Chris@1925: sudo docker build -t "$dockertag" -f "$dockerdir"/Dockerfile_appimage.gen "$dockerdir" Chris@1925: Chris@1925: outdir="$dockerdir/output" Chris@1925: mkdir -p "$outdir" Chris@1925: Chris@1925: container=$(sudo docker create "$dockertag") Chris@1925: Chris@2116: sudo docker cp "$container":output-appimage.tar "$outdir" Chris@1925: sudo docker rm "$container" Chris@1925: Chris@2116: ( cd "$outdir" ; tar xf output-appimage.tar && rm -f output-appimage.tar ) Chris@1924: Chris@1924: sudo docker build -f "$dockerdir"/Dockerfile_test_appimage.gen "$dockerdir"