Use lxc-start/lxc-attach instead of lxc-execute, so the system is booted with systemd

This commit is contained in:
selfhoster selfhoster 2023-06-06 11:57:37 +02:00
parent 52cfb26a3a
commit 700fc8ce33

View File

@ -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