2022-06-11 17:06:54 +02:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# parse arguments
|
2023-01-22 16:56:46 +01:00
|
|
|
cre_args=(--workdir "/startdir" -v "$PWD":/startdir)
|
|
|
|
[[ $DEBUG ]] || script_args+=(--rm)
|
2022-06-12 20:33:06 +02:00
|
|
|
script_args= read_script_args= no_sync=
|
2022-06-11 17:06:54 +02:00
|
|
|
for arg in "$@"; do
|
|
|
|
if [[ $read_script_args ]]; then
|
2022-06-12 20:33:06 +02:00
|
|
|
if [[ $arg == '--nodeps' ]] || [[ $arg == '-d' ]]; then
|
|
|
|
no_sync=1
|
|
|
|
fi
|
2022-06-11 17:06:54 +02:00
|
|
|
script_args+=" '$arg'"
|
|
|
|
else
|
|
|
|
if [[ $arg == '--' ]]; then
|
|
|
|
read_script_args=1
|
|
|
|
else
|
|
|
|
cre_args+=("$arg")
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2022-06-12 20:33:06 +02:00
|
|
|
# load "containerbuild" and "containersync" script
|
|
|
|
bindir=$(dirname "$0")
|
|
|
|
script=$(cat "$bindir/containerbuild")
|
|
|
|
if ! [[ $no_sync ]]; then
|
|
|
|
script_sync=$(cat "$bindir/containersync")
|
|
|
|
fi
|
|
|
|
|
|
|
|
${CRE:-docker} run "${cre_args[@]}" "${CRE_IMAGE:-archlinux-base-devel}" bash -c "$script_sync $script $script_args"
|