summaryrefslogtreecommitdiff
path: root/gnu/installer/final.scm
diff options
context:
space:
mode:
authorEfraim Flashner <efraim@flashner.co.il>2023-01-30 11:33:18 +0200
committerEfraim Flashner <efraim@flashner.co.il>2023-01-30 12:39:40 +0200
commit4cf1acc7f3033b50b0bf19e02c9f522d522d338c (patch)
tree9fd64956ee60304c15387eb394cd649e49f01467 /gnu/installer/final.scm
parentedb8c09addd186d9538d43b12af74d6c7aeea082 (diff)
parent595b53b74e3ef57a1c0c96108ba86d38a170a241 (diff)
Merge remote-tracking branch 'origin/master' into core-updates
Conflicts: doc/guix.texi gnu/local.mk gnu/packages/admin.scm gnu/packages/base.scm gnu/packages/chromium.scm gnu/packages/compression.scm gnu/packages/databases.scm gnu/packages/diffoscope.scm gnu/packages/freedesktop.scm gnu/packages/gnome.scm gnu/packages/gnupg.scm gnu/packages/guile.scm gnu/packages/inkscape.scm gnu/packages/llvm.scm gnu/packages/openldap.scm gnu/packages/pciutils.scm gnu/packages/ruby.scm gnu/packages/samba.scm gnu/packages/sqlite.scm gnu/packages/statistics.scm gnu/packages/syndication.scm gnu/packages/tex.scm gnu/packages/tls.scm gnu/packages/version-control.scm gnu/packages/xml.scm guix/build-system/copy.scm guix/scripts/home.scm
Diffstat (limited to 'gnu/installer/final.scm')
-rw-r--r--gnu/installer/final.scm32
1 files changed, 25 insertions, 7 deletions
diff --git a/gnu/installer/final.scm b/gnu/installer/final.scm
index 3f6dacc490..069426a3b8 100644
--- a/gnu/installer/final.scm
+++ b/gnu/installer/final.scm
@@ -1,6 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2018, 2020 Mathieu Othacehe <m.othacehe@gmail.com>
-;;; Copyright © 2019, 2020 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2019, 2020, 2022 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -114,6 +114,8 @@ it can interact with the rest of the system."
;; Catch SIGINT and kill the container process.
(sigaction SIGINT
(lambda (signum)
+ ;: FIXME: Use of SIGKILL prevents the dynamic-wind exit handler of
+ ;; THUNK to run.
(false-if-exception
(kill pid SIGKILL))))
@@ -196,14 +198,16 @@ or #f. Return #t on success and #f on failure."
;; the loaded cow-store locale files will prevent umounting.
(install-locale locale)
- ;; Save the database, so that it can be restored once the
- ;; cow-store is umounted.
+ ;; Stop the daemon and save the database, so that it can be
+ ;; restored once the cow-store is umounted.
+ (stop-service 'guix-daemon)
(copy-file database-file saved-database)
+
+ (installer-log-line "mounting copy-on-write store")
(mount-cow-store (%installer-target-dir) backing-directory))
(lambda ()
;; We need to drag the guix-daemon to the container MNT
;; namespace, so that it can operate on the cow-store.
- (stop-service 'guix-daemon)
(start-service 'guix-daemon (list (number->string (getpid))))
(setvbuf (current-output-port) 'none)
@@ -211,13 +215,27 @@ or #f. Return #t on success and #f on failure."
(setenv "PATH" "/run/current-system/profile/bin/")
- (set! ret (run-command install-command)))
+ (set! ret (run-command install-command #:tty? #t)))
(lambda ()
- ;; Restart guix-daemon so that it does no keep the MNT namespace
+ ;; Stop guix-daemon so that it does no keep the MNT namespace
;; alive.
- (restart-service 'guix-daemon)
+ (stop-service 'guix-daemon)
+
+ ;; Restore the database and restart it. As part of restoring the
+ ;; database, remove the WAL and shm files in case they were left
+ ;; behind after guix-daemon was stopped. Failing to do so,
+ ;; sqlite might behave as if transactions that appear in the WAL
+ ;; file were committed. (See <https://www.sqlite.org/wal.html>.)
+ (installer-log-line "restoring store database from '~a'"
+ saved-database)
(copy-file saved-database database-file)
+ (for-each (lambda (suffix)
+ (false-if-exception
+ (delete-file (string-append database-file suffix))))
+ '("-wal" "-shm"))
+ (start-service 'guix-daemon)
;; Finally umount the cow-store and exit the container.
+ (installer-log-line "unmounting copy-on-write store")
(unmount-cow-store (%installer-target-dir) backing-directory)
(assert-exit ret))))))))