2023-09-06 09:32:01 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
shopt -s inherit_errexit
|
|
|
|
|
|
|
|
export PATH=/run/wrappers/bin:/run/current-system/sw/bin:/bin:/usr/bin:/usr/local/bin
|
|
|
|
VERSION_ARG=""
|
|
|
|
args=("$@")
|
|
|
|
|
|
|
|
if [[ -n ${VERSION_FILE+x} ]]; then
|
|
|
|
VERSION_ARG="--environment=IMAGE_VERSION=$(cat "${VERSION_FILE}")"
|
|
|
|
args+=("$VERSION_ARG")
|
|
|
|
fi
|
|
|
|
|
2023-10-16 10:45:36 -04:00
|
|
|
if [[ -n ${LOCAL_MIRROR+x} ]]; then
|
|
|
|
LOCAL_MIRROR=$(realpath "${LOCAL_MIRROR}")
|
|
|
|
reposdir=$(mktemp -d)
|
|
|
|
cat > "${reposdir}/mkosi.repo" << EOF
|
|
|
|
[local-mirror]
|
|
|
|
name=local-mirror
|
|
|
|
baseurl=file://${LOCAL_MIRROR}
|
|
|
|
enabled=1
|
|
|
|
gpgcheck=0
|
|
|
|
EOF
|
|
|
|
args+=("--package-manager-tree=${reposdir}:/etc/yum.repos.d")
|
|
|
|
fi
|
|
|
|
|
2023-09-06 09:32:01 -04:00
|
|
|
exec @@MKOSI@@ "${args[@]}" build
|