PKGBUILDs/devel/container/makecontainerpkg
Martchus 513103840d Improve makecontainerpkg
* Add my GPG key to the pacman keyring (not nice to hard-code it in the
  Dockerfile but good enough for now)
* Install ccache into the base image to support makepkg's ccache option
* Split syncing packages and execution of `makepkg` so syncing can be
  avoided when only building source package
* Don't quote `CRE`, it is unlikely spaces are needed here and using
  chained commands (e.g. `sudo …`) might be useful
* Add documentation
2022-06-12 21:00:20 +02:00

35 lines
905 B
Bash
Executable File

#!/bin/bash
set -e
# parse arguments
cre_args=(--workdir "/startdir" -v "$PWD":/startdir --rm)
script_args= read_script_args= no_sync=
for arg in "$@"; do
if [[ $read_script_args ]]; then
if [[ $arg == '--nodeps' ]] || [[ $arg == '-d' ]]; then
no_sync=1
fi
script_args+=" '$arg'"
else
if [[ $arg == '--' ]]; then
read_script_args=1
else
cre_args+=("$arg")
fi
fi
done
# load "containerbuild" and "containersync" script
bindir=$(dirname "$0")
script=$(cat "$bindir/containerbuild")
if ! [[ $no_sync ]]; then
script_sync=$(cat "$bindir/containersync")
fi
# allow one to prevent the container from stopping via DEBUG variable
if [[ $DEBUG ]]; then
script_args+=' ; sleep infinity'
fi
${CRE:-docker} run "${cre_args[@]}" "${CRE_IMAGE:-archlinux-base-devel}" bash -c "$script_sync $script $script_args"