mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-25 13:58:15 -05:00
gnu: vm: Setup PAM.
* gnu/system/vm.scm (example2): Use 'pam-services->directory'. Change POPULATE to create /etc/pam.d, /etc/login.defs, and /var/run. Change BOOT to spawn syslogd; boot to Bash. Add inputs.
This commit is contained in:
parent
3b07625ad6
commit
a843fe2222
1 changed files with 42 additions and 19 deletions
|
@ -33,8 +33,7 @@ (define-module (gnu system vm)
|
||||||
#:use-module (gnu packages linux-initrd)
|
#:use-module (gnu packages linux-initrd)
|
||||||
#:use-module ((gnu packages make-bootstrap)
|
#:use-module ((gnu packages make-bootstrap)
|
||||||
#:select (%guile-static-stripped))
|
#:select (%guile-static-stripped))
|
||||||
#:use-module ((gnu packages system)
|
#:use-module (gnu packages system)
|
||||||
#:select (mingetty))
|
|
||||||
#:use-module (srfi srfi-1)
|
#:use-module (srfi srfi-1)
|
||||||
#:use-module (srfi srfi-26)
|
#:use-module (srfi srfi-26)
|
||||||
#:use-module (ice-9 match)
|
#:use-module (ice-9 match)
|
||||||
|
@ -396,6 +395,11 @@ (define (example2)
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(set! store (open-connection)))
|
(set! store (open-connection)))
|
||||||
(lambda ()
|
(lambda ()
|
||||||
|
(define %pam-services
|
||||||
|
;; Services known to PAM.
|
||||||
|
(list %pam-other-services
|
||||||
|
(unix-pam-service "login" #:allow-empty-passwords? #t)))
|
||||||
|
|
||||||
(parameterize ((%guile-for-build (package-derivation store guile-final)))
|
(parameterize ((%guile-for-build (package-derivation store guile-final)))
|
||||||
(let* ((bash-drv (package-derivation store bash))
|
(let* ((bash-drv (package-derivation store bash))
|
||||||
(bash-file (string-append (derivation-path->output-path bash-drv)
|
(bash-file (string-append (derivation-path->output-path bash-drv)
|
||||||
|
@ -404,17 +408,26 @@ (define (example2)
|
||||||
"/" bash-file)))
|
"/" bash-file)))
|
||||||
(passwd (passwd-file store accounts))
|
(passwd (passwd-file store accounts))
|
||||||
(shadow (passwd-file store accounts #:shadow? #t))
|
(shadow (passwd-file store accounts #:shadow? #t))
|
||||||
|
(pam.d-drv (pam-services->directory store %pam-services))
|
||||||
|
(pam.d (derivation-path->output-path pam.d-drv))
|
||||||
(populate
|
(populate
|
||||||
(add-text-to-store store "populate-qemu-image"
|
(add-text-to-store store "populate-qemu-image"
|
||||||
(object->string
|
(object->string
|
||||||
`(begin
|
`(begin
|
||||||
(mkdir-p "etc")
|
(mkdir-p "etc")
|
||||||
(symlink ,shadow "etc/shadow")
|
(symlink ,shadow "etc/shadow")
|
||||||
(symlink ,passwd "etc/passwd")))
|
(symlink ,passwd "etc/passwd")
|
||||||
|
(symlink "/dev/null"
|
||||||
|
"etc/login.defs")
|
||||||
|
(symlink ,pam.d "etc/pam.d")
|
||||||
|
(mkdir-p "var/run")))
|
||||||
(list passwd)))
|
(list passwd)))
|
||||||
(out (derivation-path->output-path
|
(out (derivation-path->output-path
|
||||||
(package-derivation store mingetty)))
|
(package-derivation store mingetty)))
|
||||||
(getty (string-append out "/sbin/mingetty"))
|
(getty (string-append out "/sbin/mingetty"))
|
||||||
|
(iu-drv (package-derivation store inetutils))
|
||||||
|
(syslogd (string-append (derivation-path->output-path iu-drv)
|
||||||
|
"/libexec/syslogd"))
|
||||||
(boot (add-text-to-store store "boot"
|
(boot (add-text-to-store store "boot"
|
||||||
(object->string
|
(object->string
|
||||||
`(begin
|
`(begin
|
||||||
|
@ -423,9 +436,15 @@ (define (example2)
|
||||||
;; 'TIOCSCTTY'.
|
;; 'TIOCSCTTY'.
|
||||||
(setsid)
|
(setsid)
|
||||||
|
|
||||||
;; Directly into mingetty.
|
(when (zero? (primitive-fork))
|
||||||
(execl ,getty "mingetty"
|
(format #t "starting syslogd as ~a~%"
|
||||||
"--noclear" "tty1")))
|
(getpid))
|
||||||
|
(execl ,syslogd "syslogd"))
|
||||||
|
|
||||||
|
;; Directly into mingetty. XXX
|
||||||
|
;; (execl ,getty "mingetty"
|
||||||
|
;; "--noclear" "tty1")
|
||||||
|
(execl ,bash-file "bash")))
|
||||||
(list out)))
|
(list out)))
|
||||||
(entries (list (menu-entry
|
(entries (list (menu-entry
|
||||||
(label "Boot-to-Guile! (GNU System technology preview)")
|
(label "Boot-to-Guile! (GNU System technology preview)")
|
||||||
|
@ -434,6 +453,7 @@ (define (example2)
|
||||||
,(string-append "--load=" boot)))
|
,(string-append "--load=" boot)))
|
||||||
(initrd gnu-system-initrd))))
|
(initrd gnu-system-initrd))))
|
||||||
(grub.cfg (grub-configuration-file store entries)))
|
(grub.cfg (grub-configuration-file store entries)))
|
||||||
|
(build-derivations store (list pam.d-drv))
|
||||||
(qemu-image store
|
(qemu-image store
|
||||||
#:grub-configuration grub.cfg
|
#:grub-configuration grub.cfg
|
||||||
#:populate populate
|
#:populate populate
|
||||||
|
@ -445,7 +465,10 @@ (define (example2)
|
||||||
("bash" ,bash)
|
("bash" ,bash)
|
||||||
("guile" ,guile-2.0)
|
("guile" ,guile-2.0)
|
||||||
("mingetty" ,mingetty)
|
("mingetty" ,mingetty)
|
||||||
|
("inetutils" ,inetutils)
|
||||||
|
|
||||||
|
;; Configuration.
|
||||||
|
("etc-pam.d" ,pam.d)
|
||||||
("etc-passwd" ,passwd)
|
("etc-passwd" ,passwd)
|
||||||
("etc-shadow" ,shadow))))))
|
("etc-shadow" ,shadow))))))
|
||||||
(lambda ()
|
(lambda ()
|
||||||
|
|
Loading…
Reference in a new issue