Skip to content

Commit

Permalink
Allow systemd and wslg to co-exist
Browse files Browse the repository at this point in the history
  • Loading branch information
Fubuchi authored and sileshn committed Dec 16, 2024
1 parent 2bdabba commit af2ceba
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ rootfs: base.tar
sudo cp wsl.conf rootfs/etc/wsl.conf
sudo cp -f setcap-iputils.hook rootfs/etc/pacman.d/hooks/50-setcap-iputils.hook
sudo cp bash_profile rootfs/root/.bash_profile
sudo cp wslg-init.service rootfs/usr/lib/systemd/system/wslg-init.service
sudo chmod +x rootfs

base.tar:
Expand Down
4 changes: 3 additions & 1 deletion bash_profile
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ setcap cap_net_raw+p /usr/sbin/ping
sed -i '/PS1/d' /etc/skel/.bashrc
echo "PS1='\[\033[01;32m\][\u@\h\[\033[01;37m\] \W\[\033[01;32m\]]\$\[\033[00m\] '" | tee -a /etc/skel/.bashrc >/dev/null 2>&1
echo 'export BROWSER="wslview"' | tee -a /etc/skel/.bashrc >/dev/null 2>&1
sudo systemctl daemon-reload
sudo systemctl enable wslg-init.service >/dev/null 2>&1

echo -e ${grn}"Do you want to create a new user?"${txtrst}
select yn in "Yes" "No"; do
Expand Down Expand Up @@ -208,4 +210,4 @@ done

rm ~/.bash_profile
powershell.exe -command "Start-Process -Verb Open -FilePath 'shutdown.cmd' -WorkingDirectory 'C:\Users\Public' -WindowStyle Hidden"
exec sleep 0
exec sleep 0
11 changes: 11 additions & 0 deletions wslg-init.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Unit]
Description=symlink /tmp/.X11-unix
After=systemd-tmpfiles-setup.service

[Service]
Type=oneshot
ExecStart=rmdir /tmp/.X11-unix
ExecStart=ln -s /mnt/wslg/.X11-unix /tmp/

[Install]
WantedBy=sysinit.target

0 comments on commit af2ceba

Please sign in to comment.