From 700fc8ce33fc914327db213b19da4c0037bfda20 Mon Sep 17 00:00:00 2001 From: selfhoster1312 Date: Tue, 6 Jun 2023 11:57:37 +0200 Subject: [PATCH] Use lxc-start/lxc-attach instead of lxc-execute, so the system is booted with systemd --- bin/mkvm.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/bin/mkvm.sh b/bin/mkvm.sh index e94e495..e31c573 100755 --- a/bin/mkvm.sh +++ b/bin/mkvm.sh @@ -91,11 +91,18 @@ CMD="$1" shift if [[ "$CMD" != "" ]]; then - lxc-execute -n "$VMNAME" -- "$CMD" "$@" - [ $KEEP -eq 0 ] && lxc-destroy -n "$VMNAME" + lxc-start -n "$VMNAME" + lxc-attach -n "$VMNAME" -- "$CMD" "$@" + if [ $KEEP -eq 0 ]; then + lxc-stop --kill "$VMNAME" + lxc-destroy -n "$VMNAME" + fi else lxc-start -n "$VMNAME" lxc-attach -n "$VMNAME" bash - [ $KEEP -eq 0 ] && lxc-stop --kill "$VMNAME" && lxc-destroy -n "$VMNAME" + if [ $KEEP -eq 0 ]; then + lxc-stop --kill "$VMNAME" + lxc-destroy -n "$VMNAME" + fi fi