diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2021-03-27 19:21:01 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2021-03-27 19:21:01 -0700 |
commit | 5239b8d8fd2cca9beccdc62e6a616816f8c5cf31 (patch) | |
tree | f7aea404c78c4d7edadbc5f6ba654c748f3edf96 | |
parent | 563ecad0707ff24709e87e7c2fee4d86e5d33444 (diff) | |
download | consfigurator-5239b8d8fd2cca9beccdc62e6a616816f8c5cf31.tar.gz |
AS combinator: special case where USER is "root"
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
-rw-r--r-- | src/combinator.lisp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/combinator.lisp b/src/combinator.lisp index 4c61a9b..0806e45 100644 --- a/src/combinator.lisp +++ b/src/combinator.lisp @@ -136,5 +136,13 @@ ON-CHANGE in order." :args (cdr propapp))) (defmacro as (user &body properties) - "Apply PROPERTIES as USER by reconnecting with the :AS connection type." - `(reconnects. `((:as :to ,,user)) ,@properties)) + "Apply PROPERTIES as USER by reconnecting with the :AS connection type. +Note that the :AS connection type requires root, so as a special case, this +macro just expands to ESEQPROPS if USER is the literal string \"root\" +(without evaluation). This makes it possible to use this macro to annotate +applications of properties which are normally applied by non-root, to make it +explicit that in this case they're being applied as root, e.g. that they will +affect /root and not /home." + (if (and (stringp user) (string= user "root")) + `(eseqprops ,@properties) + `(reconnects. `((:as :to ,,user)) ,@properties))) |