unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#59132] [PATCH] system: images: wsl2: Create $XDG_RUNTIME_DIR on first login.
@ 2022-11-08 20:05 dan
  2022-11-08 20:11 ` ( via Guix-patches via
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: dan @ 2022-11-08 20:05 UTC (permalink / raw)
  To: 59132

* gnu/system/images/wsl2.scm (wsl-boot-program): Create $XDG_RUNTIME_DIR on
first login.

copyright info
---
 gnu/system/images/wsl2.scm | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/gnu/system/images/wsl2.scm b/gnu/system/images/wsl2.scm
index 80c2e775b4..e3e7503da3 100644
--- a/gnu/system/images/wsl2.scm
+++ b/gnu/system/images/wsl2.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2022 Alex Griffin <a@ajgrf.com>
 ;;; Copyright © 2022 Mathieu Othacehe <othacehe@gnu.org>
+;;; Copyright © 2022 dan <i@dan.games>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -75,7 +76,11 @@ (define (wsl-boot-program user)
          (let* ((pw (getpw #$user))
                 (shell (passwd:shell pw))
                 (sudo #+(file-append sudo "/bin/sudo"))
-                (args (cdr (command-line))))
+                (args (cdr (command-line)))
+                (uid (passwd:uid pw))
+                (gid (passwd:gid pw))
+                (runtime-dir (string-append "/run/user/"
+                                            (number->string uid))))
            ;; Save the value of $PATH set by WSL.  Useful for finding
            ;; Windows binaries to run with WSL's binfmt interop.
            (setenv "WSLPATH" (getenv "PATH"))
@@ -88,6 +93,11 @@ (define (wsl-boot-program user)
                   MS_REMOUNT
                   #:update-mtab? #f)
 
+           ;; create XDG_RUNTIME_DIR for the login user
+           (unless (file-exists? runtime-dir)
+             (mkdir runtime-dir)
+             (chown runtime-dir uid gid))
+
            ;; Start login shell as user.
            (apply execl sudo "sudo"
                   "--preserve-env=WSLPATH"

base-commit: 96ae718c516a289124a0b91ceeef78b20d187825
-- 
2.38.0





^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-12-26  8:37 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-08 20:05 [bug#59132] [PATCH] system: images: wsl2: Create $XDG_RUNTIME_DIR on first login dan
2022-11-08 20:11 ` ( via Guix-patches via
2022-11-08 20:23   ` dan
2022-11-08 20:27     ` ( via Guix-patches via
2022-11-09  4:26       ` dan
2022-11-09  7:24       ` dan
2022-11-08 20:27     ` ( via Guix-patches via
2022-11-09 12:26 ` Tobias Geerinckx-Rice via Guix-patches via
2022-11-09 13:48   ` dan
2022-11-18 14:00     ` Ludovic Courtès
2022-12-26  8:36 ` bug#59132: " Mathieu Othacehe

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).