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 # 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" 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 fi
# Ensure we have an absolute path # Only create if not already existent
if ! $(echo "$destination" | grep -q ^/); then
echo "Error: Destination ($destination) of $__object_id is not absolute." >&2
exit 1
fi
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\"

View file

@ -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