all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH 1/1] services: Add agetty service.
@ 2017-02-15  0:12 Leo Famulari
  2017-02-15  0:24 ` Leo Famulari
  0 siblings, 1 reply; 11+ messages in thread
From: Leo Famulari @ 2017-02-15  0:12 UTC (permalink / raw)
  To: guix-devel

* gnu/services/base.scm (<agetty-configuration>): New record type.
(agetty-shepherd-service, agetty-service): New procedures.
(agetty-service-type): New variable.
---
 gnu/services/base.scm | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 71 insertions(+), 1 deletion(-)

diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 57601eab8..58a50e38b 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -3,7 +3,7 @@
 ;;; Copyright © 2015, 2016 Alex Kost <alezost@gmail.com>
 ;;; Copyright © 2015, 2016 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
-;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
+;;; Copyright © 2016, 2017 Leo Famulari <leo@famulari.name>
 ;;; Copyright © 2016 David Craven <david@craven.ch>
 ;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
 ;;;
@@ -38,6 +38,7 @@
                 #:select (canonical-package glibc))
   #:use-module (gnu packages bash)
   #:use-module (gnu packages package-management)
+  #:use-module (gnu packages linux)
   #:use-module (gnu packages lsof)
   #:use-module (gnu packages terminals)
   #:use-module ((gnu build file-systems)
@@ -74,6 +75,11 @@
             login-service-type
             login-service
 
+            agetty-configuration
+            agetty-configuration?
+            agetty-service
+            agetty-service-type
+
             mingetty-configuration
             mingetty-configuration?
             mingetty-service
@@ -730,6 +736,70 @@ Return a service that sets up Unicode support in @var{tty} and loads
 the message of the day, among other things."
   (service login-service-type config))
 
+(define-record-type* <agetty-configuration>
+  agetty-configuration make-agetty-configuration
+  agetty-configuration?
+  (agetty         agetty-configuration-agetty   ;<package>
+                  (default util-linux))
+  (tty            agetty-configuration-tty)     ;string
+  (term           agetty-term                   ;string
+                  (default #f))
+  (extra          agetty-extra                  ;string
+                  (default #f))
+  (baud-rate      agetty-baud-rate              ;string
+                  (default #f))
+  (auto-login     agetty-auto-login             ;string | #f
+                  (default #f))
+  (login-program  agetty-login-program          ;gexp
+                  (default (file-append shadow "/bin/login")))
+  (login-pause?   agetty-login-pause?           ;Boolean
+                  (default #f)))
+
+(define agetty-shepherd-service
+  (match-lambda
+    (($ <agetty-configuration> agetty tty term extra baud-rate auto-login
+        login-program login-pause?)
+     (list
+       (shepherd-service
+         (documentation "Run agetty on a tty.")
+         (provision (list (symbol-append 'term- (string->symbol tty))))
+
+         ;; Same comment as for mingetty-shepherd-service.
+         (requirement '(user-processes host-name udev))
+
+         (start #~(make-forkexec-constructor
+                    (list #$ (file-append util-linux "/sbin/agetty")
+                          #$@(if extra
+                                 #~(#$extra)
+                                 #~())
+                          "--noclear" #$tty
+                          #$@(if baud-rate
+                                 #~(#$baud-rate)
+                                 #~())
+                          #$@(if auto-login
+                                 #~("--autologin" #$auto-login)
+                                 #~())
+                          #$@(if login-program
+                                 #~("--login-program" #$login-program)
+                                 #~())
+                          #$@(if login-pause?
+                                 #~("--login-pause")
+                                 #~())
+                          #$@(if term
+                                 #~(#$term)
+                                 #~()))))
+         (stop #~(make-kill-destructor)))))))
+
+(define agetty-service-type
+  (service-type (name 'agetty)
+                (extensions (list (service-extension shepherd-root-service-type
+                                                     agetty-shepherd-service)))))
+
+(define* (agetty-service config)
+  "Return a service to run agetty according to @var{config}, which specifies
+the tty to run, among other things."
+  (service agetty-service-type config))
+
 (define-record-type* <mingetty-configuration>
   mingetty-configuration make-mingetty-configuration
   mingetty-configuration?
-- 
2.11.1

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

end of thread, other threads:[~2017-03-07 14:43 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-15  0:12 [PATCH 1/1] services: Add agetty service Leo Famulari
2017-02-15  0:24 ` Leo Famulari
2017-02-15 15:21   ` myglc2
2017-02-15 19:38   ` Leo Famulari
2017-02-16  7:06   ` [V2 PATCH " Leo Famulari
2017-02-17  7:48     ` Ricardo Wurmus
2017-02-17 14:24       ` Leo Famulari
2017-02-17 18:35     ` myglc2
2017-02-17 22:59       ` Leo Famulari
2017-02-18  1:23         ` myglc2
2017-03-07 14:43         ` Ludovic Courtès

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.