From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42180) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emI1H-0006Yi-12 for guix-patches@gnu.org; Thu, 15 Feb 2018 06:48:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1emI1C-0002Gp-5g for guix-patches@gnu.org; Thu, 15 Feb 2018 06:48:07 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:35795) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1emI1C-0002Gi-05 for guix-patches@gnu.org; Thu, 15 Feb 2018 06:48:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1emI1B-0000g5-Q6 for guix-patches@gnu.org; Thu, 15 Feb 2018 06:48:01 -0500 Subject: [bug#30464] [PATCH 1/2] services: Add console-agetty-service. Resent-Message-ID: From: Danny Milosavljevic Date: Thu, 15 Feb 2018 12:47:41 +0100 Message-Id: <20180215114742.663-1-dannym@scratchpost.org> In-Reply-To: <20180215114256.551-1-dannym@scratchpost.org> References: <20180215114256.551-1-dannym@scratchpost.org> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 30464@debbugs.gnu.org * gnu/services/base.scm (): Make tty default to #f. (console-agetty-shepherd-service): New variable. (console-agetty-service-type): New variable. (console-agetty-service): New variable. (%base-services): Replace agetty-service instance by console-agetty-service instance. --- gnu/services/base.scm | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/gnu/services/base.scm b/gnu/services/base.scm index 1ad7c2320..29ae5fca3 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -817,7 +817,8 @@ the message of the day, among other things." agetty-configuration? (agetty agetty-configuration-agetty ; (default util-linux)) - (tty agetty-configuration-tty) ;string | #f + (tty agetty-configuration-tty ;string | #f + (default #f)) (term agetty-term ;string | #f (default #f)) (baud-rate agetty-baud-rate ;string | #f @@ -1072,6 +1073,31 @@ program."))) the tty to run, among other things." (service agetty-service-type config)) +(define console-agetty-shepherd-service + (lambda (config) + (let ((base-service + (car + (agetty-shepherd-service + (agetty-configuration (inherit config) + (keep-baud? #t)))))) + (list + (shepherd-service (inherit base-service) + ;; Make sure that Linux doesn't log to the same console as well. + (requirement (cons 'syslogd (shepherd-service-requirement base-service)))))))) + +(define console-agetty-service-type + (service-type (name 'console-agetty) + (extensions (list (service-extension shepherd-root-service-type + console-agetty-shepherd-service))) + (description + "Provide console login using the @command{agetty} +program on the Linux console."))) + +(define* (console-agetty-service config) + "Return a service to run agetty according to @var{config}, which specifies +the tty to run, defaulting to the Linux console." + (service console-agetty-service-type config)) + (define-record-type* mingetty-configuration make-mingetty-configuration mingetty-configuration? @@ -2053,10 +2079,9 @@ This service is not part of @var{%base-services}." (cons tty %default-console-font)) '("tty1" "tty2" "tty3" "tty4" "tty5" "tty6"))) - (agetty-service (agetty-configuration - (extra-options '("-L")) ; no carrier detect - (term "vt100") - (tty #f))) ; automatic + (console-agetty-service (agetty-configuration + (extra-options '("-L")) ; no carrier detect + (term "vt100"))) (mingetty-service (mingetty-configuration (tty "tty1")))