summary refs log tree commit diff
diff options
context:
space:
mode:
authorJanneke Nieuwenhuizen <janneke@gnu.org>2023-05-30 18:08:38 +0200
committerJan (janneke) Nieuwenhuizen <janneke@gnu.org>2024-11-11 07:28:33 +0100
commitf2cefd700d6fb6ee26a9289b8194524062d2778f (patch)
tree52f35fd5f02f1aabc32b3a3cad211eab4180f25b
parentb25d2ad5c7bba8c2818ea269b0549ef5ce10823a (diff)
downloadguix-f2cefd700d6fb6ee26a9289b8194524062d2778f.tar.gz
hurd-boot: Support second boot.
* gnu/build/hurd-boot.scm (boot-hurd-system): Check for stale shepherd socket
and remove it.  Be chattier about /hurd symlink replacement.

Change-Id: I5e528c131ebeadb7ebc9727336a0f9301af3e68e
-rw-r--r--gnu/build/hurd-boot.scm21
1 files changed, 16 insertions, 5 deletions
diff --git a/gnu/build/hurd-boot.scm b/gnu/build/hurd-boot.scm
index daf4fb41ab..23ace25d4f 100644
--- a/gnu/build/hurd-boot.scm
+++ b/gnu/build/hurd-boot.scm
@@ -322,18 +322,29 @@ XXX TODO: use Linux xattr/setxattr to remove (settrans in) /libexec/RUNSYSTEM
 
      (let* ((args    (command-line))
             (system  (find-long-option "gnu.system" args))
-            (to-load (find-long-option "gnu.load" args)))
+            (to-load (find-long-option "gnu.load" args))
+            (profile (string-append system "/profile"))
+            (bin     (string-append profile "/bin"))
+            (sbin    (string-append profile "/bin")))
 
-       (false-if-exception (delete-file "/hurd"))
-       (let ((hurd/hurd (readlink* (string-append system "/profile/hurd"))))
-         (symlink hurd/hurd "/hurd"))
+       (setenv "PATH" (string-append bin ":" sbin))
+
+       (when (file-exists? "/var/run/shepherd/socket")
+         (format #t "Removing stale shepherd socket...\n")
+         (delete-file "/var/run/shepherd/socket"))
 
        (unless (file-exists? "/servers/startup")
          (format #t "Creating essential device nodes...\n")
          (make-hurd-device-nodes))
 
+       (let ((profile/hurd (readlink* (string-append profile "/hurd"))))
+         (when (file-exists? "/hurd")
+           (format #t "Removing stale /hurd link\n")
+           (delete-file "/hurd"))
+         (format #t "Linking /hurd from ~a...\n" profile/hurd)
+         (symlink profile/hurd "/hurd"))
+
        (format #t "Setting-up essential translators...\n")
-       (setenv "PATH" (string-append system "/profile/bin"))
        (set-hurd-device-translators)
 
        (format #t "Starting pager...\n")