diff --git a/Makefile b/Makefile index 1f7bdc4..e4eea2b 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ # # Bottle-Imp version -IMPVERSION = 0.5 +IMPVERSION = 0.7 # Determine this makefile's path. # Be sure to place this BEFORE `include` directives, if any. @@ -163,18 +163,13 @@ internal-package: # Runtime dir mapping install -Dm 0755 -o root "othersrc/scripts/wait-forever.sh" -t "$(INSTALLDIR)" - install -Dm 0755 -o root "othersrc/scripts/map-user-runtime-dir.sh" -t "$(INSTALLDIR)" - install -Dm 0755 -o root "othersrc/scripts/unmap-user-runtime-dir.sh" -t "$(INSTALLDIR)" # Systemd services. install -Dm 0644 -o root "othersrc/usr-lib/systemd/system/pstorefs.service" -T "$(SVCDIR)/pstorefs.service" install -Dm 0644 -o root "othersrc/usr-lib/systemd/system/securityfs.service" -T "$(SVCDIR)/securityfs.service" # WSLg mount file - install -Dm 0644 -o root "othersrc/usr-lib/systemd/system/tmp-.X11\x2dunix.mount" -T "$(SVCDIR)/tmp-.X11\x2dunix.mount" - - # Tmpfiles. - install -Dm 0644 -o root "othersrc/usr-lib/tmpfiles.d/bottle-imp.conf" -T "$(USRLIBDIR)/tmpfiles.d/bottle-imp.conf" + install -Dm 0644 -o root "othersrc/usr-lib/systemd/system/wslg-socket.service" -T "$(SVCDIR)/wslg-socket.service" # Unit override files. install -Dm 0644 -o root "othersrc/usr-lib/systemd/system/user-runtime-dir@.service.d/override.conf" -t "$(SVCDIR)/user-runtime-dir@.service.d" @@ -214,9 +209,9 @@ internal-supplement: mkdir -p "$(ETCSVCDIR)/sysinit.target.wants" ln -sr $(SVCDIR)/pstorefs.service $(ETCSVCDIR)/sysinit.target.wants/pstorefs.service ln -sr $(SVCDIR)/securityfs.service $(ETCSVCDIR)/sysinit.target.wants/securityfs.service - ln -sr $(SVCDIR)/tmp-.X11\x2dunix.mount $(ETCSVCDIR)/sysinit.target.wants/tmp-.X11\x2dunix.mount mkdir -p "$(ETCSVCDIR)/multi-user.target.wants" + ln -sr $(SVCDIR)/wslg-socket.service $(ETCSVCDIR)/multi-user.target.wants/wslg-socket.service ln -sr $(SVCDIR)/systemd-machined.service $(ETCSVCDIR)/multi-user.target.wants/systemd-machined.service # Cleanup temporary directory diff --git a/PKGBUILD b/PKGBUILD index 5009f8f..a879354 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,6 +1,6 @@ # Maintainer: Alistair Young pkgname=bottle-imp -pkgver=0.6 +pkgver=0.7 pkgrel=1 pkgdesc="A helper for WSL's native systemd support." arch=('x86_64') diff --git a/binsrc/imp/__main__.py b/binsrc/imp/__main__.py index edb455a..70e466d 100644 --- a/binsrc/imp/__main__.py +++ b/binsrc/imp/__main__.py @@ -10,7 +10,7 @@ import helpers # Global variables -version = "0.6" +version = "0.7" verbose = False login = None diff --git a/debian/bottle-imp.links b/debian/bottle-imp.links index 2c114d2..8f20c8b 100644 --- a/debian/bottle-imp.links +++ b/debian/bottle-imp.links @@ -1,4 +1,4 @@ /usr/lib/systemd/system/systemd-machined.service /etc/systemd/system/multi-user.target.wants/systemd-machined.service /usr/lib/systemd/system/pstorefs.service /etc/systemd/system/sysinit.target.wants/pstorefs.service /usr/lib/systemd/system/securityfs.service /etc/systemd/system/sysinit.target.wants/securityfs.service -/usr/lib/systemd/system/tmp-.X11\x2dunix.mount /etc/systemd/system/sysinit.target.wants/tmp-.X11\x2dunix.mount +/usr/lib/systemd/system/wslg-socket.service /etc/systemd/system/multi-user.target.wants/wslg-socket.service diff --git a/debian/changelog b/debian/changelog index d41f8a7..8a95a31 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +bottle-imp (0.7) buster bullseye bookworm sid focal jammy; urgency=medium + + * 0.68.2 - remove the tmpfiles config. + * 0.68.2 - user runtime directory handling adapted to pre-mapping. + * 0.68.2 - modified .X11-unix mounting routine. + + -- Alistair Young Tue, 27 Sep 2022 23:00:01 -0500 + bottle-imp (0.6) buster bullseye bookworm sid focal jammy; urgency=medium * Additions to tmpfiles for things disabled by systemd support. diff --git a/othersrc/scripts/map-user-runtime-dir.sh b/othersrc/scripts/map-user-runtime-dir.sh deleted file mode 100644 index 517097f..0000000 --- a/othersrc/scripts/map-user-runtime-dir.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -if [ ! -d /mnt/wslg/runtime-dir ] -then - # WSLg is not present, so do nothing over-and-above previous - exit -fi - -WUID=$(stat -c "%u" /mnt/wslg/runtime-dir) - -if [ $1 -eq $WUID ] -then - # We are the WSLg user, so map the runtime-dir - mount --bind /mnt/wslg/runtime-dir /run/user/$1 - exit -fi - diff --git a/othersrc/scripts/unmap-user-runtime-dir.sh b/othersrc/scripts/unmap-user-runtime-dir.sh deleted file mode 100644 index 475814f..0000000 --- a/othersrc/scripts/unmap-user-runtime-dir.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -if [ ! -d /mnt/wslg/runtime-dir ] -then - # WSLg is not present, so do nothing over-and-above previous - exit -fi - -WUID=$(stat -c "%u" /mnt/wslg/runtime-dir) - -if [ $1 -eq $WUID ] -then - # We are the WSLg user, so unmap the runtime-dir - umount /run/user/$1 - exit -fi diff --git "a/othersrc/usr-lib/systemd/system/tmp-.X11\\x2dunix.mount" "b/othersrc/usr-lib/systemd/system/tmp-.X11\\x2dunix.mount" deleted file mode 100644 index 1740d12..0000000 --- "a/othersrc/usr-lib/systemd/system/tmp-.X11\\x2dunix.mount" +++ /dev/null @@ -1,17 +0,0 @@ -[Unit] -Description=WSLg Remount Service (bottle-imp) -DefaultDependencies=no -After=systemd-tmpfiles-setup.service -Before=sysinit.target -ConditionPathExists=/tmp/.X11-unix -ConditionPathIsMountPoint=!/tmp/.X11-unix -ConditionPathExists=/mnt/wslg/.X11-unix - -[Mount] -What=/mnt/wslg/.X11-unix -Where=/tmp/.X11-unix -Type=none -Options=bind,ro - -[Install] -WantedBy=sysinit.target diff --git a/othersrc/usr-lib/systemd/system/user-runtime-dir@.service.d/override.conf b/othersrc/usr-lib/systemd/system/user-runtime-dir@.service.d/override.conf index a8926f0..95eaa32 100644 --- a/othersrc/usr-lib/systemd/system/user-runtime-dir@.service.d/override.conf +++ b/othersrc/usr-lib/systemd/system/user-runtime-dir@.service.d/override.conf @@ -1,9 +1,2 @@ -[Service] -[Service] -ExecStart= -ExecStart=/lib/systemd/systemd-user-runtime-dir start %i -ExecStart=/usr/lib/bottle-imp/map-user-runtime-dir.sh %i -ExecStop= -ExecStop=/usr/lib/bottle-imp/unmap-user-runtime-dir.sh %i -ExecStop=/lib/systemd/systemd-user-runtime-dir stop %i - +[Unit] +ConditionPathIsMountPoint=!/run/user/%i diff --git a/othersrc/usr-lib/systemd/system/wslg-socket.service b/othersrc/usr-lib/systemd/system/wslg-socket.service new file mode 100644 index 0000000..3546906 --- /dev/null +++ b/othersrc/usr-lib/systemd/system/wslg-socket.service @@ -0,0 +1,15 @@ +[Unit] +Description=WSLg socket remount service +After=tmp.mount +After=systemd-tmpfiles.setup.service +Before=multi-user.target +ConditionPathExists=/tmp/.X11-unix +ConditionPathIsMountPoint=!/tmp/.X11-unix +ConditionPathExists=/mnt/wslg/.X11-unix + +[Service] +Type=oneshot +ExecStart=/bin/mount --bind -o ro /mnt/wslg/.X11-unix /tmp/.X11-unix + +[Install] +WantedBy=multi-user.target diff --git a/othersrc/usr-lib/tmpfiles.d/bottle-imp.conf b/othersrc/usr-lib/tmpfiles.d/bottle-imp.conf deleted file mode 100644 index 201d70b..0000000 --- a/othersrc/usr-lib/tmpfiles.d/bottle-imp.conf +++ /dev/null @@ -1,23 +0,0 @@ -# This file is part of bottle-imp. -# - -# See tmpfiles.d(5) for details - -# Recreate the mount point for the X11 socket. -d! /tmp/.X11-unix 1777 root root - - -# Replace these from x11.conf - -## Make sure these are created by default so that nobody else can -## or empty them at startup -D! /tmp/.ICE-unix 1777 root root 10d -D! /tmp/.XIM-unix 1777 root root 10d -D! /tmp/.font-unix 1777 root root 10d - -## Unlink the X11 lock files -r! /tmp/.X[0-9]*-lock - -# Replace these from tmp.conf -# We don't need to clear /tmp, as it's already a fresh tmpfs -# We should clear /var/tmp, though. -q /var/tmp 1777 root root 30d