archlinux-docker/scripts/make-dockerfile.sh
Emil Velikov a972ead2e0 scripts/make-dockerfile.sh: rework TEMPLATE_ROOTFS_DOWNLOAD handling
Currently the TEMPLATE_ROOTFS_DOWNLOAD handling is overly complicated.
For the local builds, we set a ROOTFS=$GROUP.tar.zst. While for remote
builds, we:
 - invoke curl to fetch the remote tarball - ok
 - do curl and shell escaping contortions to prints the filename - ehhh
   - that we already now
   - and rely upon to not change, otherwise sha256sum will fail

Just use a dummy "true", for the local builds and a normal curl
command otherwise.

v2:
 - don't call curl in a sub-shell - no longer needed

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2023-10-02 11:51:59 +01:00

17 lines
546 B
Bash
Executable File

#!/bin/bash
set -euo pipefail
declare -r GROUP="$1"
declare -r OUTPUTDIR="$2"
sed -e "s|TEMPLATE_ROOTFS_FILE|$GROUP.tar.zst|" \
-e "s|TEMPLATE_ROOTFS_RELEASE_URL|Local build|" \
-e "s|TEMPLATE_ROOTFS_DOWNLOAD|true|" \
-e "s|TEMPLATE_ROOTFS_HASH|$(cat $OUTPUTDIR/$GROUP.tar.zst.SHA256)|" \
-e "s|TEMPLATE_TITLE|Arch Linux Dev Image|" \
-e "s|TEMPLATE_VERSION_ID|dev|" \
-e "s|TEMPLATE_REVISION|$(git rev-parse HEAD)|" \
-e "s|TEMPLATE_CREATED|$(date -Is)|" \
Dockerfile.template > "$OUTPUTDIR/Dockerfile.$GROUP"