forked from ungleich-public/cdist
begin cleanup doc for __directory
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
parent
4c59a0fde1
commit
86d98ddec4
2 changed files with 22 additions and 29 deletions
|
@ -20,28 +20,27 @@
|
||||||
#
|
#
|
||||||
# Handle directories
|
# Handle directories
|
||||||
#
|
#
|
||||||
|
#
|
||||||
|
# __directory /etc [--mode --owner --group --parents [yes|no] ]
|
||||||
|
#
|
||||||
|
|
||||||
# If destination was specified, do not use the id
|
destination="/$__object_id"
|
||||||
if [ -f "$__object/parameter/destination" ]; then
|
|
||||||
destination="$(cat "$__object/parameter/destination")"
|
# Include parent directories?
|
||||||
else
|
if [ -f "$__object/parameter/parents" ]; then
|
||||||
# If no destination has been supplied, the id is the destination
|
parents="$(cat "$__object/parameter/parents")"
|
||||||
# Prepend /, which got lost in the object id (and relative paths
|
if [ yes = "$parents" ]; then
|
||||||
# don't make sense)
|
mkdiropt="-p"
|
||||||
destination="/$__object_id"
|
else
|
||||||
fi
|
mkdiropt=""
|
||||||
|
fi
|
||||||
# Ensure we have an absolute path
|
|
||||||
if ! $(echo "$destination" | grep -q ^/); then
|
|
||||||
echo "Error: Destination ($destination) of $__object_id is not absolute." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Only create if not already existent
|
||||||
if [ no = "$(cat "$__object/explorer/exists")" ]; then
|
if [ no = "$(cat "$__object/explorer/exists")" ]; then
|
||||||
echo mkdir \"$destination\"
|
echo mkdir $mkdiropt \"$destination\"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Mode settings
|
# Mode settings
|
||||||
if [ -f "$__object/parameter/mode" ]; then
|
if [ -f "$__object/parameter/mode" ]; then
|
||||||
echo chmod \"$(cat "$__object/parameter/mode")\" \"$destination\"
|
echo chmod \"$(cat "$__object/parameter/mode")\" \"$destination\"
|
||||||
|
|
|
@ -1,30 +1,25 @@
|
||||||
cdist-type__file(7)
|
cdist-type__directory(7)
|
||||||
===================
|
========================
|
||||||
Nico Schottelius <nico-cdist--@--schottelius.org>
|
Nico Schottelius <nico-cdist--@--schottelius.org>
|
||||||
|
|
||||||
|
|
||||||
NAME
|
NAME
|
||||||
----
|
----
|
||||||
cdist-type__file - Create files
|
cdist-type__directory - Create a directory
|
||||||
|
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
-----------
|
-----------
|
||||||
This cdist type allows you to create files on the target.
|
This cdist type allows you to create directories on the target.
|
||||||
|
|
||||||
|
|
||||||
REQUIRED PARAMETERS
|
REQUIRED PARAMETERS
|
||||||
-------------------
|
-------------------
|
||||||
type::
|
None.
|
||||||
Specifies the type of file to be created. Either "directory" or "file"
|
|
||||||
|
|
||||||
|
|
||||||
OPTIONAL PARAMETERS
|
OPTIONAL PARAMETERS
|
||||||
-------------------
|
-------------------
|
||||||
destination::
|
|
||||||
If supplied, use this as the destination on the target. Otherwise the
|
|
||||||
object_id is used.
|
|
||||||
|
|
||||||
group::
|
group::
|
||||||
Group to chgrp to.
|
Group to chgrp to.
|
||||||
|
|
||||||
|
@ -34,9 +29,8 @@ mode::
|
||||||
owner::
|
owner::
|
||||||
User to chown to.
|
User to chown to.
|
||||||
|
|
||||||
source::
|
parents::
|
||||||
If supplied, copy this file from the host running cdist to the target.
|
Whether to create parents as well (mkdir -p behaviour)
|
||||||
If not supplied, an empty file or directory will be created.
|
|
||||||
|
|
||||||
|
|
||||||
EXAMPLES
|
EXAMPLES
|
||||||
|
|
Loading…
Reference in a new issue