begin cleanup doc for __directory

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-03-15 21:06:18 +01:00
parent 4c59a0fde1
commit 86d98ddec4
2 changed files with 22 additions and 29 deletions

View file

@ -20,28 +20,27 @@
#
# Handle directories
#
#
# __directory /etc [--mode --owner --group --parents [yes|no] ]
#
# If destination was specified, do not use the id
if [ -f "$__object/parameter/destination" ]; then
destination="$(cat "$__object/parameter/destination")"
else
# If no destination has been supplied, the id is the destination
# Prepend /, which got lost in the object id (and relative paths
# don't make sense)
destination="/$__object_id"
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
destination="/$__object_id"
# Include parent directories?
if [ -f "$__object/parameter/parents" ]; then
parents="$(cat "$__object/parameter/parents")"
if [ yes = "$parents" ]; then
mkdiropt="-p"
else
mkdiropt=""
fi
fi
# Only create if not already existent
if [ no = "$(cat "$__object/explorer/exists")" ]; then
echo mkdir \"$destination\"
echo mkdir $mkdiropt \"$destination\"
fi
# Mode settings
if [ -f "$__object/parameter/mode" ]; then
echo chmod \"$(cat "$__object/parameter/mode")\" \"$destination\"

View file

@ -1,30 +1,25 @@
cdist-type__file(7)
===================
cdist-type__directory(7)
========================
Nico Schottelius <nico-cdist--@--schottelius.org>
NAME
----
cdist-type__file - Create files
cdist-type__directory - Create a directory
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
-------------------
type::
Specifies the type of file to be created. Either "directory" or "file"
None.
OPTIONAL PARAMETERS
-------------------
destination::
If supplied, use this as the destination on the target. Otherwise the
object_id is used.
group::
Group to chgrp to.
@ -34,9 +29,8 @@ mode::
owner::
User to chown to.
source::
If supplied, copy this file from the host running cdist to the target.
If not supplied, an empty file or directory will be created.
parents::
Whether to create parents as well (mkdir -p behaviour)
EXAMPLES