;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2023 Brian Cully ;;; ;;; This file is part of GNU Guix. ;;; ;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see . (define-module (tests services pam-mount) #:use-module (gnu services pam-mount) #:use-module (gnu system pam) #:use-module (gnu services) #:use-module (gnu services configuration) #:use-module (guix derivations) #:use-module (guix gexp) #:use-module (guix grafts) #:use-module (guix store) #:use-module (guix tests) #:use-module (ice-9 match) #:use-module (srfi srfi-1) #:use-module (srfi srfi-64)) (define pam-mount-volume-fields (@@ (gnu services pam-mount) pam-mount-volume-fields)) (define field-name->tag (@@ (gnu services pam-mount) field-name->tag)) (define pam-mount-volume->sxml (@@ (gnu services pam-mount) pam-mount-volume->sxml)) (test-begin "services-pam-mount") (test-group "field-name->tag" (let ((field-map '((user-name user) (user-id uid) (primary-group pgrp) (group-id gid) (secondary-group sgrp) (file-system-type fstype) (no-mount-as-root? noroot) (server server) (file-name path) (mount-point mountpoint) (options options) (ssh? ssh) (cipher cipher) (file-system-key-cipher fskeycipher) (file-system-key-hash fskeyhash) (file-system-key-file-name fskeypath)))) (test-equal "all fields accounted for" (map car field-map) (map configuration-field-name pam-mount-volume-fields)) (for-each (match-lambda ((field-name tag-name) (test-eq (format #f "~a -> ~a" field-name tag-name) (field-name->tag field-name) tag-name))) field-map))) (let ((tmpfs-volume (pam-mount-volume (secondary-group "users") (file-system-type "tmpfs") (mount-point "/run/user/%(USERUID)") (options "someoptions")))) (test-equal "tmpfs" '(volume (@ (sgrp "users") (fstype "tmpfs") (mountpoint "/run/user/%(USERUID)") (options "someoptions"))) (pam-mount-volume->sxml tmpfs-volume))) (test-end "services-pam-mount") ler/utils.scm (run-external-command-with-line-hooks): Use 'read-delimited' rather than 'get-line'. Pass 'concat as the last argument. (%display-line-hook): Remove. (run-command): Use 'display' instead of '%display-line-hook'. (%syslog-line-hook): Add "\n" when LINE doesn't end in \n. (%installer-log-line-hook): Do not add an extra newline. (installer-log-line): Add an extra newline. Ludovic Courtès 2022-10-20installer: Run the "guix system init" command in a PTY....Fixes: <https://issues.guix.gnu.org/55360> * gnu/installer/utils.scm (run-external-command-with-handler/tty): New procedure. (run-external-command-with-line-hooks, run-command): Add a TTY? argument. * gnu/installer/final.scm (install-system): Call run-command with TTY? argument set to #true. Mathieu Othacehe 2022-09-22installer: Move <secret> to utils and use it for crypt passwords....* gnu/installer/user.scm (<secret>, secret?, make-secret, secret-content): Move to utils.scm. * gnu/installer/utils.scm (<secret>, secret?, make-secret, secret-content): Moved from user.scm. * gnu/installer/newt/partition.scm (prompt-luks-passwords): Make password a <secret>. * gnu/installer/parted.scm (luks-format-and-open): Unwrap secret. Signed-off-by: Mathieu Othacehe <othacehe@gnu.org> Josselin Poiret 2022-02-02installer: Add installer-specific run command process....* gnu/installer/record.scm (installer)[run-command]: Add field. * gnu/installer/utils.scm (run-command-in-installer): Add parameter. * gnu/installer.scm (installer-program): Parameterize run-command-in-installer with current installer's run-command. * gnu/installer/newt.scm (newt-run-command): New variable. (newt-installer): Use it. Signed-off-by: Mathieu Othacehe <othacehe@gnu.org> Josselin Poiret 2022-02-02installer: Capture external commands output....* gnu/installer/utils.scm (run-external-command-with-handler, run-external-command-with-line-hooks): New variables. (run-command): Use run-external-command-with-line-hooks. Signed-off-by: Mathieu Othacehe <othacehe@gnu.org> Josselin Poiret 2022-02-02installer: Un-export syslog syntax....* gnu/installer/utils.scm (syslog): Remove export. Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>