Skip to content

Commit

Permalink
Change nsenter options to unbreak WSL
Browse files Browse the repository at this point in the history
Running the original script broke WSL. This change fixed it, thought I'm
not sure why. The options "-m -p" seem to conflict but what do I know.

Found at DamionGans#85.
  • Loading branch information
xwoj33 committed Feb 10, 2023
1 parent 89f851d commit f7cfb73
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions enter-systemd-namespace
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ fi
USER_HOME="$(getent passwd | awk -F: '$1=="'"$SUDO_USER"'" {print $6}')"
if [ -n "$SYSTEMD_PID" ] && [ "$SYSTEMD_PID" != "1" ]; then
if [ -n "$1" ] && [ "$1" != "bash --login" ] && [ "$1" != "/bin/bash --login" ]; then
exec /usr/bin/nsenter -t "$SYSTEMD_PID" -a \
exec /usr/bin/nsenter -t "$SYSTEMD_PID" -m -p \
/usr/bin/sudo -H -u "$SUDO_USER" \
/bin/bash -c 'set -a; [ -f "$HOME/.systemd-env" ] && source "$HOME/.systemd-env"; set +a; exec bash -c '"$(printf "%q" "$@")"
else
exec /usr/bin/nsenter -t "$SYSTEMD_PID" -a \
exec /usr/bin/nsenter -t "$SYSTEMD_PID" -m -p \
/bin/login -p -f "$SUDO_USER" \
$([ -f "$USER_HOME/.systemd-env" ] && /bin/cat "$USER_HOME/.systemd-env" | xargs printf ' %q')
fi
Expand Down

0 comments on commit f7cfb73

Please sign in to comment.