From 857f28b5e333957d0cd758c61740b8207c7aa655 Mon Sep 17 00:00:00 2001 From: Alistair Young Date: Tue, 27 Sep 2022 22:56:24 -0500 Subject: [PATCH 1/6] Bumped version to 0.7. --- PKGBUILD | 2 +- binsrc/imp/__main__.py | 2 +- debian/changelog | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) 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/changelog b/debian/changelog index d41f8a7..47abec3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +bottle-imp (0.7) buster bullseye bookworm sid focal jammy; urgency=medium + + * bump + + -- 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. From e9fe7502832fdfc53c6e00a4e9bce151e312fb63 Mon Sep 17 00:00:00 2001 From: Alistair Young Date: Tue, 27 Sep 2022 23:01:30 -0500 Subject: [PATCH 2/6] Bumped version to 0.7 (Makefile). --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 1f7bdc4..251f074 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. From c16945113f33792b3f3d6d9c6b01efbf060d3a73 Mon Sep 17 00:00:00 2001 From: Alistair Young Date: Wed, 28 Sep 2022 08:41:09 -0500 Subject: [PATCH 3/6] Use existing systemd tmpfiles. --- debian/changelog | 2 +- othersrc/usr-lib/tmpfiles.d/bottle-imp.conf | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/debian/changelog b/debian/changelog index 47abec3..8db6085 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,6 @@ bottle-imp (0.7) buster bullseye bookworm sid focal jammy; urgency=medium - * bump + * Replace the tmpfiles entries with tmp.conf/x11.conf exactly. -- Alistair Young Tue, 27 Sep 2022 23:00:01 -0500 diff --git a/othersrc/usr-lib/tmpfiles.d/bottle-imp.conf b/othersrc/usr-lib/tmpfiles.d/bottle-imp.conf index 201d70b..1761358 100644 --- a/othersrc/usr-lib/tmpfiles.d/bottle-imp.conf +++ b/othersrc/usr-lib/tmpfiles.d/bottle-imp.conf @@ -3,13 +3,18 @@ # See tmpfiles.d(5) for details -# Recreate the mount point for the X11 socket. -d! /tmp/.X11-unix 1777 root root - +# 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 /tmp 1777 root root 10d +q /var/tmp 1777 root root 30d # Replace these from x11.conf ## Make sure these are created by default so that nobody else can ## or empty them at startup +D! /tmp/.X11-unix 1777 root root 10d D! /tmp/.ICE-unix 1777 root root 10d D! /tmp/.XIM-unix 1777 root root 10d D! /tmp/.font-unix 1777 root root 10d @@ -17,7 +22,3 @@ 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 From fff3582b95026c850b3eeda63ef50b7816fc7d3d Mon Sep 17 00:00:00 2001 From: Alistair Young Date: Wed, 28 Sep 2022 20:09:19 -0500 Subject: [PATCH 4/6] 0.68.2 - remove tmpfiles config. --- othersrc/usr-lib/tmpfiles.d/bottle-imp.conf | 24 --------------------- 1 file changed, 24 deletions(-) delete mode 100644 othersrc/usr-lib/tmpfiles.d/bottle-imp.conf 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 1761358..0000000 --- a/othersrc/usr-lib/tmpfiles.d/bottle-imp.conf +++ /dev/null @@ -1,24 +0,0 @@ -# This file is part of bottle-imp. -# - -# See tmpfiles.d(5) for details - -# 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 /tmp 1777 root root 10d -q /var/tmp 1777 root root 30d - -# Replace these from x11.conf - -## Make sure these are created by default so that nobody else can -## or empty them at startup -D! /tmp/.X11-unix 1777 root root 10d -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 - From c7050122771e8f6183ad4e7393b99162ccb30a25 Mon Sep 17 00:00:00 2001 From: Alistair Young Date: Thu, 29 Sep 2022 01:02:21 -0500 Subject: [PATCH 5/6] revisions for 0.68.2 --- Makefile | 9 ++------- debian/bottle-imp.links | 2 +- debian/changelog | 4 +++- othersrc/scripts/map-user-runtime-dir.sh | 16 ---------------- othersrc/scripts/unmap-user-runtime-dir.sh | 15 --------------- .../systemd/system/tmp-.X11\\x2dunix.mount" | 17 ----------------- .../user-runtime-dir@.service.d/override.conf | 11 ++--------- .../usr-lib/systemd/system/wslg-socket.service | 15 +++++++++++++++ 8 files changed, 23 insertions(+), 66 deletions(-) delete mode 100644 othersrc/scripts/map-user-runtime-dir.sh delete mode 100644 othersrc/scripts/unmap-user-runtime-dir.sh delete mode 100644 "othersrc/usr-lib/systemd/system/tmp-.X11\\x2dunix.mount" create mode 100644 othersrc/usr-lib/systemd/system/wslg-socket.service diff --git a/Makefile b/Makefile index 251f074..7adc760 100644 --- a/Makefile +++ b/Makefile @@ -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,7 +209,7 @@ 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 + ln -sr $(SVCDIR)/wslg-socket.service $(ETCSVCDIR)/multi-user.target.wants/wslg-socket.service mkdir -p "$(ETCSVCDIR)/multi-user.target.wants" ln -sr $(SVCDIR)/systemd-machined.service $(ETCSVCDIR)/multi-user.target.wants/systemd-machined.service 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 8db6085..8a95a31 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,8 @@ bottle-imp (0.7) buster bullseye bookworm sid focal jammy; urgency=medium - * Replace the tmpfiles entries with tmp.conf/x11.conf exactly. + * 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 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 From e814cd80f08ad4316120556261648db2e0677e3e Mon Sep 17 00:00:00 2001 From: Alistair Young Date: Thu, 29 Sep 2022 01:19:01 -0500 Subject: [PATCH 6/6] Fix tarball build order error. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7adc760..e4eea2b 100644 --- a/Makefile +++ b/Makefile @@ -209,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)/wslg-socket.service $(ETCSVCDIR)/multi-user.target.wants/wslg-socket.service 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