From: Leo Famulari <leo@famulari.name>
To: guix-devel@gnu.org
Subject: [PATCH 1/1] services: Add agetty service.
Date: Tue, 14 Feb 2017 19:12:44 -0500 [thread overview]
Message-ID: <8b9a83141665a7a86aa3d3c9ba6363c1ba2e93cd.1487117562.git.leo@famulari.name> (raw)
* 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
next reply other threads:[~2017-02-15 0:12 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-15 0:12 Leo Famulari [this message]
2017-02-15 0:24 ` [PATCH 1/1] services: Add agetty service 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8b9a83141665a7a86aa3d3c9ba6363c1ba2e93cd.1487117562.git.leo@famulari.name \
--to=leo@famulari.name \
--cc=guix-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.