aboutsummaryrefslogtreecommitdiff
path: root/src/property/apt.lisp
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-03-09 09:57:52 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-03-09 09:57:52 -0700
commit2f07b4ef28c4fc724e2fc02f8d7ea1c862c09ea2 (patch)
tree0efcab60d15eb9fb475343c05f48ccf16e4ad912 /src/property/apt.lisp
parent734a62c560278b585996ef9579d4fdc1407d25d3 (diff)
downloadconsfigurator-2f07b4ef28c4fc724e2fc02f8d7ea1c862c09ea2.tar.gz
add APT::WITH-MAYBE-UPDATE
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/property/apt.lisp')
-rw-r--r--src/property/apt.lisp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/property/apt.lisp b/src/property/apt.lisp
index c1db717..75009a6 100644
--- a/src/property/apt.lisp
+++ b/src/property/apt.lisp
@@ -18,6 +18,12 @@
(in-package :consfigurator.property.apt)
(named-readtables:in-readtable :interpol-syntax)
+(defmacro with-maybe-update (form)
+ `(handler-case ,form
+ (run-failed ()
+ (apt-get :princ "update")
+ ,form)))
+
(defprop installed :posix (&rest packages)
"Ensure all of the apt packages PACKAGES are installed."
(:desc #?"apt installed @{packages}")
@@ -27,7 +33,7 @@
(:check
(all-installed packages))
(:apply
- (apt-get :princ "-y" "install" packages)))
+ (with-maybe-update (apt-get :princ "-y" "install" packages))))
(defun all-installed (packages)
(loop