wsl2-systemd scripts rename

This commit is contained in:
2023-07-11 08:52:22 +00:00
parent 9bc1445455
commit bf7f2cf8a5
4 changed files with 7 additions and 7 deletions

View File

@@ -42,8 +42,8 @@ if [ "$ADDITIONALS" == "true" ]; then
elif [ -n "$WSL_DISTRO_NAME" ]; then
echo "Download WSL2 systemd scripts"
cp -rv /wsl2-systemd-script.sh /usr/local/bin/wsl2-systemd-script.sh
cp -rv /enter-systemd-namespace /usr/local/bin/enter-systemd-namespace
cp -rv /wsl2-systemd-script.sh /usr/local/bin/start-systemd-namespace
cp -rv /enter-systemd-namespace.sh /usr/local/bin/enter-systemd-namespace.sh;
cp -rv /start-systemd-namespace.sh /usr/local/bin/start-systemd-namespace.sh;
else # default install
if [[ "$SMARTHOST_PROXY" == "YES" || "$SMARTHOST_PROXY" == "TRUE" ]]; then
PROXY_TYPE=smarthost-proxy" "$PROXY_TYPE;

View File

@@ -10,7 +10,7 @@ OSTYPE|PATH|PIPESTATUS|POSIXLY_CORRECT|PPID|PS1|PS4|\
SHELL|SHELLOPTS|SHLVL|SYSTEMD_PID|UID|USER|_)(=|\$)" > "$HOME/.systemd-env"
export PRE_NAMESPACE_PATH="$PATH"
export PRE_NAMESPACE_PWD="$(pwd)"
exec $SUDO_CMD /enter-systemd-namespace "$BASH_EXECUTION_STRING"
exec $SUDO_CMD /usr/local/bin/enter-systemd-namespace.sh "$BASH_EXECUTION_STRING"
fi
if [ -n "$PRE_NAMESPACE_PATH" ]; then
export PATH="$PRE_NAMESPACE_PATH"

View File

@@ -1,7 +1,7 @@
#!/bin/bash
if [ "$1" != "--force" ]; then
if [ -f /start-systemd-namespace ]; then
if [ -f /usr/local/bin/start-systemd-namespace.sh ]; then
echo "It appears you have already installed the systemd hack."
echo "To forcibly reinstall, run this script with the \`--force\` parameter."
exit
@@ -55,7 +55,7 @@ $SUDO_CMD apt-get update && $SUDO_CMD apt-get install -yqq daemonize dbus-user-s
#$SUDO_CMD cp "$self_dir/start-systemd-namespace" /start-systemd-namespace
#$SUDO_CMD cp "$self_dir/enter-systemd-namespace" /enter-systemd-namespace
$SUDO_CMD chmod +x /enter-systemd-namespace
$SUDO_CMD chmod +x /usr/local/bin/enter-systemd-namespace.sh
$SUDO_CMD tee /etc/sudoers.d/systemd-namespace >/dev/null <<EOF
Defaults env_keep += WSLPATH
@@ -64,11 +64,11 @@ Defaults env_keep += WSL_INTEROP
Defaults env_keep += WSL_DISTRO_NAME
Defaults env_keep += PRE_NAMESPACE_PATH
Defaults env_keep += PRE_NAMESPACE_PWD
%sudo ALL=(ALL) NOPASSWD: /enter-systemd-namespace
%sudo ALL=(ALL) NOPASSWD: /usr/local/bin/enter-systemd-namespace.sh
EOF
if ! grep 'start-systemd-namespace' /etc/bash.bashrc >/dev/null; then
$SUDO_CMD sed -i 2a"# Start or enter a PID namespace in WSL2\nsource /start-systemd-namespace\n" /etc/bash.bashrc
$SUDO_CMD sed -i 2a"# Start or enter a PID namespace in WSL2\nsource /usr/loca/bin/start-systemd-namespace.sh\n" /etc/bash.bashrc
fi
$SUDO_CMD rm -f /etc/systemd/user/sockets.target.wants/dirmngr.socket