aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/package.lisp3
-rw-r--r--src/property.lisp1
-rw-r--r--src/property/chroot.lisp35
3 files changed, 28 insertions, 11 deletions
diff --git a/src/package.lisp b/src/package.lisp
index 11e36c7..bcb83d2 100644
--- a/src/package.lisp
+++ b/src/package.lisp
@@ -125,6 +125,7 @@
#:defhost
#:make-host
#:hostattrs
+ #:preprocess-host
;; deployment.lisp
#:defdeploy
@@ -244,7 +245,7 @@
(:export #:has-account))
(defpackage :consfigurator.property.chroot
- (:use #:cl #:consfigurator)
+ (:use #:cl #:consfigurator #:alexandria)
(:local-nicknames (#:apt #:consfigurator.property.apt)
(#:os #:consfigurator.property.os)
(#:file #:consfigurator.property.file))
diff --git a/src/property.lisp b/src/property.lisp
index 218e289..d08b60d 100644
--- a/src/property.lisp
+++ b/src/property.lisp
@@ -308,6 +308,7 @@ Use DEFPROPLIST/DEFPROPSPEC to avoid trouble."))
(define-property-defining-macro defpropspec (type lambda slots forms)
"Define a property which constructs, evaluates and applies a propspec.
+
This is how you can define a property which works by calling other properties,
in accordance with property combinators.
diff --git a/src/property/chroot.lisp b/src/property/chroot.lisp
index daf39fa..7b53515 100644
--- a/src/property/chroot.lisp
+++ b/src/property/chroot.lisp
@@ -18,21 +18,36 @@
(in-package :consfigurator.property.chroot)
(named-readtables:in-readtable :interpol-syntax)
-(defgeneric os-bootstrap (os root &key)
- (:documentation
- "Bootstrap OS into ROOT, e.g. with debootstrap(1)."))
-
-(defprop %os-bootstrapped :posix (options root host)
+(defprop %debootstrapped :posix (options root host)
+ "Bootstrap The Universal Operating System into ROOT using debootstrap(1)."
(:check
(declare (ignore options host))
- (test "-d" root))
- (:apply
- (apply #'os-bootstrap (car (getf (hostattrs host) :os)) root options)))
+ ;; check whether a previous debootstrap failed partway through
+ (if (test "-d" (merge-pathnames "debootstrap/"
+ (ensure-directory-pathname root)))
+ (progn (mrun "rm" "-rf" root) nil)
+ (test "-d" root))))
+
+(defpropspec %os-bootstrapper-installed :posix (host)
+ `(os:host-typecase ,host
+ (debian
+ (os:typecase
+ (debian (apt:installed "debootstrap"))))))
+
+(defpropspec %os-bootstrapped :posix (options root host)
+ "Bootstrap OS into ROOT, e.g. with debootstrap(1)."
+ (once-only (host)
+ `(os:host-typecase ,host
+ (debian (%debootstrapped ,options ,root ,host)))))
(defproplist os-bootstrapped :posix
- (options root properties &aux (host (make-host :propspec properties)))
+ (options root properties
+ &aux (host (preprocess-host (make-host :propspec properties))))
+ "Bootstrap an OS into ROOT and apply PROPERTIES.
+OPTIONS is a value to pass to the OS-specific bootstrapping property."
(:desc
- (declare (ignore options host))
+ (declare (ignore options properties))
#?"Built chroot ${root}")
+ (%os-bootstrapper-installed host)
(%os-bootstrapped options root host)
(deploys `((:chroot :into ,root)) host))