all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#74508] [PATCH 0/2] Improvements for mingetty-service-type
@ 2024-11-24 14:28 Tomas Volf
  2024-11-24 14:31 ` [bug#74508] [PATCH 1/2] services: mingetty: Add additional configuration options Tomas Volf
  2024-11-24 14:31 ` [bug#74508] [PATCH 2/2] services: mingetty: Support waiting on shepherd services Tomas Volf
  0 siblings, 2 replies; 3+ messages in thread
From: Tomas Volf @ 2024-11-24 14:28 UTC (permalink / raw)
  To: 74508; +Cc: Tomas Volf, Ludovic Courtès, Maxim Cournoyer

Some configuration options were missing and some accessors where misnamed.
Ability to depend on arbitrary shepherd service is also added.

Tomas Volf (2):
  services: mingetty: Add additional configuration options.
  services: mingetty: Support waiting on shepherd services.

 doc/guix.texi         | 47 ++++++++++++++++++++++-
 gnu/services/base.scm | 86 ++++++++++++++++++++++++++++++++++---------
 2 files changed, 114 insertions(+), 19 deletions(-)

--
2.46.0




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

* [bug#74508] [PATCH 1/2] services: mingetty: Add additional configuration options.
  2024-11-24 14:28 [bug#74508] [PATCH 0/2] Improvements for mingetty-service-type Tomas Volf
@ 2024-11-24 14:31 ` Tomas Volf
  2024-11-24 14:31 ` [bug#74508] [PATCH 2/2] services: mingetty: Support waiting on shepherd services Tomas Volf
  1 sibling, 0 replies; 3+ messages in thread
From: Tomas Volf @ 2024-11-24 14:31 UTC (permalink / raw)
  To: 74508; +Cc: Tomas Volf, Ludovic Courtès, Maxim Cournoyer

Not all aspects of mingetty were configurable, so this commit adds the
additional configuration fields to support that.

It also renames the accessors for all fields except `tty'.  They were named
just `mingetty-$FIELD', instead of `mingetty-configuration-$FIELD'.  However
the renaming *is* backwards compatible, since in the define-module's #:export
argument the correct (`mingetty-configuration-$FIELD') were used already.
Hence, until now, there was no way to access anything except the `tty' field.

* gnu/services/base.scm (<mingetty-configuration>): Add delay, print-issue,
print-hostname, nice, chdir, chroot fields.  Rename accessors for auto-login,
login-program, login-pause?, clear-on-logout?.
(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
---
 doc/guix.texi         | 27 ++++++++++++++++++-
 gnu/services/base.scm | 62 ++++++++++++++++++++++++++++++++++++-------
 2 files changed, 79 insertions(+), 10 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 1c39628ffa..d689711e80 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -19285,7 +19285,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..b3d3553091 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -186,7 +186,12 @@ (define-module (gnu services base)
             mingetty-configuration-login-program
             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
@@ -1242,20 +1247,33 @@ (define-record-type* <mingetty-configuration>
   mingetty-configuration?
   (mingetty         mingetty-configuration-mingetty ;file-like
                     (default mingetty))
-  (tty              mingetty-configuration-tty)     ;string
-  (auto-login       mingetty-auto-login             ;string | #f
+  (tty              mingetty-configuration-tty)       ;string
+  (auto-login       mingetty-configuration-auto-login ;string | #f
                     (default #f))
-  (login-program    mingetty-login-program          ;gexp
+  (login-program    mingetty-configuration-login-program ;gexp
                     (default #f))
-  (login-pause?     mingetty-login-pause?           ;Boolean
+  (login-pause?     mingetty-configuration-login-pause? ;Boolean
                     (default #f))
-  (clear-on-logout? mingetty-clear-on-logout?       ;Boolean
-                    (default #t)))
+  (clear-on-logout? mingetty-configuration-clear-on-logout? ;Boolean
+                    (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 +1304,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





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

* [bug#74508] [PATCH 2/2] services: mingetty: Support waiting on shepherd services.
  2024-11-24 14:28 [bug#74508] [PATCH 0/2] Improvements for mingetty-service-type Tomas Volf
  2024-11-24 14:31 ` [bug#74508] [PATCH 1/2] services: mingetty: Add additional configuration options Tomas Volf
@ 2024-11-24 14:31 ` Tomas Volf
  1 sibling, 0 replies; 3+ messages in thread
From: Tomas Volf @ 2024-11-24 14:31 UTC (permalink / raw)
  To: 74508; +Cc: Tomas Volf, Ludovic Courtès, Maxim Cournoyer

For auto-login on systems with elogind, dbus-system needs to be started.  This
commit adds ability to express that ordering.

* gnu/services/base.scm (<mingetty-configuration>): Add shepherd-requirement
field.
(mingetty-shepherd-service): Use it.
* doc/guix.texi (Base Services)<mingetty-configuration>: Document it.

Change-Id: Iedbdc4375180740379d561aa193d7c63350d2e7b
---
 doc/guix.texi         | 20 ++++++++++++++
 gnu/services/base.scm | 62 ++++++++++++++++++++++++-------------------
 2 files changed, 54 insertions(+), 28 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index d689711e80..e15cfeb39d 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -19312,6 +19312,26 @@ Base Services
 @item @code{chroot} (default: @code{#f})
 When set to a string, call @code{chroot} with that directory.
 
+@item @code{shepherd-requirement}
+List of shepherd requirements.  Unless you know what you are doing, it
+is recommended to add to the default list instead of replacing.
+
+For example you can use this field when performing auto-login on a
+system with elogind to wait on @code{'dbus-system}.
+
+@lisp
+(modify-services %base-services
+  (mingetty-service-type config =>
+                         (mingetty-configuration
+                          (inherit config)
+                          ;; Automatically log in as "guest".
+                          (auto-login "guest")
+                          (shepherd-requirement
+                           (cons 'dbus-system
+                                 (mingetty-configuration-shepherd-requirement
+                                  config))))))
+@end lisp
+
 @item @code{mingetty} (default: @var{mingetty})
 The Mingetty package to use.
 
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index b3d3553091..6681d5f8d4 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -192,6 +192,7 @@ (define-module (gnu services base)
             mingetty-configuration-nice
             mingetty-configuration-chdir
             mingetty-configuration-chroot
+            mingetty-configuration-shepherd-requirement
             mingetty-configuration?
             mingetty-service  ; deprecated
             mingetty-service-type
@@ -1245,44 +1246,49 @@ (define-deprecated (agetty-service config)
 (define-record-type* <mingetty-configuration>
   mingetty-configuration make-mingetty-configuration
   mingetty-configuration?
-  (mingetty         mingetty-configuration-mingetty ;file-like
-                    (default mingetty))
-  (tty              mingetty-configuration-tty)       ;string
-  (auto-login       mingetty-configuration-auto-login ;string | #f
-                    (default #f))
-  (login-program    mingetty-configuration-login-program ;gexp
-                    (default #f))
-  (login-pause?     mingetty-configuration-login-pause? ;Boolean
-                    (default #f))
-  (clear-on-logout? mingetty-configuration-clear-on-logout? ;Boolean
-                    (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)))
+  (mingetty             mingetty-configuration-mingetty ;file-like
+                        (default mingetty))
+  (tty                  mingetty-configuration-tty)       ;string
+  (auto-login           mingetty-configuration-auto-login ;string | #f
+                        (default #f))
+  (login-program        mingetty-configuration-login-program ;gexp
+                        (default #f))
+  (login-pause?         mingetty-configuration-login-pause? ;Boolean
+                        (default #f))
+  (clear-on-logout?     mingetty-configuration-clear-on-logout? ;Boolean
+                        (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))
+  (shepherd-requirement mingetty-configuration-shepherd-requirement
+                        ;; Since the login prompt shows the host name, wait
+                        ;; for the 'host-name' service to be done.  Also wait
+                        ;; for udev essentially so that the tty text is not
+                        ;; lost in the middle of kernel messages (XXX).
+                        (default '(user-processes host-name udev
+                                                  virtual-terminal))))
 
 (define (mingetty-shepherd-service config)
   (match-record config <mingetty-configuration>
                 (mingetty tty auto-login login-program
                           login-pause? clear-on-logout? delay
-                          print-issue print-hostname nice chdir chroot)
+                          print-issue print-hostname nice chdir chroot
+                          shepherd-requirement)
     (list
      (shepherd-service
       (documentation "Run mingetty on an tty.")
       (provision (list (symbol-append 'term- (string->symbol tty))))
 
-      ;; Since the login prompt shows the host name, wait for the 'host-name'
-      ;; service to be done.  Also wait for udev essentially so that the tty
-      ;; text is not lost in the middle of kernel messages (XXX).
-      (requirement '(user-processes host-name udev virtual-terminal))
+      (requirement shepherd-requirement)
 
       (start  #~(make-forkexec-constructor
                  (list #$(file-append mingetty "/sbin/mingetty")
-- 
2.46.0





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

end of thread, other threads:[~2024-11-24 14:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-24 14:28 [bug#74508] [PATCH 0/2] Improvements for mingetty-service-type Tomas Volf
2024-11-24 14:31 ` [bug#74508] [PATCH 1/2] services: mingetty: Add additional configuration options Tomas Volf
2024-11-24 14:31 ` [bug#74508] [PATCH 2/2] services: mingetty: Support waiting on shepherd services Tomas Volf

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.