From e9e8d01c5a2f57d330d42c9a772cf67d89b43650 Mon Sep 17 00:00:00 2001 From: nzbr Date: Mon, 14 Nov 2022 00:47:49 +0100 Subject: Fix syschdemd exit code (#140) * use systemd-run instead of machinectl * fix systemd user sessions by launching through runuser * fix: add which to path --- scripts/syschdemd.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'scripts/syschdemd.sh') diff --git a/scripts/syschdemd.sh b/scripts/syschdemd.sh index 33dbc00..73adb40 100644 --- a/scripts/syschdemd.sh +++ b/scripts/syschdemd.sh @@ -106,7 +106,7 @@ main() { shift command="$*" else - command=$(get_shell @username@) + command="$(get_shell @username@)" fi # If we're executed from inside the container, e.g. sudo @@ -124,13 +124,17 @@ main() { exportCmd="$(export -p | grep -vE ' (HOME|LOGNAME|SHELL|USER)=')" run_in_namespace \ - machinectl \ + systemd-run \ --quiet \ - --uid=@uid@ \ + --collect \ + --wait \ + --pty \ + --service-type=exec \ --setenv=INSIDE_NAMESPACE=true \ --setenv=WSLPATH="$(clean_wslpath)" \ - shell .host \ - /bin/sh -c "cd \"$PWD\"; $exportCmd; source /etc/set-environment; exec $command" + --working-directory="$PWD" \ + --machine=.host \ + "$(which runuser)" -u @username@ -- /bin/sh -c "$exportCmd; source /etc/set-environment; exec $command" } main "$@" -- cgit v1.2.3