From 446b8f4a8ef78cb4605cfb551255bb455be411f0 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Thu, 16 Sep 2021 18:23:55 -0700 Subject: install system deps by searching for package managers on PATH With this change we handle the situation in which we don't know the OS of a host on which we need to install system packages more cleanly than before. Also rely on the new PACKAGE:INSTALLED to install the OS bootstrapper in INSTALLER:CLEANLY-INSTALLED-ONCE. This allows us to simplify usage of the property by replacing the ORIGINAL-OS argument with ORIGINAL-OS-ARCHITECTURE. Making this change does mean that we now have two ways to specify the different names a package has on different OSs: (i) something like OS:ETYPECASE where each branch applies a property which invokes an OS-specific package manager; and (ii) the plists supplied to PACKAGE:INSTALLED. Signed-off-by: Sean Whitton --- src/property/chroot.lisp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'src/property/chroot.lisp') diff --git a/src/property/chroot.lisp b/src/property/chroot.lisp index 3cfe527..78ac0a3 100644 --- a/src/property/chroot.lisp +++ b/src/property/chroot.lisp @@ -53,26 +53,25 @@ (nconcf args (list apt.mirror))) (apply #'run args)))) -(defprop %debootstrap-manually-installed :posix () +(defproplist %debootstrap-manually-installed :posix () + ;; Accept any debootstrap we find on path to enable installing Debian on + ;; arbitrary unixes, where Consfigurator does not know how to install + ;; packages, but the user has manually installed debootstrap(8). (:check (remote-executable-find "debootstrap")) - (:apply - (failed-change "Don't know how to install debootstrap(8) manually."))) + (package:installed nil '(:apt ("debootstrap")))) (defpropspec %os-bootstrapper-installed :posix (host) (: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))) + ;; Don't have an escape hatch like the :CHECK subroutine of + ;; %DEBOOTSTRAP-MANUALLY-INSTALLED 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. ,@(and (not (call-with-os #'os:supports-arch-p (os:linux-architecture (get-hostattrs-car :os host)))) -- cgit v1.2.3