diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2021-03-04 16:29:39 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2021-03-04 16:29:39 -0700 |
commit | 160b76c2bef0541ebcae3363ceebb0666e227451 (patch) | |
tree | dde309dc5666138500a4bbf49d8724158b31a2af | |
parent | cebded4616c69a59767f2f19a071dfda0357d513 (diff) | |
download | consfigurator-160b76c2bef0541ebcae3363ceebb0666e227451.tar.gz |
start figuring out representation of host operating systems
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
-rw-r--r-- | consfigurator.asd | 1 | ||||
-rw-r--r-- | src/package.lisp | 10 | ||||
-rw-r--r-- | src/property/chroot.lisp | 6 | ||||
-rw-r--r-- | src/property/os.lisp | 57 |
4 files changed, 71 insertions, 3 deletions
diff --git a/consfigurator.asd b/consfigurator.asd index c65a47f..3630eea 100644 --- a/consfigurator.asd +++ b/consfigurator.asd @@ -26,6 +26,7 @@ (:file "src/connection/chroot/fork") (:file "src/property/cmd") (:file "src/property/file") + (:file "src/property/os") (:file "src/property/chroot") (:file "src/data/asdf") (:file "src/data/pgp"))) diff --git a/src/package.lisp b/src/package.lisp index 323af1c..96fbf94 100644 --- a/src/package.lisp +++ b/src/package.lisp @@ -97,6 +97,7 @@ ;; host.lisp #:defhost #:make-host + #:hostattrs ;; deployment.lisp #:defdeploy @@ -185,6 +186,15 @@ #:host-secret-uploaded #:regex-replaced-lines)) +(defpackage :consfigurator.property.os + (:use #:cl #:consfigurator) + (:export #:unixlike + #:linux + #:debian + #:debian-stable + #:debian-testing + #:debian-unstable)) + (defpackage :consfigurator.data.asdf (:use #:cl #:consfigurator)) diff --git a/src/property/chroot.lisp b/src/property/chroot.lisp index 41de6a8..9d0acd1 100644 --- a/src/property/chroot.lisp +++ b/src/property/chroot.lisp @@ -18,9 +18,9 @@ (in-package :consfigurator.property.chroot) (named-readtables:in-readtable :interpol-syntax) -(defgeneric os-bootstrap (host root &key) +(defgeneric os-bootstrap (os root &key) (:documentation - "Bootstrap HOST's OS into ROOT, e.g. with debootstrap(1).")) + "Bootstrap OS into ROOT, e.g. with debootstrap(1).")) (defproplist os-bootstrapped :posix (options root properties &aux (host (make-host :props properties))) @@ -33,4 +33,4 @@ (declare (ignore options host)) (test "-d" root)) (:apply - (apply #'os-bootstrap host root options))) + (apply #'os-bootstrap (car (getf (hostattrs host) :os)) root options))) diff --git a/src/property/os.lisp b/src/property/os.lisp new file mode 100644 index 0000000..28e88d3 --- /dev/null +++ b/src/property/os.lisp @@ -0,0 +1,57 @@ +;;; Consfigurator -- Lisp declarative configuration management system + +;;; Copyright (C) 2021 Sean Whitton <spwhitton@spwhitton.name> + +;;; This file is free software; you can redistribute it and/or modify +;;; it under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3, or (at your option) +;;; any later version. + +;;; This file is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. + +;;; You should have received a copy of the GNU General Public License +;;; along with this program. If not, see <http://www.gnu.org/licenses/>. + +(in-package :consfigurator.property.os) + +(defclass unixlike () ()) + +(defclass linux (unixlike) + ((architecture + :initarg :arch :reader linux-architecture + :documentation + "Keyword whose name is Debian's name for this architecture, e.g. :AMD64"))) + +(defclass debian (linux) + ((suite :initarg :suite + :reader debian-suite + :initform (error "Must provide suite")))) + +(defclass debian-stable (debian) ()) + +(defprop debian-stable :posix (suite architecture) + (:hostattrs + (push-hostattrs :os + (make-instance 'debian-stable + :architecture architecture :suite suite)))) + +(defclass debian-testing (debian) + ((suite :initform "testing"))) + +(defprop debian-testing :posix (architecture) + (:hostattrs + (push-hostattrs :os + (make-instance 'debian-testing + :architecture architecture)))) + +(defclass debian-unstable (debian) + ((suite :initform "unstable"))) + +(defprop debian-unstable :posix (architecture) + (:hostattrs + (push-hostattrs :os + (make-instance 'debian-unstable + :architecture architecture)))) |