aboutsummaryrefslogtreecommitdiff
path: root/src/property/chroot.lisp
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-07-02 14:35:07 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-07-07 09:48:49 -0700
commit95b0a94667dec6df1c47f505dbc2980dcbe0f34c (patch)
tree5d03b9284458b68cbf7ffc42cfd70ed7951925d2 /src/property/chroot.lisp
parent1bc2164ebe8dccf1080bbee16a318119fbb7b88a (diff)
downloadconsfigurator-95b0a94667dec6df1c47f505dbc2980dcbe0f34c.tar.gz
make installing OS bootstrapper for Debian more flexible
- Accept debootstrap(8) already on PATH -- perhaps manually installed -- on systems where Consfigurator doesn't know how to install debootstrap. - Don't require qemu-user-static when the target arch is natively executable. Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/property/chroot.lisp')
-rw-r--r--src/property/chroot.lisp29
1 files changed, 24 insertions, 5 deletions
diff --git a/src/property/chroot.lisp b/src/property/chroot.lisp
index 3eee67c..3e9ae16 100644
--- a/src/property/chroot.lisp
+++ b/src/property/chroot.lisp
@@ -46,12 +46,31 @@
(nconcf args (list apt.mirror)))
(apply #'run args))))
+(defprop %debootstrap-manually-installed :posix ()
+ (:check (zerop (mrun :for-exit "command" "-v" "debootstrap")))
+ (:apply
+ (failed-change "Don't know how to install debootstrap(8) manually.")))
+
(defpropspec %os-bootstrapper-installed :posix (host)
- (:desc (declare (ignore host)) "OS bootstrapper installed")
- `(os:host-etypecase ,host
- (debian
- (os:etypecase
- (debianlike (apt:installed "debootstrap" "qemu-user-static"))))))
+ (:desc "OS bootstrapper installed")
+ (let ((host (preprocess-host host)))
+ `(os:host-etypecase ,host
+ (debian
+ ;; Have %DEBOOTSTRAP-MANUALLY-INSTALLED like this to enable installing
+ ;; Debian on arbitrary unixes, where Consfigurator doesn't know how to
+ ;; install packages, but the user has manually ensured that
+ ;; debootstrap(8) is on PATH. However, we don't have such an escape
+ ;; hatch for the case where the architectures do not match because
+ ;; ensuring that debootstrap(8) will be able to bootstrap a foreign
+ ;; arch is more involved.
+ (os:typecase
+ (debianlike (apt:installed "debootstrap"))
+ (t (%debootstrap-manually-installed)))
+ ,@(and (not (call-with-os
+ #'os:supports-arch-p
+ (os:linux-architecture (get-hostattrs-car :os host))))
+ '((os:etypecase
+ (debianlike (apt:installed "qemu-user-static")))))))))
(defpropspec %os-bootstrapped :posix (options root host)
"Bootstrap OS into ROOT, e.g. with debootstrap(1)."