diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2021-03-19 18:54:16 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2021-03-19 19:07:10 -0700 |
commit | ac7fb852767103578b5f16f9cfd204d10bc362a8 (patch) | |
tree | 70ca879eab55078c6df84f788b99bb57ac55d080 /src/property/chroot.lisp | |
parent | 1f9203181ddb15ca29aebe519aa5712856a9d995 (diff) | |
download | consfigurator-ac7fb852767103578b5f16f9cfd204d10bc362a8.tar.gz |
implement debootstrapping chroots
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/property/chroot.lisp')
-rw-r--r-- | src/property/chroot.lisp | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/src/property/chroot.lisp b/src/property/chroot.lisp index 39a1402..5a4928d 100644 --- a/src/property/chroot.lisp +++ b/src/property/chroot.lisp @@ -26,7 +26,21 @@ (if (test "-d" (merge-pathnames "debootstrap/" (ensure-directory-pathname root))) (progn (mrun "rm" "-rf" root) nil) - (test "-d" root)))) + (test "-d" root))) + (:apply + (let* ((os (car (getf (hostattrs host) :os))) + (args (list (if (os:supports-arch-p (get-hostattrs-car :os) + (os:linux-architecture os)) + "debootstrap" "qemu-debootstrap") + (plist-to-cmd-args options) + (strcat "--arch=" (os:debian-architecture os)) + (os:debian-suite os) + root))) + (when-let ((proxy (get-hostattrs-car :apt.proxy))) + (setq args (list* :env (list :http_proxy proxy) args))) + (when-let ((mirror (get-hostattrs-car :apt.mirror))) + (nconcf args (list mirror))) + (apply #'run args)))) (defpropspec %os-bootstrapper-installed :posix (host) `(os:host-typecase ,host @@ -44,8 +58,22 @@ (defproplist os-bootstrapped :posix (options root properties - &aux (host (preprocess-host - (make-child-host :propspec properties)))) + &aux (host + (preprocess-host + (make-child-host + :propspec + (make-propspec + :systems (propspec-systems properties) + ;; Note that this apply-and-unapply approach will not + ;; work as part of a larger propspec because unapplying + ;; SERVICE:NO-SERVICES doesn't remove the :NO-SERVICES + ;; hostattr. It's only okay because we know that the + ;; unapplication is the last property that will be + ;; applied to HOST (though perhaps not to the chroot). + :propspec `(eseqprops + (service:no-services) + ,(propspec-props properties) + (unapply (service:no-services)))))))) "Bootstrap an OS into ROOT and apply PROPERTIES. OPTIONS is a plist of values to pass to the OS-specific bootstrapping property." (:desc |