mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
installer: final: Introduce call-with-mnt-container.
* gnu/installer/final.scm (call-with-mnt-container): New procedure, (install-system): use it instead of call-with-container, to make sure that the container is not jailed.
This commit is contained in:
parent
b3a83f1ece
commit
cafbc5f390
1 changed files with 16 additions and 3 deletions
|
@ -135,6 +135,20 @@ USERS."
|
||||||
(_ #f))))))
|
(_ #f))))))
|
||||||
pids)))
|
pids)))
|
||||||
|
|
||||||
|
(define (call-with-mnt-container thunk)
|
||||||
|
"This is a variant of call-with-container. Run THUNK in a new container
|
||||||
|
process, within a separate MNT namespace. The container is not jailed so that
|
||||||
|
it can interact with the rest of the system."
|
||||||
|
(let ((pid (run-container "/" '() '(mnt) 1 thunk)))
|
||||||
|
;; Catch SIGINT and kill the container process.
|
||||||
|
(sigaction SIGINT
|
||||||
|
(lambda (signum)
|
||||||
|
(false-if-exception
|
||||||
|
(kill pid SIGKILL))))
|
||||||
|
|
||||||
|
(match (waitpid pid)
|
||||||
|
((_ . status) status))))
|
||||||
|
|
||||||
(define* (install-system locale #:key (users '()))
|
(define* (install-system locale #:key (users '()))
|
||||||
"Create /etc/shadow and /etc/passwd on the installation target for 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
|
Start COW-STORE service on target directory and launch guix install command in
|
||||||
|
@ -181,7 +195,7 @@ or #f. Return #t on success and #f on failure."
|
||||||
;; To avoid this situation, mount the store overlay inside a container,
|
;; To avoid this situation, mount the store overlay inside a container,
|
||||||
;; and run the installation from within that container.
|
;; and run the installation from within that container.
|
||||||
(zero?
|
(zero?
|
||||||
(call-with-container '()
|
(call-with-mnt-container
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(dynamic-wind
|
(dynamic-wind
|
||||||
(lambda ()
|
(lambda ()
|
||||||
|
@ -218,5 +232,4 @@ or #f. Return #t on success and #f on failure."
|
||||||
|
|
||||||
;; Finally umount the cow-store and exit the container.
|
;; Finally umount the cow-store and exit the container.
|
||||||
(unmount-cow-store (%installer-target-dir) backing-directory)
|
(unmount-cow-store (%installer-target-dir) backing-directory)
|
||||||
(assert-exit ret))))
|
(assert-exit ret))))))))
|
||||||
#:namespaces '(mnt)))))
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue