linuxkit-nix/linuxkit-builder/ui.sh

50 lines
1.2 KiB
Bash
Raw Normal View History

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@
NIX_LINUXKIT_RUNNER=@nix_linuxkit_runner@
2018-04-10 21:53:42 +03:00
DIR="${XDG_CACHE_HOME:-${HOME}/.cache}/nix-linuxkit-builder/"
2018-04-10 21:53:42 +03:00
FEATURES="big-parallel"
SIZE="80"
2018-04-10 21:53:42 +03:00
CPUS=1
MEM=4096
2018-05-23 16:59:37 +03:00
VERBOSE=""
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
(
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
exec $NIX_LINUXKIT_RUNNER/bin/nix-linuxkit-runner \
$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"