From a54ddbf070846f5ddcb333e1578866653368acf4 Mon Sep 17 00:00:00 2001 From: Fubuchi Date: Sat, 6 Aug 2022 05:49:35 +0530 Subject: [PATCH] Allow systemd and wslg to co-exist --- Makefile | 1 + bash_profile | 2 ++ wslg-init.service | 11 +++++++++++ 3 files changed, 14 insertions(+) create mode 100644 wslg-init.service diff --git a/Makefile b/Makefile index 5ac4f78..318b98b 100644 --- a/Makefile +++ b/Makefile @@ -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: diff --git a/bash_profile b/bash_profile index 8b77ab6..8374cb0 100644 --- a/bash_profile +++ b/bash_profile @@ -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 diff --git a/wslg-init.service b/wslg-init.service new file mode 100644 index 0000000..13c1a8c --- /dev/null +++ b/wslg-init.service @@ -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