wsl2-systemd script 2

This commit is contained in:
2023-07-10 13:58:27 +00:00
parent 547cfb10e0
commit eb48e0cf22
3 changed files with 18 additions and 15 deletions

View File

@@ -39,7 +39,7 @@ if [ "$ADDITIONALS" == "true" ]; then
echo "Additional install has started"
sh /additional_install.sh
echo "Additional install has finished"
else if [ "$WSL2" == "true" ]; then
elif [ -n "$WSL_DISTRO_NAME" ]; then
echo "WSL2 systemd script has started"
sh /wsl2-systemd-script.sh
#systemctl

View File

@@ -648,19 +648,22 @@ if [ "$ANSWER" == "y" ] || [ "$ANSWER" == "Y" ] || [ "$ANSWER" == "" ]; then
registry.format.hu/installer-tool
fi
# enable systemd support on current images
echo "Would you like to install and enable systemd support? (Y/n)";
read -r ANSWER;
if [ "$ANSWER" == "y" ] || [ "$ANSWER" == "Y" ] || [ "$ANSWER" == "" ] ; then
# running on WSL
if [ -n "$WSL_DISTRO_NAME" ]; then
# enable systemd support on current images
echo "Would you like to install and enable systemd support? (Y/n)";
read -r ANSWER;
if [ "$ANSWER" == "y" ] || [ "$ANSWER" == "Y" ] || [ "$ANSWER" == "" ] ; then
# Run installer tool
$SUDO_CMD docker run \
--env WSL2=true \
--env WSL_DISTRO_NAME=$WSL_DISTRO_NAME \
--env SUDO_CMD=$SUDO_CMD \
--volume $HOME/.ssh/installer:/root/.ssh/id_rsa \
--volume /etc/user/:/etc/user/ \
--volume /etc/system/:/etc/system/ \
registry.format.hu/installer-tool
fi;
fi;
shopt -s expand_aliases

View File

@@ -57,14 +57,14 @@ $SUDO_CMD apt-get update && $SUDO_CMD apt-get install -yqq daemonize dbus-user-s
#$SUDO_CMD cp "$self_dir/enter-systemd-namespace" /enter-systemd-namespace
$SUDO_CMD chmod +x /enter-systemd-namespace
$SUDO_CMD tee /etc/$SUDO_CMDers.d/systemd-namespace >/dev/null <<EOF
$SUDO_CMD tee /etc/sudoers.d/systemd-namespace >/dev/null <<EOF
Defaults env_keep += WSLPATH
Defaults env_keep += WSLENV
Defaults env_keep += WSL_INTEROP
Defaults env_keep += WSL_DISTRO_NAME
Defaults env_keep += PRE_NAMESPACE_PATH
Defaults env_keep += PRE_NAMESPACE_PWD
%$SUDO_CMD ALL=(ALL) NOPASSWD: /enter-systemd-namespace
%sudo ALL=(ALL) NOPASSWD: /enter-systemd-namespace
EOF
if ! grep 'start-systemd-namespace' /etc/bash.bashrc >/dev/null; then