Clean up some path shenanigans

This commit is contained in:
Graham Christensen 2018-04-17 10:46:20 -04:00
parent 27e2dcc669
commit 0e0fd1ee88
2 changed files with 25 additions and 5 deletions

View File

@ -25,6 +25,9 @@
, vmTools
, makeInitrd
, shellcheck
, coreutils
, openssh
, gnutar
, linuxkitKernel ? (forceSystem "x86_64-linux" "x86_64").callPackage ./kernel.nix { }
, storeDir ? builtins.storeDir
@ -130,6 +133,8 @@ let
Exit this VM by running:
kill $(cat ~/.nixpkgs/linuxkit-builder/nix-state/hyperkit.pid)
Or, in this terminal, type 'stop'.
======================================================================
'';
@ -243,7 +248,8 @@ let
];
};
in shellcheckedScriptBin "linuxkit-builder" ./ui.sh {
inherit bash hostPort vpnkit hyperkit linuxkit containerIp;
inherit bash hostPort vpnkit hyperkit linuxkit containerIp coreutils
openssh gnutar;
boot_files = runCommand "linuxkit-kernel-files" {
kernel_path = "${linuxkitKernel}/${img}";

View File

@ -1,5 +1,6 @@
#!@bash@/bin/bash -eu
#!@bash@/bin/bash -eux
PATH=@coreutils@/bin:@openssh@/bin:@gnutar@/bin
BOOT_FILES=@boot_files@
HOST_PORT=@hostPort@
INTEGRATED_PATH=@integrated_path@
@ -51,8 +52,11 @@ if [ ! -d "$DIR/keys" ]; then
fi
cp "$INTEGRATED_PATH" "$DIR/integrated.sh"
chmod u+w "$DIR/integrated.sh"
chmod +x "$DIR/integrated.sh"
cp "$EXAMPLE_PATH" "$DIR/example.nix"
chmod u+w "$DIR/example.nix"
cat <<EOF > "$DIR/ssh-config"
Host nix-linuxkit
@ -100,10 +104,20 @@ EOF
chmod +x "$DIR/finish-setup.sh"
PATH="$VPNKIT_ROOT/bin:$PATH"
exec "$LINUXKIT_ROOT/bin/linuxkit" run \
function finish {
if [ -f "$DIR/nix-state/hyperkit.pid" ]; then
# yeah, yeah, /usr/bin
/usr/bin/pkill -F ~/.nixpkgs/linuxkit-builder/nix-state/hyperkit.pid hyperkit
fi
echo bye
}
trap finish EXIT
"$LINUXKIT_ROOT/bin/linuxkit" run \
hyperkit \
-hyperkit "$HYPERKIT_ROOT/bin/hyperkit" "$@" \
-hyperkit "$HYPERKIT_ROOT/bin/hyperkit" \
-vpnkit "$VPNKIT_ROOT/bin/vpnkit" \
-networking vpnkit \
-ip "$CONTAINER_IP" \
-disk "$DIR/nix-disk,size=$SIZE" \