aboutsummaryrefslogtreecommitdiff
path: root/gerboweb/deploy/pogojig_generate.sh.j2
diff options
context:
space:
mode:
authorjaseg <code@jaseg.net>2019-09-29 16:28:11 +0200
committerjaseg <code@jaseg.net>2019-09-29 16:28:11 +0200
commitaaacaed22082df3ec338b1bc795ebe3013c450c8 (patch)
treeb8b43ef98a61e407740ac7455f6dd989b2d406cf /gerboweb/deploy/pogojig_generate.sh.j2
parent0ada527f0b0e8400253407b78a25d8fbadbe726b (diff)
downloadgerbolyze-aaacaed22082df3ec338b1bc795ebe3013c450c8.tar.gz
gerbolyze-aaacaed22082df3ec338b1bc795ebe3013c450c8.tar.bz2
gerbolyze-aaacaed22082df3ec338b1bc795ebe3013c450c8.zip
deploy: add pogojig
Diffstat (limited to 'gerboweb/deploy/pogojig_generate.sh.j2')
-rwxr-xr-xgerboweb/deploy/pogojig_generate.sh.j225
1 files changed, 25 insertions, 0 deletions
diff --git a/gerboweb/deploy/pogojig_generate.sh.j2 b/gerboweb/deploy/pogojig_generate.sh.j2
new file mode 100755
index 0000000..c1cc023
--- /dev/null
+++ b/gerboweb/deploy/pogojig_generate.sh.j2
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+[ $# != 1 ] && exit 1
+ID=$1
+egrep -x -q '^[-0-9A-Za-z]{36}$'<<<"$ID" || exit 2
+
+systemd-nspawn \
+ -D {{pogojig_root}} \
+ -x --bind={{pogojig_cache}}/upload/$ID:/mnt \
+ /bin/sh -c "set -euo pipefail
+cd /mnt
+
+date; echo 'Cleaning up previous output'
+rm -rf pcb_shape.dxf jig.stl kicad kicad.zip sources.zip
+
+date; echo 'Rendering'
+cp -r /var/lib/pogojig_renderer sources
+cp input.svg sources/
+make -C sources
+
+date; echo 'Packing source bundle'
+cp -r sources/out/pcb_shape.dxf sources/out/jig.stl sources/out/kicad ./
+zip -r sources.zip sources
+zip -r kicad.zip kicad
+rm -rf sources"