guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

15/22: DRAFT system: hurd: Start the Shepherd.


From: guix-commits
Subject: 15/22: DRAFT system: hurd: Start the Shepherd.
Date: Mon, 13 Apr 2020 09:20:49 -0400 (EDT)

janneke pushed a commit to branch wip-hurd-vm
in repository guix.

commit 1b2def51a692d6b12b07a164e9fb3aaeb23f6765
Author: Jan (janneke) Nieuwenhuizen <address@hidden>
AuthorDate: Sun Apr 12 17:34:25 2020 +0200

    DRAFT system: hurd: Start the Shepherd.
    
    This starts console, ttys, fancy-console, ssh-daemon, and guix-daemon using
    the Shepherd.  Shepherd is not running as PID 1 yet, its started from `rc'.
    
    * gnu/packages/hurd.scm (hurd-rc-script): Do not start console, start the
    shepherd instead.
    * gnu/system/hurd.scm (shepherd.conf): New file.
---
 gnu/packages/hurd.scm | 11 +++----
 gnu/system/hurd.scm   | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 86 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/hurd.scm b/gnu/packages/hurd.scm
index d187996..305f841 100644
--- a/gnu/packages/hurd.scm
+++ b/gnu/packages/hurd.scm
@@ -346,12 +346,13 @@ boot, since this cannot be done from GNU/Linux."
                          (apply invoke "settrans" "-c" node command))))
                     '#$translators)
 
-          ;; Start the oh-so-fancy console client.
-          (mkdir-p "/var/run")                    ;for the PID file
-          (invoke "console" "--daemonize" "-c" "/dev/vcs"
-                  "-d" "vga" "-d" "pc_kbd" "-d" "generic_speaker")
           ;; Generate the ssh host keys.
-          (invoke "/run/current-system/profile/bin/ssh-keygen" "-A"))))
+          (invoke "/run/current-system/profile/bin/ssh-keygen" "-A")
+          (mkdir-p "/var/run")                    ;for the PID files
+          ;; Hand over to the Shepherd
+          (false-if-exception (delete-file "/var/run/shepherd/socket"))
+          (invoke "/run/current-system/profile/bin/shepherd"
+                  "--config" "/etc/shepherd.conf"))))
 
   ;; FIXME: We want the program to use the cross-compiled Guile when
   ;; cross-compiling.  But why do we need to be explicit here?
diff --git a/gnu/system/hurd.scm b/gnu/system/hurd.scm
index d346048..88c2557 100644
--- a/gnu/system/hurd.scm
+++ b/gnu/system/hurd.scm
@@ -150,6 +150,84 @@ PidFile /var/run/sshd.pid
 PrintLastLog yes
 LogLevel INFO\n"))
 
+  (define shepherd.conf
+    (plain-file "shepherd.conf"
+                ";; -*-scheme-*- # Generated by '(gnu system hurd)'
+;; shepherd --config /etc/shepherd.conf
+
+(use-modules (srfi srfi-1)
+             (srfi srfi-34)
+             (system repl error-handling)
+             (oop goops)
+             (shepherd service))
+
+(default-environment-variables
+  '(\"PATH=/run/current-system/profile/bin\"))
+(call-with-error-handling
+ (lambda _
+   (apply
+    register-services
+    (list
+     (make <service>
+       #:provides '(console)
+       #:respawn? #t
+       #:start (lambda _
+                 (fork+exec-command
+                  '(\"/run/current-system/profile/bin/console\"
+                    \"-c\" \"/dev/vcs\"
+                    \"-d\" \"vga\"
+                    \"-d\" \"pc_kbd\"
+                    \"-d\" \"generic_speaker\")))
+       #:stop (make-kill-destructor))
+     (make <service>
+       #:provides '(ttys)
+       #:requires '(console)
+       #:respawn? #t
+       #:start (lambda _
+                 (fork+exec-command
+                  '(\"/run/current-system/profile/libexec/runttys\")))
+       #:stop (make-kill-destructor))
+     (make <service>
+       #:provides '(fancy-console)
+       #:requires '(ttys)
+       #:respawn? #t
+       #:start (lambda _
+                 (fork+exec-command
+                  '(\"/run/current-system/profile/bin/console\"
+                    \"-c\" \"/dev/vcs\"
+                    \"-d\" \"vga\"
+                    \"-d\" \"pc_kbd\"
+                    \"-d\" \"generic_speaker\")))
+       #:stop (make-kill-destructor))
+     (make <service>
+       #:provides '(guix-daemon)
+       #:respawn? #t
+       #:start (lambda _
+                 (fork+exec-command
+                  '(\"/run/current-system/profile/bin/guix-daemon\"
+                    \"--build-users-group=guixbuild\"
+                    \"--disable-chroot\"
+                    \"--disable-deduplication\"
+                    \"--max-jobs=1\"
+                    \"--substitute-urls=https://ci.guix.gnu.org\";)))
+       #:stop (make-kill-destructor))
+     (make <service>
+       #:provides '(ssh-daemon ssh sshd)
+       #:respawn? #t
+       #:start (lambda _
+                 (fork+exec-command
+                  '(\"/run/current-system/profile/sbin/sshd\"
+                    \"-D\"
+                    \"-f\" \"/etc/ssh/sshd_config\")))
+       #:stop (make-kill-destructor))))))
+(format #t \"starting services...~%\")
+(for-each
+ (lambda (service)
+   (guard (c ((service-error? c) (format (current-error-port) \"failed to 
start service '~a'~%\" service)))
+     (start service)))
+ '(console ttys fancy-console guix-daemon ssh-daemon ssh sshd))
+(redirect-port (open-input-file \"/dev/null\") (current-input-port))\n")) ;" 
help Emacs
+
   (define build.sh
     (plain-file "build.sh"
                 "#! /bin/sh
@@ -226,6 +304,7 @@ guix build -e '(@@ (gnu packages commencement) 
gnu-make-boot0)' --fallback --no-
                                     "/etc/ttys"))
       (directory "/etc/ssh")
       ("/etc/ssh/sshd_config" -> ,sshd_config)
+      ("/etc/shepherd.conf" -> ,shepherd.conf)
       ("/bin/sh" -> ,(file-append (with-parameters ((%current-target-system
                                                      "i586-pc-gnu"))
                                     bash)
@@ -242,6 +321,7 @@ guix build -e '(@@ (gnu packages commencement) 
gnu-make-boot0)' --fallback --no-
                          ("etc-profile" ,etc-profile)
                          ("shadow" ,shadow)
                          ("sshd_config" ,sshd_config)
+                         ("shepherd.conf" ,shepherd.conf)
                          ("build.sh" ,build.sh))
               #:copy-inputs? #t
               #:os system-profile



reply via email to

[Prev in Thread] Current Thread [Next in Thread]