gnu: vm: Add /etc/issue and a motd.

* gnu/system/vm.scm (system-qemu-image): Build a 'motd' and an 'issue'
  file.  Pass 'unix-pam-service' that motd.  Have /etc/issue point to
  the 'issue' file.
This commit is contained in:
Ludovic Courtès 2013-09-25 21:47:10 +02:00
parent d09cb44967
commit 43a2779876
2 changed files with 34 additions and 6 deletions

View File

@ -125,9 +125,10 @@
(let ((unix (pam-entry (let ((unix (pam-entry
(control "required") (control "required")
(module "pam_unix.so")))) (module "pam_unix.so"))))
(lambda* (name #:key allow-empty-passwords?) (lambda* (name #:key allow-empty-passwords? motd)
"Return a standard Unix-style PAM service for NAME. When "Return a standard Unix-style PAM service for NAME. When
ALLOW-EMPTY-PASSWORDS? is true, allow empty passwords." ALLOW-EMPTY-PASSWORDS? is true, allow empty passwords. When MOTD is true, it
should be the name of a file used as the message-of-the-day."
;; See <http://www.linux-pam.org/Linux-PAM-html/sag-configuration-example.html>. ;; See <http://www.linux-pam.org/Linux-PAM-html/sag-configuration-example.html>.
(let ((name* name)) (let ((name* name))
(pam-service (pam-service
@ -140,6 +141,12 @@ ALLOW-EMPTY-PASSWORDS? is true, allow empty passwords."
(arguments '("nullok"))) (arguments '("nullok")))
unix))) unix)))
(password (list unix)) (password (list unix))
(session (list unix))))))) (session (if motd
(list unix
(pam-entry
(control "optional")
(module "pam_motd.so")
(arguments (list (string-append "motd=" motd)))))
(list unix))))))))
;;; linux.scm ends here ;;; linux.scm ends here

View File

@ -432,10 +432,18 @@ input tuples."
(define (system-qemu-image store) (define (system-qemu-image store)
"Return the derivation of a QEMU image of the GNU system." "Return the derivation of a QEMU image of the GNU system."
(define motd
(add-text-to-store store "motd" "
Happy birthday, GNU! http://www.gnu.org/gnu30
"))
(define %pam-services (define %pam-services
;; Services known to PAM. ;; Services known to PAM.
(list %pam-other-services (list %pam-other-services
(unix-pam-service "login" #:allow-empty-passwords? #t))) (unix-pam-service "login"
#:allow-empty-passwords? #t
#:motd motd)))
(define %dmd-services (define %dmd-services
;; Services run by dmd. ;; Services run by dmd.
@ -487,6 +495,16 @@ alias ls='ls -p --color'
alias ll='ls -l' alias ll='ls -l'
"))) ")))
(issue (add-text-to-store store "issue" "
This is an alpha preview of the GNU system. Welcome.
This image features the GNU Guix package manager, which was used to
build it (http://www.gnu.org/software/guix/). The init system is
GNU dmd (http://www.gnu.org/software/dmd/).
You can log in as 'root' with no password.
"))
(populate `((directory "/etc") (populate `((directory "/etc")
(directory "/var/log") (directory "/var/log")
(directory "/var/run") (directory "/var/run")
@ -494,7 +512,8 @@ alias ll='ls -l'
("/etc/passwd" -> ,passwd) ("/etc/passwd" -> ,passwd)
("/etc/login.defs" -> "/dev/null") ("/etc/login.defs" -> "/dev/null")
("/etc/pam.d" -> ,pam.d) ("/etc/pam.d" -> ,pam.d)
("/etc/profile" -> ,bashrc))) ("/etc/profile" -> ,bashrc)
("/etc/issue" -> ,issue)))
(out (derivation->output-path (out (derivation->output-path
(package-derivation store mingetty))) (package-derivation store mingetty)))
(boot (add-text-to-store store "boot" (boot (add-text-to-store store "boot"
@ -525,11 +544,13 @@ alias ll='ls -l'
;; Configuration. ;; Configuration.
("dmd.conf" ,dmd-conf) ("dmd.conf" ,dmd-conf)
("etc-pam.d" ,pam.d) ("etc-pam.d" ,pam.d-drv)
("etc-passwd" ,passwd) ("etc-passwd" ,passwd)
("etc-shadow" ,shadow) ("etc-shadow" ,shadow)
("etc-group" ,group) ("etc-group" ,group)
("etc-bashrc" ,bashrc) ("etc-bashrc" ,bashrc)
("etc-issue" ,issue)
("etc-motd" ,motd)
,@(append-map service-inputs ,@(append-map service-inputs
%dmd-services)))))) %dmd-services))))))