aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-10-29 14:42:07 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-11-01 11:42:58 -0700
commitc1c330e4a5a48b75ffdd7c5630e03e9ebde0ab13 (patch)
tree4c79e9409085748a521c540a8949b1211b0c8101
parent8d400b8ca49da223f55c13a11e4f1de76a80ee24 (diff)
downloadconsfigurator-c1c330e4a5a48b75ffdd7c5630e03e9ebde0ab13.tar.gz
add APT:BACKPORTS-INSTALLED{,-MINIMALLY}
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
-rw-r--r--src/package.lisp2
-rw-r--r--src/property/apt.lisp28
2 files changed, 30 insertions, 0 deletions
diff --git a/src/package.lisp b/src/package.lisp
index ef1d193..7692bc3 100644
--- a/src/package.lisp
+++ b/src/package.lisp
@@ -449,6 +449,8 @@
(#:service #:consfigurator.property.service))
(:export #:installed
#:installed-minimally
+ #:backports-installed
+ #:backports-installed-minimally
#:removed
#:reconfigured
#:service-installed-running
diff --git a/src/property/apt.lisp b/src/property/apt.lisp
index 2197148..7204e25 100644
--- a/src/property/apt.lisp
+++ b/src/property/apt.lisp
@@ -58,6 +58,34 @@
(with-maybe-update
(apt-get :inform "-y" "--no-install-recommends" "install" packages))))
+(defun install-backports (args packages)
+ (with-maybe-update
+ (with-changes-dpkg-status
+ (apt-get :inform args "install"
+ (loop with suite = (os:debian-suite (get-hostattrs-car :os))
+ for pkg in packages
+ collect (format nil "~A/~A-backports" pkg suite))))))
+
+(defprop backports-installed :posix (&rest packages)
+ "Ensure all of the apt packages PACKAGES are installed from stable-backports.
+
+Note that if installing any of the backports requires installing versions of
+the backport's dependencies from stable-backports too, you will need to list
+each of those dependencies in PACKAGES."
+ (:desc (format nil "apt installed backport~P ~{~A~^ ~}"
+ (length packages) packages))
+ (:preprocess (flatten packages))
+ (:hostattrs (os:required 'os:debian-stable))
+ (:apply (install-backports '("-y") packages)))
+
+(defprop backports-installed-minimally :posix (&rest packages)
+ "Like APT:BACKPORTS-INSTALLED but don't install recommends."
+ (:desc (format nil "apt installed backport~P ~{~A~^ ~}"
+ (length packages) packages))
+ (:preprocess (flatten packages))
+ (:hostattrs (os:required 'os:debian-stable))
+ (:apply (install-backports '("-y" "--no-install-recommends") packages)))
+
(defprop removed :posix (&rest packages)
"Ensure all of the apt packages PACKAGES are removed."
(:desc #?"apt removed @{packages}")