GNU bug report logs - #74508
[PATCH 0/2] Improvements for mingetty-service-type

Previous Next

Package: guix-patches;

Reported by: Tomas Volf <~@wolfsden.cz>

Date: Sun, 24 Nov 2024 14:29:02 UTC

Severity: normal

Tags: patch

Done: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #29 received at 74508 <at> debbugs.gnu.org (full text, mbox):

From: Tomas Volf <~@wolfsden.cz>
To: 74508 <at> debbugs.gnu.org
Cc: Tomas Volf <~@wolfsden.cz>
Subject: [PATCH v2 1/3] services: mingetty: Add additional configuration
 options.
Date: Mon, 25 Nov 2024 17:05:33 +0100
Not all aspects of mingetty were configurable, so this commit adds the
additional configuration fields to support that.

* gnu/services/base.scm (<mingetty-configuration>): Add delay, print-issue,
print-hostname, nice, chdir, chroot fields.
(mingetty-shepherd-service): Use the new fields.
(define-module)<#:export>: Export the new accessors.
* doc/guix.texi (Base Services)<mingetty-configuration>: Document the
additional field.

Change-Id: I4557a82498805ade0b341feda9d33eccc305690f
---
v2: Split the renaming into separate commit (2/3).  Do not delete the
    mingetty-configuration-mingetty accessor.

 doc/guix.texi         | 27 ++++++++++++++++++++++-
 gnu/services/base.scm | 51 ++++++++++++++++++++++++++++++++++++++++---
 2 files changed, 74 insertions(+), 4 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 26488b41c8..c5f9481810 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -19348,7 +19348,32 @@ Base Services
 will have to press a key before the log-in shell is launched.

 @item @code{clear-on-logout?} (default: @code{#t})
-When set to @code{#t}, the screen will be cleared after logout.
+When set to @code{#t}, the screen will be cleared before showing the
+login prompt.  The field name is bit unfortunate, since it controls
+clearing also before the initial login, not just after a logout.
+
+@item @code{delay} (default: @code{#f})
+When set to a number, sleep that many seconds after startup.
+
+@item @code{print-issue} (default: @code{#t})
+When set to @code{#t}, write out a new line and the content of
+@file{/etc/issue}.  Value of @code{'no-nl} can be used to suppress the
+new line.
+
+@item @code{print-hostname} (default: @code{#t})
+When set to @code{#t}, print the host name before the login prompt.  The
+host name is printed up to the first dot.  Can be set to @code{'long} to
+print the full host name.
+
+@item @code{nice} (default: @code{#f})
+When set to a number, change the process priority using @code{nice}.
+
+@item @code{chdir} (default: @code{#f})
+When set to a string, change into that directory before calling the
+login program.
+
+@item @code{chroot} (default: @code{#f})
+When set to a string, call @code{chroot} with that directory.

 @item @code{mingetty} (default: @var{mingetty})
 The Mingetty package to use.
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 6473e1a91a..9712218bd5 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -187,6 +187,12 @@ (define-module (gnu services base)
             mingetty-configuration-login-pause?
             mingetty-configuration-clear-on-logout?
             mingetty-configuration-mingetty
+            mingetty-configuration-delay
+            mingetty-configuration-print-issue
+            mingetty-configuration-print-hostname
+            mingetty-configuration-nice
+            mingetty-configuration-chdir
+            mingetty-configuration-chroot
             mingetty-configuration?
             mingetty-service  ; deprecated
             mingetty-service-type
@@ -1250,12 +1256,25 @@ (define-record-type* <mingetty-configuration>
   (login-pause?     mingetty-login-pause?           ;Boolean
                     (default #f))
   (clear-on-logout? mingetty-clear-on-logout?       ;Boolean
-                    (default #t)))
+                    (default #t))
+  (delay            mingetty-configuration-delay ;Integer | #f
+                    (default #f))
+  (print-issue      mingetty-configuration-print-issue ;Boolean | Symbol
+                    (default #t))
+  (print-hostname   mingetty-configuration-print-hostname ;Boolean | Symbol
+                    (default #t))
+  (nice             mingetty-configuration-nice ;Integer | #f
+                    (default #f))
+  (chdir            mingetty-configuration-chdir ;String | #f
+                    (default #f))
+  (chroot           mingetty-configuration-chroot ;String | #f
+                    (default #f)))

 (define (mingetty-shepherd-service config)
   (match-record config <mingetty-configuration>
-    (mingetty tty auto-login login-program
-              login-pause? clear-on-logout?)
+                ( mingetty tty auto-login login-program
+                  login-pause? clear-on-logout? delay
+                  print-issue print-hostname nice chdir chroot)
     (list
      (shepherd-service
       (documentation "Run mingetty on an tty.")
@@ -1286,6 +1305,32 @@ (define (mingetty-shepherd-service config)
                               #~())
                        #$@(if login-pause?
                               #~("--loginpause")
+                              #~())
+                       #$@(if delay
+                              #~("--delay" #$(number->string delay))
+                              #~())
+                       #$@(match print-issue
+                            (#t
+                             #~())
+                            ('no-nl
+                             #~("--nonewline"))
+                            (#f
+                             #~("--noissue")))
+                       #$@(match print-hostname
+                            (#t
+                             #~())
+                            ('long
+                             #~("--long-hostname"))
+                            (#f
+                             #~("--nohostname")))
+                       #$@(if nice
+                              #~("--nice" #$(number->string nice))
+                              #~())
+                       #$@(if chdir
+                              #~("--chdir" #$chdir)
+                              #~())
+                       #$@(if chroot
+                              #~("--chroot" #$chroot)
                               #~()))))
       (stop   #~(make-kill-destructor))))))

--
2.46.0




This bug report was last modified 218 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.