Chris@701: #!/bin/bash Chris@701: # Chris@701: # Docker required Chris@701: Chris@701: set -eu Chris@701: Chris@701: current=$(hg id | awk '{ print $1; }') Chris@701: Chris@701: case "$current" in Chris@701: *+) 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: *);; Chris@701: esac Chris@701: Chris@705: if [ ! -x ./appimagetool-x86_64.AppImage ]; then Chris@705: echo "Failed to find executable ./appimagetool-x86_64.AppImage, please provide that first" Chris@705: exit 2 Chris@705: fi Chris@705: Chris@701: echo Chris@701: echo "Building appimage from revision $current..." Chris@701: Chris@701: dockerdir=deploy/linux/docker Chris@701: Chris@701: cat "$dockerdir"/Dockerfile_appimage.in | \ Chris@701: perl -p -e "s/\[\[REVISION\]\]/$current/g" > \ Chris@701: "$dockerdir"/Dockerfile_appimage.gen Chris@701: Chris@701: cat "$dockerdir"/Dockerfile_test_appimage.in | \ Chris@701: perl -p -e "s/\[\[REVISION\]\]/$current/g" > \ Chris@701: "$dockerdir"/Dockerfile_test_appimage.gen Chris@701: Chris@701: grep '^bitbucket.org' ~/.ssh/known_hosts > "$dockerdir"/known_hosts Chris@701: cp ~/.ssh/id_dsa_build "$dockerdir"/id_dsa_build Chris@701: chmod 600 "$dockerdir"/known_hosts "$dockerdir"/id_dsa_build Chris@701: trap "rm $dockerdir/known_hosts $dockerdir/id_dsa_build" 0 Chris@701: Chris@705: cp appimagetool-x86_64.AppImage "$dockerdir/" Chris@705: Chris@701: dockertag="cannam/easymercurial-appimage-$current" Chris@701: Chris@701: sudo docker build -t "$dockertag" -f "$dockerdir"/Dockerfile_appimage.gen "$dockerdir" Chris@701: Chris@701: outdir="$dockerdir/output" Chris@701: mkdir -p "$outdir" Chris@701: Chris@701: container=$(sudo docker create "$dockertag") Chris@701: Chris@701: sudo docker cp "$container":output-appimage.tar "$outdir" Chris@701: sudo docker rm "$container" Chris@701: Chris@701: ( cd "$outdir" ; tar xf output-appimage.tar && rm -f output-appimage.tar ) Chris@701: Chris@701: sudo docker build -t "$dockertag"-test -f "$dockerdir"/Dockerfile_test_appimage.gen "$dockerdir"