summaryrefslogtreecommitdiff
path: root/scripts/syschdemd.sh
diff options
context:
space:
mode:
authornzbr <mail@nzbr.de>2022-11-14 00:47:49 +0100
committerGitHub <noreply@github.com>2022-11-14 00:47:49 +0100
commite9e8d01c5a2f57d330d42c9a772cf67d89b43650 (patch)
tree9e61d75f44211ddfd6df9cde5ad4d1e8f99edcd2 /scripts/syschdemd.sh
parenta4bbcf329a98a7faf79d10370278f87e836e1d7c (diff)
Fix syschdemd exit code (#140)
* use systemd-run instead of machinectl * fix systemd user sessions by launching through runuser * fix: add which to path
Diffstat (limited to 'scripts/syschdemd.sh')
-rw-r--r--scripts/syschdemd.sh14
1 files changed, 9 insertions, 5 deletions
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 "$@"