Use yaml for packer job description

This commit is contained in:
Jakob Lechner 2020-01-07 20:23:37 +01:00
parent 33ccd59f2c
commit e43f34991d
6 changed files with 109 additions and 158 deletions

View file

@ -7,4 +7,6 @@ export IMAGES="$(realpath images)"
cd packer
python3 -c 'import sys, yaml, json; json.dump(yaml.safe_load(sys.stdin), sys.stdout, indent=4)' < "$NAME.yaml" > "$NAME.json"
packer build "$NAME.json"

View file

@ -1,33 +0,0 @@
#!/bin/sh
set -o nounset
cd images
NAME="$1"
if [ "$NAME" = "" ]; then
# remove file extension
NAME="$(echo "$1" | sed 's/\.[^.]*//')"
fi
if [ "$WEBSEED" = "" ]; then
echo '$WEBSEED not provided' >&2
exit 1
fi
if [ "$ANNOUNCE" = "" ]; then
echo '$ANNOUNCE not provided' >&2
exit 1
fi
TORRENT_FILE="$NAME.torrent"
WEBSEED_URL="$WEBSEED/$1"
if [ -e "$TORRENT_FILE" ]; then rm "$TORRENT_FILE"; fi
mktorrent \
-n "$NAME" \
-a "$ANNOUNCE" \
-o "$TORRENT_FILE" \
-l 22 \
-w "$WEBSEED_URL" \
"$1"