From b3c3a315f2583bcd6b95bd6964e7760456cadc6d Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Wed, 22 Apr 2020 16:46:27 +0000 Subject: spectrumPackages.spectrum-vm: fix with no wayland We can abuse $@ to be a sort of array where we can put a number of values, without losing quoting information or having to escape. --- pkgs/os-specific/linux/spectrum/spectrum-vm/spectrum-vm.in | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'pkgs') diff --git a/pkgs/os-specific/linux/spectrum/spectrum-vm/spectrum-vm.in b/pkgs/os-specific/linux/spectrum/spectrum-vm/spectrum-vm.in index 97cb5dbfa58..7c653da12f4 100755 --- a/pkgs/os-specific/linux/spectrum/spectrum-vm/spectrum-vm.in +++ b/pkgs/os-specific/linux/spectrum/spectrum-vm/spectrum-vm.in @@ -58,9 +58,17 @@ if [ "$#" -ne 0 ]; then ex_usage 1 >&2 fi -exec "$crosvm" run \ - --wayland-sock "$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY" \ - -s "$XDG_RUNTIME_DIR" \ +set +e +if [ -n "$XDG_RUNTIME_DIR" ] +then + set -- -s "$XDG_RUNTIME_DIR" + if [ -n "$WAYLAND_DISPLAY" ] + then set -- "$@" --wayland-sock "$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY" + fi +fi +set -e + +exec "$crosvm" run "$@" \ -p init=/sbin/init \ -p "spectrumcmd=$(printf %s "$command" | base64)" \ --root "$rootfs" \ -- cgit 1.4.1