forked from ungleich-public/cdist
__acl: add --file and --directory for convenience
This commit is contained in:
parent
5089f9055e
commit
1fbd2fc2bd
4 changed files with 33 additions and 1 deletions
|
@ -20,7 +20,13 @@
|
|||
|
||||
file_is="$( cat "$__object/explorer/file_is" )"
|
||||
|
||||
[ "$file_is" = 'missing' ] && [ -z "$__cdist_dry_run" ] && exit 0
|
||||
if [ "$file_is" = 'missing' ] \
|
||||
&& [ -z "$__cdist_dry_run" ] \
|
||||
&& \( [ ! -f "$__object/parameter/file" ] \
|
||||
|| [ ! -f "$__object/parameter/directory" ] \)
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
os="$( cat "$__global/explorer/os" )"
|
||||
|
||||
|
|
|
@ -26,6 +26,12 @@ source
|
|||
Ordering of entries is not important.
|
||||
When reading from file, comments and empty lines are ignored.
|
||||
|
||||
file
|
||||
Create/change file with ``__file`` using ``user:group:mode`` pattern.
|
||||
|
||||
directory
|
||||
Create/change directory with ``__directory`` using ``user:group:mode`` pattern.
|
||||
|
||||
|
||||
BOOLEAN PARAMETERS
|
||||
------------------
|
||||
|
@ -83,6 +89,13 @@ EXAMPLES
|
|||
echo 'user:alice:rwx' \
|
||||
| __acl /path/to/directory --source -
|
||||
|
||||
# create/change directory too
|
||||
__acl /path/to/directory \
|
||||
--default \
|
||||
--remove \
|
||||
--directory root:root:770 \
|
||||
--entry user:nobody:rwx
|
||||
|
||||
|
||||
AUTHORS
|
||||
-------
|
||||
|
|
11
cdist/conf/type/__acl/manifest
Executable file
11
cdist/conf/type/__acl/manifest
Executable file
|
@ -0,0 +1,11 @@
|
|||
#!/bin/sh -e
|
||||
|
||||
for p in file directory
|
||||
do
|
||||
[ ! -f "$__object/parameter/$p" ] && continue
|
||||
|
||||
"__$p" "/$__object_id" \
|
||||
--owner "$( awk -F: '{print $1}' "$__object/parameter/$p" )" \
|
||||
--group "$( awk -F: '{print $2}' "$__object/parameter/$p" )" \
|
||||
--mode "$( awk -F: '{print $3}' "$__object/parameter/$p" )"
|
||||
done
|
|
@ -1,3 +1,5 @@
|
|||
mask
|
||||
other
|
||||
source
|
||||
file
|
||||
directory
|
||||
|
|
Loading…
Reference in a new issue