mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2025-01-24 03:29:40 -05:00
services: Create /var/run/utmpx upon activation.
This fixes a bug whereby /var/run/utmpx would never be created, and thus accounting information would be missing. * gnu/services.scm (activation-script): Create /var/run/utmpx. * gnu/tests/base.scm (run-basic-test)["utmpx entry"]: New test.
This commit is contained in:
parent
150309726f
commit
caa7816673
2 changed files with 26 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
||||||
;;; GNU Guix --- Functional package management for GNU
|
;;; GNU Guix --- Functional package management for GNU
|
||||||
;;; Copyright © 2015, 2016 Ludovic Courtès <ludo@gnu.org>
|
;;; Copyright © 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
|
||||||
;;; Copyright © 2016 Chris Marusich <cmmarusich@gmail.com>
|
;;; Copyright © 2016 Chris Marusich <cmmarusich@gmail.com>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
|
@ -340,6 +340,11 @@ (define (service-activations)
|
||||||
(activate-/bin/sh
|
(activate-/bin/sh
|
||||||
(string-append #$(canonical-package bash) "/bin/sh"))
|
(string-append #$(canonical-package bash) "/bin/sh"))
|
||||||
|
|
||||||
|
;; Make sure the user accounting database exists. If it
|
||||||
|
;; does not exist, 'setutxent' does not create it and
|
||||||
|
;; thus there is no accounting at all.
|
||||||
|
(close-port (open-file "/var/run/utmpx" "a0"))
|
||||||
|
|
||||||
;; Set up /run/current-system. Among other things this
|
;; Set up /run/current-system. Among other things this
|
||||||
;; sets up locales, which the activation snippets
|
;; sets up locales, which the activation snippets
|
||||||
;; executed below may expect.
|
;; executed below may expect.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
;;; GNU Guix --- Functional package management for GNU
|
;;; GNU Guix --- Functional package management for GNU
|
||||||
;;; Copyright © 2016 Ludovic Courtès <ludo@gnu.org>
|
;;; Copyright © 2016, 2017 Ludovic Courtès <ludo@gnu.org>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -78,9 +78,11 @@ (define* (run-basic-test os command #:optional (name "basic")
|
||||||
inserted before the first test. This is used to introduce an extra
|
inserted before the first test. This is used to introduce an extra
|
||||||
initialization step, such as entering a LUKS passphrase."
|
initialization step, such as entering a LUKS passphrase."
|
||||||
(define test
|
(define test
|
||||||
(with-imported-modules '((gnu build marionette))
|
(with-imported-modules '((gnu build marionette)
|
||||||
|
(guix build syscalls))
|
||||||
#~(begin
|
#~(begin
|
||||||
(use-modules (gnu build marionette)
|
(use-modules (gnu build marionette)
|
||||||
|
(guix build syscalls)
|
||||||
(srfi srfi-1)
|
(srfi srfi-1)
|
||||||
(srfi srfi-26)
|
(srfi srfi-26)
|
||||||
(srfi srfi-64)
|
(srfi srfi-64)
|
||||||
|
@ -176,6 +178,22 @@ (define marionette
|
||||||
(apply throw args)))))
|
(apply throw args)))))
|
||||||
marionette)))
|
marionette)))
|
||||||
|
|
||||||
|
;; There should be one utmpx entry for the user logged in on tty1.
|
||||||
|
(test-equal "utmpx entry"
|
||||||
|
'(("root" "tty1" #f))
|
||||||
|
(marionette-eval
|
||||||
|
'(begin
|
||||||
|
(use-modules (guix build syscalls)
|
||||||
|
(srfi srfi-1))
|
||||||
|
|
||||||
|
(filter-map (lambda (entry)
|
||||||
|
(and (equal? (login-type USER_PROCESS)
|
||||||
|
(utmpx-login-type entry))
|
||||||
|
(list (utmpx-user entry) (utmpx-line entry)
|
||||||
|
(utmpx-host entry))))
|
||||||
|
(utmpx-entries)))
|
||||||
|
marionette))
|
||||||
|
|
||||||
(test-assert "host name resolution"
|
(test-assert "host name resolution"
|
||||||
(match (marionette-eval
|
(match (marionette-eval
|
||||||
'(begin
|
'(begin
|
||||||
|
|
Loading…
Reference in a new issue