archlinux-docker/scripts/make-dockerfile.sh
Emil Velikov f737d64397 Move shell scripts out of the Makefile
Embedding one pieces of code into another (shell script into a makefiles
in this case) is rarely pretty. Split things up, as appropriate.

While here, simplify the rootfs in a few ways:
 - pass only the extra non-base (and effectively group name) package
 - add a handy variable for the fakeroot/fakechroot combo
 - split and rewrap long lines

As a bonus point, this makes it easier to use pattern rules in the
makefile - which will be handy for the upcoming multilib-devel
group/target.

Plus we can check the scripts via shellcheck/etc CI stage, as follow-up.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2023-09-25 23:40:44 +01:00

17 lines
567 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|ROOTFS=\"$GROUP.tar.zst\"|" \
-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"