Skip to content
This repository has been archived by the owner on Oct 21, 2024. It is now read-only.

Commit

Permalink
start-systemd-namespace: Remove unnecessary "export"
Browse files Browse the repository at this point in the history
Exports PRE_NAMESPACE_PWD and PRE_NAMESPACE_PATH variables to environment variables cause the PWD/PATH will set to  PRE_NAMESPACE_PWD/PRE_NAMESPACE_PATH every time while you start a bash.
(the unset does not work cause it can only unset local variables)

Solution: removes "export" words at the start of the definition of  PRE_NAMESPACE_PWD and PRE_NAMESPACE_PATH

DamionGans#52

Signed-off-by: Sung Mingi <FiestaLake@protonmail.com>
  • Loading branch information
susautw authored and Sung Mingi committed Apr 28, 2021
1 parent 443c5ba commit 124a26f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions start-systemd-namespace
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
SYSTEMD_EXE="/lib/systemd/systemd --unit=multi-user.target"
SYSTEMD_PID="$(ps -eo pid=,args= | awk '$2" "$3=="'"$SYSTEMD_EXE"'" {print $1}')"
if [ "$LOGNAME" != "root" ] && ( [ -z "$SYSTEMD_PID" ] || [ "$SYSTEMD_PID" != "1" ] ); then
PRE_NAMESPACE_PATH="$PATH"

This comment has been minimized.

Copy link
@saltyming

saltyming Apr 28, 2021

Owner
PRE_NAMESPACE_PWD="$(pwd)"
export | sed -e 's/^declare -x //;/^IFS=".*[^"]$/{N;s/\n//}' | \
grep -E -v "^(BASH|BASH_ENV|DIRSTACK|EUID|GROUPS|HOME|HOSTNAME|\
IFS|LANG|LOGNAME|MACHTYPE|MAIL|NAME|OLDPWD|OPTERR|\
OSTYPE|PATH|PIPESTATUS|POSIXLY_CORRECT|PPID|PS1|PS4|\
SHELL|SHELLOPTS|SHLVL|SYSTEMD_PID|UID|USER|_)(=|\$)" > "$HOME/.systemd-env"
export SYSTEMD_PRE_NAMESPACE_PATH="$PATH"
export SYSTEMD_PRE_NAMESPACE_PWD="$PWD"
exec sudo /usr/sbin/enter-systemd-namespace "$BASH_EXECUTION_STRING"
fi

Expand Down

0 comments on commit 124a26f

Please sign in to comment.