From 218b67706b7538143ed2cd3417c3004d48dbd00b Mon Sep 17 00:00:00 2001 From: Alistair Young Date: Thu, 3 Mar 2022 12:06:15 -0600 Subject: [PATCH 01/17] Add tarball build process. --- Makefile | 78 +++++++++++++++++++++++++++++------ binsrc/Makefile | 2 +- debian/rules | 2 +- pending/package/tar/Makefile | 80 ------------------------------------ pending/package/tar/binsrc | 1 - pending/package/tar/othersrc | 1 - 6 files changed, 67 insertions(+), 97 deletions(-) delete mode 100644 pending/package/tar/Makefile delete mode 120000 pending/package/tar/binsrc delete mode 120000 pending/package/tar/othersrc diff --git a/Makefile b/Makefile index 9115467..2b574a5 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,26 @@ # This Makefile builds and packages genie by invoking relevant sub-makefiles. # +# Genie version +GENIEVERSION = 2.2 + +# Determine this makefile's path. +# Be sure to place this BEFORE `include` directives, if any. +THIS_FILE := $(lastword $(MAKEFILE_LIST)) + +# The values of these variables depend upon DESTDIR, set in the recursive call to +# the internal-package target. +INSTALLDIR = $(DESTDIR)/usr/lib/genie +BINDIR = $(DESTDIR)/usr/bin +ETCDIR = $(DESTDIR)/etc +SVCDIR = $(DESTDIR)/usr/lib/systemd/system +USRLIBDIR = $(DESTDIR)/usr/lib + +# used only by TAR installer +ENVGENDIR = $(DESTDIR)/usr/lib/systemd/system-environment-generators +USRENVGENDIR = $(DESTDIR)/usr/lib/systemd/user-environment-generators +MAN8DIR = $(DESTDIR)/usr/share/man/man8 + # # Default target: list options # @@ -17,19 +37,19 @@ default: # # make package # make package-debian - # ? make package-tar + # make package-tar # # Clean up # # make clean (does not clean altpacking by default) # make clean-debian - # ? make clean-tar + # make clean-tar # # Targets: individual end-product build. # -clean: clean-debian +clean: clean-debian clean-tar make -C binsrc clean rm -rf out @@ -41,14 +61,6 @@ package: package-debian # Debian installation locations -DESTDIR=debian/systemd-genie - -INSTALLDIR = $(DESTDIR)/usr/lib/genie -BINDIR = $(DESTDIR)/usr/bin -ETCDIR = $(DESTDIR)/etc -SVCDIR = $(DESTDIR)/usr/lib/systemd/system -USRLIBDIR = $(DESTDIR)/usr/lib - package-debian: make-output-directory mkdir -p out/debian debuild @@ -57,10 +69,31 @@ package-debian: make-output-directory clean-debian: debuild -- clean -# Debian internal functions +package-tar: make-output-directory build-binaries + mkdir -p out/tar + mkdir -p tarball + + fakeroot $(MAKE) -f $(THIS_FILE) DESTDIR=tarball internal-package + + # Do the things that TAR needs that debuild would otherwise do + fakeroot $(MAKE) -f $(THIS_FILE) DESTDIR=tarball internal-tar-supplement + + mv genie-systemd-*.tar.gz out/tar + +clean-tar: + rm -rf tarball + +# Internal packaging functions internal-debian-package: + mkdir -p debian/systemd-genie + @$(MAKE) -f $(THIS_FILE) DESTDIR=debian/systemd-genie internal-package + +# We can assume DESTDIR is set, due to how the following are called. + +internal-package: + # Binaries. mkdir -p "$(BINDIR)" install -Dm 6755 -o root "binsrc/genie-wrapper/genie" -t "$(BINDIR)" @@ -86,9 +119,28 @@ internal-debian-package: # binfmt.d install -Dm 0644 -o root "othersrc/usr-lib/binfmt.d/WSLInterop.conf" -t "$(USRLIBDIR)/binfmt.d" -internal-debian-clean: +internal-clean: make -C binsrc clean +internal-tar-supplement: + # Fixup symbolic links + mkdir -p $(ENVGENDIR) + mkdir -p $(USRENVGENDIR) + ln -s $(INSTALLDIR)/80-genie-envar.sh $(ENVGENDIR)/80-genie-envar.sh + ln -s $(INSTALLDIR)/80-genie-envar.sh $(USRENVGENDIR)/80-genie-envar.sh + + # Man page. + # Make sure directory exists. + mkdir -p "$(MAN8DIR)" + + # this bit would ordinarily be handed by debuild, etc. + cp "othersrc/docs/genie.8" /tmp/genie.8 + gzip -9 "/tmp/genie.8" + install -Dm 0644 -o root "/tmp/genie.8.gz" -t "$(MAN8DIR)" + + # tar it up + tar zcvf genie-systemd-$(GENIEVERSION).tar.gz tarball/* --transform='s/^tarball//' + # # Helpers: intermediate build stages. # diff --git a/binsrc/Makefile b/binsrc/Makefile index 51ae5e2..66cced6 100644 --- a/binsrc/Makefile +++ b/binsrc/Makefile @@ -14,7 +14,7 @@ build-runinwsl: python -m zipapp -o out/runinwsl -p "/usr/bin/env python3" -c runinwsl build-genie: - python -m pip install -r genie/requirements.txt --target genie + python -m pip install -r genie/requirements.txt --target genie --upgrade python -m zipapp -o out/genie -p "/usr/bin/env python3" -c genie # diff --git a/debian/rules b/debian/rules index 289d92b..75006fb 100755 --- a/debian/rules +++ b/debian/rules @@ -17,7 +17,7 @@ override_dh_auto_install: make internal-debian-package override_dh_auto_clean: - make internal-debian-clean + make internal-clean # Allow our setuid executable to pass unfixed. override_dh_fixperms: diff --git a/pending/package/tar/Makefile b/pending/package/tar/Makefile deleted file mode 100644 index 1c1ea3c..0000000 --- a/pending/package/tar/Makefile +++ /dev/null @@ -1,80 +0,0 @@ -# -# Tar archive Makefile. -# - -# Installation locations - -DESTDIR=tarball - -INSTALLDIR = $(DESTDIR)/usr/lib/genie -BINDIR = $(DESTDIR)/usr/bin -ENVGENDIR = $(DESTDIR)/usr/lib/systemd/system-environment-generators -USRENVGENDIR = $(DESTDIR)/usr/lib/systemd/user-environment-generators -ETCDIR = $(DESTDIR)/etc -MAN8DIR = $(DESTDIR)/usr/share/man/man8 -SVCDIR = $(DESTDIR)/usr/lib/systemd/system -USRLIBDIR = $(DESTDIR)/usr/lib - -# -# Default target: package. -# - -package: clean - # Packaging TAR archive. - mkdir -p $(DESTDIR) - - make -C binsrc - - fakeroot make package-inner - - mkdir -p ../../out/tar - mv genie-systemd-*.tar.gz ../../out/tar - -package-inner: - # Inner packager, called from within fakeroot. - - # Binaries. - mkdir -p "$(BINDIR)" - install -Dm 4755 -o root "binsrc/genie/bin/Release/net5.0/linux-x64/publish/genie" -t "$(INSTALLDIR)" - install -Dm 0755 -o root "binsrc/runinwsl/bin/Release/net5.0/linux-x64/publish/runinwsl" -t "$(INSTALLDIR)" - ln -s $(INSTALLDIR)/genie $(BINDIR)/genie - - # Environment generator. - install -Dm 0755 -o root "othersrc/scripts/80-genie-envar.sh" -t "$(INSTALLDIR)" - mkdir -p "$(ENVGENDIR)" - mkdir -p "$(USRENVGENDIR)" - ln -s $(INSTALLDIR)/80-genie-envar.sh $(ENVGENDIR)/80-genie-envar.sh - ln -s $(INSTALLDIR)/80-genie-envar.sh $(USRENVGENDIR)/80-genie-envar.sh - - # Runtime dir mapping - 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)" - - # Configuration file. - install -Dm 0644 -o root "othersrc/etc/genie.ini" -t "$(ETCDIR)" - - # Unit files. - install -Dm 0644 -o root "othersrc/lib-systemd-system/wslg-xwayland.service" -t "$(SVCDIR)" - install -Dm 0644 -o root "othersrc/lib-systemd-system/wslg-xwayland.socket" -t "$(SVCDIR)" - - install -Dm 0644 -o root "othersrc/lib-systemd-system/user-runtime-dir@.service.d/override.conf" -t "$(SVCDIR)/user-runtime-dir@.service.d" - - # binfmt.d - install -Dm 0644 -o root "othersrc/usr-lib/binfmt.d/WSLInterop.conf" -t "$(USRLIBDIR)/binfmt.d" - - # Man page. - # Make sure directory exists. - mkdir -p "$(MAN8DIR)" - - # this bit would ordinarily be handed by debuild, etc. - cp "othersrc/docs/genie.8" /tmp/genie.8 - gzip -9 "/tmp/genie.8" - install -Dm 0644 -o root "/tmp/genie.8.gz" -t "$(MAN8DIR)" - - # tar it up - tar zcvf genie-systemd-`grep VersionPrefix binsrc/genie/genie.csproj | sed 's/.*\(.*\)<\/VersionPrefix>/\1/' | tr -d "\r\n"`.tar.gz tarball/* --transform='s/^tarball//' - -clean: - rm -rf tarball - touch /tmp/genie-fake - rm /tmp/genie* diff --git a/pending/package/tar/binsrc b/pending/package/tar/binsrc deleted file mode 120000 index c5f27eb..0000000 --- a/pending/package/tar/binsrc +++ /dev/null @@ -1 +0,0 @@ -../../binsrc \ No newline at end of file diff --git a/pending/package/tar/othersrc b/pending/package/tar/othersrc deleted file mode 120000 index 142632b..0000000 --- a/pending/package/tar/othersrc +++ /dev/null @@ -1 +0,0 @@ -../../othersrc \ No newline at end of file From dd0027318eb403384bd96122a7ced6141fe565c9 Mon Sep 17 00:00:00 2001 From: Alistair Young Date: Thu, 3 Mar 2022 13:18:49 -0600 Subject: [PATCH 02/17] Implement nsenter fix for Python 10. (#234) --- .gitignore | 3 --- binsrc/genie/requirements.txt | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 890669b..138ecfd 100644 --- a/.gitignore +++ b/.gitignore @@ -5,11 +5,8 @@ out/ # Genie wrapper binsrc/genie-wrapper/genie binsrc/genie/*.dist-info -binsrc/genie/argparse.py binsrc/genie/bin/ -binsrc/genie/contextlib2/ binsrc/genie/nsenter/ -binsrc/genie/pathlib.py binsrc/genie/python_hosts/ binsrc/out diff --git a/binsrc/genie/requirements.txt b/binsrc/genie/requirements.txt index 5bd1337..35ee90e 100644 --- a/binsrc/genie/requirements.txt +++ b/binsrc/genie/requirements.txt @@ -1,3 +1,3 @@ -nsenter>=0.2 +git+https://github.com/zalando/python-nsenter@b7fd78fef24c456d88130c75fe734417728e97e8 python_hosts>=1.0.1 # psutil>=5.9.0 (should be handled by apt package) From 25a4a3a0b9b8bda956d5da506531bd5744121500 Mon Sep 17 00:00:00 2001 From: Alistair Young Date: Thu, 3 Mar 2022 13:20:36 -0600 Subject: [PATCH 03/17] Updated .gitignore --- .gitignore | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 138ecfd..b7b4813 100644 --- a/.gitignore +++ b/.gitignore @@ -4,10 +4,14 @@ out/ # Genie wrapper binsrc/genie-wrapper/genie + +# Genie python modules binsrc/genie/*.dist-info binsrc/genie/bin/ binsrc/genie/nsenter/ binsrc/genie/python_hosts/ + +# Built binaries binsrc/out # Debian build intermediates @@ -20,12 +24,10 @@ debian/systemd-genie.debhelper.log debian/systemd-genie.substvars debian/genie-* -# Arch build intermediates - -package/arch/src/ -package/arch/pkg/ - # Tar build intermediates -package/tar/tarball - +tarball +# Arch build intermediates +# +# package/arch/src/ +# package/arch/pkg/ From 8aad272880655469ec75f3aa8f5d7973493321e5 Mon Sep 17 00:00:00 2001 From: Alistair Young Date: Thu, 3 Mar 2022 13:24:06 -0600 Subject: [PATCH 04/17] Added top-level changelog link. --- CHANGELOG | 1 + debian/changelog | 1 + 2 files changed, 2 insertions(+) create mode 120000 CHANGELOG diff --git a/CHANGELOG b/CHANGELOG new file mode 120000 index 0000000..d526672 --- /dev/null +++ b/CHANGELOG @@ -0,0 +1 @@ +debian/changelog \ No newline at end of file diff --git a/debian/changelog b/debian/changelog index c7d4797..3546a22 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,7 @@ systemd-genie (2.2) buster bullseye bookworm sid focal bionic; urgency=medium * Single-file package python scripts. * Man page fixes. + * Fixed building on Python 3.10. -- Alistair Young Mon, 28 Feb 2022 18:30:00 -0500 From 02645759bc6d00f2078417e39765878f84ca3165 Mon Sep 17 00:00:00 2001 From: Alistair Young Date: Thu, 3 Mar 2022 13:31:36 -0600 Subject: [PATCH 05/17] Fixed missing entry in man page. --- othersrc/docs/genie.8 | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/othersrc/docs/genie.8 b/othersrc/docs/genie.8 index c7ddeac..3d4a7ba 100644 --- a/othersrc/docs/genie.8 +++ b/othersrc/docs/genie.8 @@ -5,6 +5,7 @@ .Nm genie .Nd start up, enter into, or shut down a systemd "bottle" under Windows Subsystem for Linux. + .Sh SYNOPSIS .Nm .Op -h @@ -17,6 +18,7 @@ Subsystem for Linux. .Op -l .Op -c .Ar command... + .Sh DESCRIPTION .Nm provides a means of running @@ -28,14 +30,19 @@ creating a pid and mount namespace, the eponymous poor-man's container within the bottle, and providing helpful shortcuts to start, enter, run commands within, and shut down the bottle. .Pp + .Bl -tag -width "-c ..., --command ..." + .It Fl -h, --help Prints a short help text and exits. + .It Fl -V, --version Prints the installed genie version and exits. + .It Fl v, --verbose Causes any other command to print the details of the operations it is performing as it goes along. Useful mostly for debugging. + .It Fl i, --initialize Sets up the bottle and .Xr systemd 1 @@ -43,6 +50,7 @@ if they are not already initialized, and then exists. This is intended, for use, for example, if you wish to run services without needing a shell, or to preinitialize the bottle to avoid startup delays later. This latter can be used with Task Scheduler, to be run on Windows logon. + .It Fl s, --shell Sets up the bottle and .Xr systemd 1 @@ -54,6 +62,7 @@ installed. .Pp This follows login semantics, and as such does not preserve the current working directory. + .It Fl l, --login Sets up the bottle and .Xr systemd 1 @@ -64,6 +73,18 @@ three times within one second. .Pp This follows login semantics, and as such does not preserve the current working directory. + +.It Fl c, --command +Sets up the bottle and +.Xr systemd 1 +if they are not already initialized, and then runs the specified command within the +bottle. It is intended as the standard way to run arbitrary commands within a +distribution with +.Nm +installed. +.Pp +Unlike the other options, this preserves the current working directory. + .It Fl u, --shutdown Shuts down .Xr systemd 1 @@ -79,6 +100,7 @@ distribution before using again after you have used .Ar genie -u. See BUGS, below, for more details. + .It Fl r, --is-running Checks whether .Nm @@ -97,6 +119,7 @@ and exit code 3 if they are currently transitioning between states; and exit code 4 if there is a problem with systemd services; and .Ar unknown and exit code 5 otherwise. + .It Fl b --is-in-bottle Checks whether the current command is executing inside the bottle. Returns .Ar inside @@ -105,15 +128,21 @@ and exit code 0 if so; returns and exit code 1 if not. If no bottle exists, returns .Ar no-bottle and exit code 2. + .El + .Sh ENVIRONMENT + .Bl -tag -width "INSIDE_GENIE" + .It Ev INSIDE_GENIE INSIDE_GENIE should not be set by the user. .Nm sets INSIDE_GENIE to the string "yes", such that user scripts can detect its presence to determine whether or not they are running inside the bottle. + .El + .Sh EXIT STATUS Other than the special exit codes listed under the .Ar -b @@ -123,8 +152,10 @@ options above, .Nm maintains a policy of returning zero on success, and non-zero when an error occurs. + .Sh FILES .Bl -tag -width "/run/genie.systemd.pid" -compact + .It Pa /etc/genie.ini Configuration file for .Nm @@ -162,20 +193,24 @@ in stub mode; and which can be used to disable the warning if the default target is set to something other than .Ar multi-user.target. + .It Pa /run/genie.env Contains certain environment variables required for proper functioning copied from outside the bottle, used internally by .Nm to restore them within the bottle. + .It Pa /run/genie.hostname Contains the modified hostname used by the WSL distribution (see NOTES). This file is bind mounted over .Ar /etc/hostname when the bottle is started up, and unbound at shutdown. + .It Pa /run/genie.path Contains the system PATH copied from outside the bottle, used internally by .Nm to restore the directories therein within the bottle. + .It Pa /run/genie.systemd.pid Contains the external PID of the systemd(1) instance created by .Nm @@ -183,7 +218,9 @@ Not used by .Nm itself; this PID is recorded as a convenience for the user. No analogous file exists containing the internal PID, for obvious reasons. + .El + .Sh NOTES .Nm can only be used within a WSL 2 distribution, since @@ -203,6 +240,7 @@ Windows host. .Pp The bottle uses pid and mount namespaces. Other namespaces remain shared with the parent (outside bottle). The mount propagation flag is set to shared. + .Sh SEE ALSO .Xr systemctl 1 , .Xr systemd 1 , @@ -210,6 +248,7 @@ the parent (outside bottle). The mount propagation flag is set to shared. .Xr namespaces 7 , .Xr systemd-machined 8 , .Xr systemd-resolved 8 + .Sh BUGS .Nm is not idempotent; i.e., it is possible that changes made by From 391a64586d3287ce744049cd31116156b05f55b5 Mon Sep 17 00:00:00 2001 From: Alistair Young Date: Thu, 3 Mar 2022 15:55:52 -0600 Subject: [PATCH 06/17] Premake binary output directory. --- binsrc/Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/binsrc/Makefile b/binsrc/Makefile index 66cced6..4f60983 100644 --- a/binsrc/Makefile +++ b/binsrc/Makefile @@ -8,12 +8,15 @@ build: build-wrapper build-runinwsl build-genie build-wrapper: + mkdir -p out make -C genie-wrapper build-runinwsl: + mkdir -p out python -m zipapp -o out/runinwsl -p "/usr/bin/env python3" -c runinwsl build-genie: + mkdir -p out python -m pip install -r genie/requirements.txt --target genie --upgrade python -m zipapp -o out/genie -p "/usr/bin/env python3" -c genie From f811b343887b32a1bb955bd0efa99726a556c087 Mon Sep 17 00:00:00 2001 From: Alistair Young Date: Thu, 3 Mar 2022 23:07:02 -0600 Subject: [PATCH 07/17] Removed local install option. --- debian/changelog | 1 + pending/package/local/Makefile | 65 ---------------------------------- pending/package/local/binsrc | 1 - pending/package/local/othersrc | 1 - 4 files changed, 1 insertion(+), 67 deletions(-) delete mode 100644 pending/package/local/Makefile delete mode 120000 pending/package/local/binsrc delete mode 120000 pending/package/local/othersrc diff --git a/debian/changelog b/debian/changelog index 3546a22..dde1f77 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,7 @@ systemd-genie (2.2) buster bullseye bookworm sid focal bionic; urgency=medium * Single-file package python scripts. * Man page fixes. * Fixed building on Python 3.10. + * Dropped the "local" install option (little used; use tarball instead). -- Alistair Young Mon, 28 Feb 2022 18:30:00 -0500 diff --git a/pending/package/local/Makefile b/pending/package/local/Makefile deleted file mode 100644 index df5d49d..0000000 --- a/pending/package/local/Makefile +++ /dev/null @@ -1,65 +0,0 @@ -# -# Local installation Makefile. -# - -# Installation locations. -INSTALLDIR = /usr/local/lib/genie -BINDIR = /usr/local/bin -ENVGENDIR = /usr/lib/systemd/system-environment-generators -USRENVGENDIR = /usr/lib/systemd/user-environment-generators -ETCDIR = /etc -MAN8DIR = /usr/local/share/man/man8 -SVCDIR = /etc/systemd/system -USRLIBDIR = /usr/lib - -# -# Default target: package. -# - -package: - # Installing locally. - make -C binsrc build-local - - # Just put the bits in the right places. - mkdir -p "$(BINDIR)" - - # Binaries. - install -Dm 4755 -o root "binsrc/genie/bin/ReleaseLocal/net5.0/linux-x64/publish/genie" -t "$(INSTALLDIR)" - install -Dm 0755 -o root "binsrc/runinwsl/bin/Release/net5.0/linux-x64/publish/runinwsl" -t "$(INSTALLDIR)" - ln -s $(INSTALLDIR)/genie $(BINDIR)/genie - - # Environment generator. - install -Dm 0755 -o root "othersrc/scripts/80-genie-envar.sh" -t "$(INSTALLDIR)" - ln -s $(INSTALLDIR)/80-genie-envar.sh $(ENVGENDIR)/80-genie-envar.sh - ln -s $(INSTALLDIR)/80-genie-envar.sh $(USRENVGENDIR)/80-genie-envar.sh - - # Runtime dir mapping - 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)" - - # Configuration file. - install -Dm 0644 -o root "othersrc/etc/genie.ini" -t "$(ETCDIR)" - - # Unit files. - install -Dm 0644 -o root "othersrc/lib-systemd-system/wslg-xwayland.service" -t "$(SVCDIR)" - install -Dm 0644 -o root "othersrc/lib-systemd-system/wslg-xwayland.socket" -t "$(SVCDIR)" - - install -Dm 0644 -o root "othersrc/lib-systemd-system/user-runtime-dir@.service.d/override.conf" -t "$(SVCDIR)/user-runtime-dir@.service.d" - - # binfmt.d - install -Dm 0644 -o root "othersrc/usr-lib/binfmt.d/WSLInterop.conf" -t "$(USRLIBDIR)/binfmt.d" - - # enable units - ln -s $(SVCDIR)/wslg-xwayland.socket $(SVCDIR)/sockets.target.wants/wslg-xwayland.socket - - # Man page. - # Make sure directory exists. - mkdir -p "$(MAN8DIR)" - - # this bit would ordinarily be handed by debuild, etc. - cp "othersrc/docs/genie.8" /tmp/genie.8 - gzip -9 "/tmp/genie.8" - install -Dm 0644 -o root "/tmp/genie.8.gz" -t "$(MAN8DIR)" - -clean: - # Nothing to clean in a local installation. diff --git a/pending/package/local/binsrc b/pending/package/local/binsrc deleted file mode 120000 index c5f27eb..0000000 --- a/pending/package/local/binsrc +++ /dev/null @@ -1 +0,0 @@ -../../binsrc \ No newline at end of file diff --git a/pending/package/local/othersrc b/pending/package/local/othersrc deleted file mode 120000 index 142632b..0000000 --- a/pending/package/local/othersrc +++ /dev/null @@ -1 +0,0 @@ -../../othersrc \ No newline at end of file From 379869a8d1e1c3c4835b457071b64d3ccf4a3bfd Mon Sep 17 00:00:00 2001 From: Alistair Young Date: Thu, 3 Mar 2022 23:10:12 -0600 Subject: [PATCH 08/17] Updated readme. --- othersrc/docs/readme.md | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/othersrc/docs/readme.md b/othersrc/docs/readme.md index fd3ab90..dd952d0 100644 --- a/othersrc/docs/readme.md +++ b/othersrc/docs/readme.md @@ -60,11 +60,13 @@ An Arch package (.zst) can be downloaded from the releases, to right. Install it A Fedora package (.rpm) can be downloaded from the releases, to right. Install it manually, using `dnf install `. +--> + ### Other Distros If your distribution supports any of the package formats available, you may wish to try downloading the relevant format and giving it a try. This will almost certainly need some tweaking to work properly. -Debian is the "native" distribution for _genie_ , for which read, "what the author uses". Specifically, Debian stretch+, with _usrmerge_ installed. If you're using anything else, you may need to tweak the configuration file (see below) accordingly. +Debian is the "native" distribution for _genie_ , for which read, "what the author uses". Specifically, Debian buster+, with _usrmerge_ installed. If you're using anything else, you may need to tweak the configuration file (see below) accordingly. #### TAR @@ -78,26 +80,6 @@ We're actively looking for maintainers for everything that doesn't have a specif _I am unable to support distributions which there are not prebuilt packages for. I am actively seeking maintainers for these packages._ -### ...OR BUILD IT YOURSELF - -It is possible to build your own version of genie and install it locally. To do so, you will require _build-essential_ and _dotnet-sdk-5.0_ in addition to the other dependencies, all of which must be installed manually. - -After cloning the repository, run - -``` -sudo make install-local -``` - -This will build genie and install it under _/usr/local_ . - -After installing locally and starting genie and systemd for the first time, you will need to enable the _wslg-xwayland.socket_ systemd units manually: - -``` -systemctl enable wslg-xwayland.socket -``` - ---> - ## CONFIGURATION FILE That would be the file _/etc/genie.ini_. This defines the secure path (i.e., those directories in which genie will look for the utilities it depends on; make sure _unshare_, in particular, is available here), and seven settings controlling genie behavior. Normally, it looks like this: From cf4f0a7dc3f85fc6d6c05fdabdb21485a15201f1 Mon Sep 17 00:00:00 2001 From: Alistair Young Date: Fri, 4 Mar 2022 10:34:32 -0600 Subject: [PATCH 09/17] Arch pkgbuild/makefile updates. --- Makefile | 33 ++++++++++++++++++++++++++------- PKGBUILD | 33 +++++++++++++++++++++++++++++++++ pending/package/arch/PKGBUILD | 13 +++---------- 3 files changed, 62 insertions(+), 17 deletions(-) create mode 100644 PKGBUILD diff --git a/Makefile b/Makefile index 2b574a5..4b53f27 100644 --- a/Makefile +++ b/Makefile @@ -33,23 +33,25 @@ default: # # make build-binaries # - # Package (native) + # Package # # make package # make package-debian # make package-tar + # make package-arch (requires Arch packaging environment) # # Clean up # - # make clean (does not clean altpacking by default) + # make clean # make clean-debian # make clean-tar + # make clean-arch # # Targets: individual end-product build. # -clean: clean-debian clean-tar +clean: clean-debian clean-tar clean-arch make -C binsrc clean rm -rf out @@ -59,8 +61,6 @@ package: package-debian # Debian packaging # -# Debian installation locations - package-debian: make-output-directory mkdir -p out/debian debuild @@ -76,13 +76,31 @@ package-tar: make-output-directory build-binaries fakeroot $(MAKE) -f $(THIS_FILE) DESTDIR=tarball internal-package # Do the things that TAR needs that debuild would otherwise do - fakeroot $(MAKE) -f $(THIS_FILE) DESTDIR=tarball internal-tar-supplement + fakeroot $(MAKE) -f $(THIS_FILE) DESTDIR=tarball internal-supplement + fakeroot $(MAKE) -f $(THIS_FILE) DESTDIR=tarball internal-tar mv genie-systemd-*.tar.gz out/tar clean-tar: rm -rf tarball +package-arch: + updpkgsums + makepkg + +clean-arch: + +package: + # Packaging for Arch. + updpkgsums + makepkg + mkdir -p ../../out/arch + mv genie* ../../out/arch + +clean: + rm -rf src + rm -rf pkg + # Internal packaging functions internal-debian-package: @@ -122,7 +140,7 @@ internal-package: internal-clean: make -C binsrc clean -internal-tar-supplement: +internal-supplement: # Fixup symbolic links mkdir -p $(ENVGENDIR) mkdir -p $(USRENVGENDIR) @@ -138,6 +156,7 @@ internal-tar-supplement: gzip -9 "/tmp/genie.8" install -Dm 0644 -o root "/tmp/genie.8.gz" -t "$(MAN8DIR)" +internal-tar: # tar it up tar zcvf genie-systemd-$(GENIEVERSION).tar.gz tarball/* --transform='s/^tarball//' diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000..91d6992 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,33 @@ +# Maintainer: Ong Yong Xin +# Contributor: Xuanrui Qi +# Contributor: Rayfalling +# Contributor: facekapow, rayfalling, Ducksoft +_pkgname=genie +pkgname=${_pkgname}-systemd +pkgver=2.1.r15.g379869a +pkgrel=1 +pkgdesc="A quick way into a systemd \"bottle\" for WSL" +arch=('x86_64') +url="https://github.com/arkane-systems/genie" +license=('Unlicense') +depends=('daemonize' 'python' 'python-psutil' 'systemd') +makedepends=('git' 'python-pip') +options=(!strip) +source=("git+https://github.com/arkane-systems/genie.git#branch=dev-2.2") +sha256sums=('SKIP') +backup=('etc/genie.ini') + +# pkgver() { +# git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/^v//g' +#} + +build() { + cd genie + make build-binaries +} + +package() { + cd genie + make DESTDIR=${pkgdir} internal-package + make DESTDIR=${pkgdir} internal-supplement +} diff --git a/pending/package/arch/PKGBUILD b/pending/package/arch/PKGBUILD index d4fef5c..123b409 100644 --- a/pending/package/arch/PKGBUILD +++ b/pending/package/arch/PKGBUILD @@ -2,16 +2,9 @@ # Maintainer: Xuanrui Qi # Contributor: Rayfalling # Contributor: facekapow, rayfalling, Ducksoft -_pkgname=genie -pkgname=${_pkgname}-systemd -pkgver=1.45 -pkgrel=2 -pkgdesc="A quick way into a systemd \"bottle\" for WSL" -arch=('x86_64') -url="https://github.com/arkane-systems/genie" -license=('Unlicense') -depends=('daemonize' 'dotnet-runtime=5.0' 'dotnet-host=5.0') -makedepends=('dotnet-sdk=5.0') + + + source=(${_pkgname}-${pkgver}.tar.gz::https://github.com/arkane-systems/${_pkgname}/archive/refs/tags/v${pkgver}.tar.gz) sha256sums=('SKIP') backup=('etc/genie.ini') From e16e68a5b78c9ff65bcc344e37dc2343647c1ae8 Mon Sep 17 00:00:00 2001 From: Alistair Young Date: Fri, 4 Mar 2022 10:54:09 -0600 Subject: [PATCH 10/17] Arch pkgbuild/makefile updates. --- Makefile | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 4b53f27..6238ed7 100644 --- a/Makefile +++ b/Makefile @@ -85,21 +85,14 @@ clean-tar: rm -rf tarball package-arch: + # echo $(PWD) + mkdir -p out/arch updpkgsums - makepkg + BUILDDIR=/tmp PKDEST=$(PWD)/out/arch makepkg + rm -rf $(PWD)/genie clean-arch: - -package: - # Packaging for Arch. - updpkgsums - makepkg - mkdir -p ../../out/arch - mv genie* ../../out/arch - -clean: - rm -rf src - rm -rf pkg + rm -rf out/arch # Internal packaging functions From 2b82e8886b57b27628de2e79265db8101b757d0d Mon Sep 17 00:00:00 2001 From: Alistair Young Date: Fri, 4 Mar 2022 11:18:27 -0600 Subject: [PATCH 11/17] Arch pkgbuild/makefile updates. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 6238ed7..855fc72 100644 --- a/Makefile +++ b/Makefile @@ -85,11 +85,11 @@ clean-tar: rm -rf tarball package-arch: - # echo $(PWD) mkdir -p out/arch updpkgsums BUILDDIR=/tmp PKDEST=$(PWD)/out/arch makepkg rm -rf $(PWD)/genie + mv *.zst out/arch clean-arch: rm -rf out/arch From c0cb1a9d9a9ad0bcfe26230d968afaaf6d1c59cb Mon Sep 17 00:00:00 2001 From: Alistair Young Date: Fri, 4 Mar 2022 11:22:52 -0600 Subject: [PATCH 12/17] Final update: Arch packaging. --- PKGBUILD | 2 +- othersrc/docs/readme.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/PKGBUILD b/PKGBUILD index 91d6992..914b7d1 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -13,7 +13,7 @@ license=('Unlicense') depends=('daemonize' 'python' 'python-psutil' 'systemd') makedepends=('git' 'python-pip') options=(!strip) -source=("git+https://github.com/arkane-systems/genie.git#branch=dev-2.2") +source=("git+https://github.com/arkane-systems/genie.git") sha256sums=('SKIP') backup=('etc/genie.ini') diff --git a/othersrc/docs/readme.md b/othersrc/docs/readme.md index dd952d0..ae21751 100644 --- a/othersrc/docs/readme.md +++ b/othersrc/docs/readme.md @@ -50,12 +50,12 @@ sudo apt install -y systemd-genie Use the above Debian package. For current Ubuntu releases and the timing-out problem, see the problematic units listed on [the genie wiki](https://github.com/arkane-systems/genie/wiki). - - ### Other Distros If your distribution supports any of the package formats available, you may wish to try downloading the relevant format and giving it a try. This will almost certainly need some tweaking to work properly.