2018-04-17 17:46:20 +03:00
|
|
|
#!@bash@/bin/bash -eux
|
2018-04-10 21:53:42 +03:00
|
|
|
|
2018-04-17 17:46:20 +03:00
|
|
|
PATH=@coreutils@/bin:@openssh@/bin:@gnutar@/bin
|
2018-04-10 21:53:42 +03:00
|
|
|
BOOT_FILES=@boot_files@
|
|
|
|
VPNKIT_ROOT=@vpnkit@
|
|
|
|
HYPERKIT_ROOT=@hyperkit@
|
|
|
|
LINUXKIT_ROOT=@linuxkit@
|
|
|
|
CONTAINER_IP=@containerIp@
|
2018-05-23 17:41:23 +03:00
|
|
|
NIX_LINUXKIT_RUNNER=@nix_linuxkit_runner@
|
2018-04-10 21:53:42 +03:00
|
|
|
|
2018-05-24 18:20:16 +03:00
|
|
|
DIR="${XDG_CACHE_HOME:-${HOME}/.cache}/nix-linuxkit-builder/"
|
2018-04-10 21:53:42 +03:00
|
|
|
|
|
|
|
FEATURES="big-parallel"
|
2018-05-23 17:41:23 +03:00
|
|
|
SIZE="80"
|
2018-04-10 21:53:42 +03:00
|
|
|
CPUS=1
|
2018-05-14 20:25:43 +03:00
|
|
|
MEM=4096
|
2018-05-23 16:59:37 +03:00
|
|
|
VERBOSE=""
|
2018-05-23 17:41:23 +03:00
|
|
|
|
2018-05-24 18:20:16 +03:00
|
|
|
cfg_path="$DIR/configure"
|
|
|
|
if [ -f "$cfg_path" ]; then
|
|
|
|
echo "Configuration is loaded from $cfg_path" >&2
|
|
|
|
# shellcheck disable=SC1090
|
|
|
|
. "$cfg_path"
|
|
|
|
else
|
|
|
|
echo "Configuration would be loaded from $cfg_path, but it does not exist." >&2
|
2018-04-10 21:53:42 +03:00
|
|
|
fi
|
|
|
|
|
2018-05-24 18:20:16 +03:00
|
|
|
(
|
|
|
|
echo
|
|
|
|
echo "Reconfigure with nix-linuxkit-configure"
|
|
|
|
echo
|
|
|
|
echo "Current configuration options:"
|
|
|
|
echo "FEATURES=$FEATURES"
|
|
|
|
echo "SIZE=$SIZE"
|
|
|
|
echo "MEM=$MEM"
|
|
|
|
echo "VERBOSE=$VERBOSE"
|
|
|
|
) >&2
|
2018-04-10 21:53:42 +03:00
|
|
|
|
2018-09-06 22:11:32 +03:00
|
|
|
exec $NIX_LINUXKIT_RUNNER/bin/nix-linuxkit-runner \
|
2018-05-23 17:41:23 +03:00
|
|
|
$VERBOSE \
|
|
|
|
--linuxkit "$LINUXKIT_ROOT/bin/linuxkit" \
|
|
|
|
--hyperkit "$HYPERKIT_ROOT/bin/hyperkit" \
|
|
|
|
--vpnkit "$VPNKIT_ROOT/bin/vpnkit" \
|
|
|
|
--ip "$CONTAINER_IP" \
|
|
|
|
--disk-size "$SIZE" \
|
|
|
|
--state-root "$DIR" \
|
|
|
|
--cpus "$CPUS" \
|
|
|
|
--memory "$MEM" \
|
|
|
|
--kernel-files "$BOOT_FILES/nix"
|