diff options
author | Marius Bakke <mbakke@fastmail.com> | 2020-02-14 19:05:45 +0100 |
---|---|---|
committer | Marius Bakke <mbakke@fastmail.com> | 2020-02-14 19:05:45 +0100 |
commit | 7edafc884c2a21258541b17a231051702c458263 (patch) | |
tree | d4202c8d6516bacd32fa55ee23c54b069ef8abd6 /gnu/installer/final.scm | |
parent | 89da127035737bdf922bc566970c5506c2e01b00 (diff) | |
parent | 64fc4f3705423c83c680a95d8dea81a39fce9a70 (diff) | |
download | guix-patches-7edafc884c2a21258541b17a231051702c458263.tar guix-patches-7edafc884c2a21258541b17a231051702c458263.tar.gz |
Merge branch 'master' into core-updates
Diffstat (limited to 'gnu/installer/final.scm')
-rw-r--r-- | gnu/installer/final.scm | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/gnu/installer/final.scm b/gnu/installer/final.scm index 1b85900912..8c2185e36f 100644 --- a/gnu/installer/final.scm +++ b/gnu/installer/final.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2018 Mathieu Othacehe <m.othacehe@gmail.com> +;;; Copyright © 2018, 2020 Mathieu Othacehe <m.othacehe@gmail.com> ;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org> ;;; ;;; This file is part of GNU Guix. @@ -23,6 +23,7 @@ #:use-module (gnu installer utils) #:use-module (gnu installer user) #:use-module (gnu services herd) + #:use-module (guix build syscalls) #:use-module (guix build utils) #:use-module (gnu build accounts) #:use-module ((gnu system shadow) #:prefix sys:) @@ -96,6 +97,15 @@ USERS." (write-passwd password (string-append etc "/passwd")) (write-shadow shadow (string-append etc "/shadow"))) +(define (umount-cow-store) + "Remove the store overlay and the bind-mount on /tmp created by the +cow-store service." + (let ((tmp-dir "/remove")) + (mkdir-p tmp-dir) + (mount (%store-directory) tmp-dir "" MS_MOVE) + (umount tmp-dir) + (umount "/tmp"))) + (define* (install-system locale #:key (users '())) "Create /etc/shadow and /etc/passwd on the installation target for USERS. Start COW-STORE service on target directory and launch guix install command in @@ -114,5 +124,16 @@ or #f. Return #t on success and #f on failure." ;; passwords that we've put in there. (create-user-database users (%installer-target-dir)) - (start-service 'cow-store (list (%installer-target-dir))) - (run-shell-command install-command #:locale locale))) + (dynamic-wind + (lambda () + (start-service 'cow-store (list (%installer-target-dir)))) + (lambda () + (run-shell-command install-command #:locale locale)) + (lambda () + (stop-service 'cow-store) + ;; Remove the store overlay created at cow-store service start. + ;; Failing to do that will result in further umount calls to fail + ;; because the target device is seen as busy. See: + ;; https://lists.gnu.org/archive/html/guix-devel/2018-12/msg00161.html. + (umount-cow-store) + #f)))) |