aboutsummaryrefslogtreecommitdiff
path: root/pogojig_generate.sh.j2
blob: c1cc023bf18c081ad5e16891ed43bdfa5b30bc4e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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"