diff options
author | jaseg <git@jaseg.de> | 2022-07-04 23:57:28 +0200 |
---|---|---|
committer | jaseg <git@jaseg.de> | 2022-07-04 23:57:28 +0200 |
commit | 3ba932209fc33206a28483d07fb0e108d1b16a2b (patch) | |
tree | afd6bf65b37b096f79b2ef2697e72b31a230bc87 /gerboweb/ansible/vector.sh.j2 | |
parent | 1da5919d9133f09bdd112da592620564368fd103 (diff) | |
download | gerbolyze-3ba932209fc33206a28483d07fb0e108d1b16a2b.tar.gz gerbolyze-3ba932209fc33206a28483d07fb0e108d1b16a2b.tar.bz2 gerbolyze-3ba932209fc33206a28483d07fb0e108d1b16a2b.zip |
gerboweb: add deployment stuff
Diffstat (limited to 'gerboweb/ansible/vector.sh.j2')
-rwxr-xr-x | gerboweb/ansible/vector.sh.j2 | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gerboweb/ansible/vector.sh.j2 b/gerboweb/ansible/vector.sh.j2 new file mode 100755 index 0000000..b007967 --- /dev/null +++ b/gerboweb/ansible/vector.sh.j2 @@ -0,0 +1,18 @@ +#!/bin/sh + +[ $# != 2 ] && exit 1 +ID=$1 +egrep -x -q '^[-0-9A-Za-z]{36}$'<<<"$ID" || exit 2 +LAYER=$2 +egrep -x -q '^(top|bottom)$'<<<"$LAYER" || exit 2 + +systemd-nspawn \ + -D {{gerboweb_root}} \ + -x --bind={{gerboweb_cache}}/upload/$ID:/mnt \ + /bin/sh -c "set -euo pipefail +cd /tmp +unzip -j -d gerber_in /mnt/gerber.zip +gerbolyze paste "--"$LAYER /mnt/overlay.svg gerber_in gerber +rm -f /mnt/gerber_out.zip +zip -r /mnt/gerber_out.zip gerber" + |