diff --git a/.gitignore b/.gitignore
index ba65e3f8..d7c6f7c2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,8 @@
+# -vim
.*.swp
+
+# Ignore generated manpages
doc/man/*.[1-9]
doc/man/.marker
doc/man/man*/
+conf/type/*/*.7
diff --git a/Makefile b/Makefile
index adf03e31..a6d78aeb 100644
--- a/Makefile
+++ b/Makefile
@@ -27,7 +27,6 @@ MANSRC=$(MANDIR)/cdist.text \
$(MANDIR)/cdist-stages.text \
$(MANDIR)/cdist-type.text \
$(MANDIR)/cdist-type-template.text \
- $(MANDIR)/cdist-type__file.text \
################################################################################
@@ -47,16 +46,33 @@ all:
man: doc/man/.marker
-doc/man/.marker: $(MANSRC) $(MANGENERATED)
- for mansrc in $^; do $(A2X) $$mansrc; done
- for manpage in $(MANDIR)/*.[1-9]; do cat=$${manpage##*.}; mandir=$(MANDIR)/man$$cat; mkdir -p $$mandir; mv $$manpage $$mandir; done
+doc/man/.marker: $(MANDIR)/cdist-reference.text
touch $@
-# Only depends on cdist-type__*.text in reality
-$(MANDIR)/cdist-reference.text: $(MANSRC) $(MANDIR)/cdist-reference.text.sh
- $(MANDIR)/cdist-reference.text.sh
-
+# Manual from core
+mancore: $(MANSRC)
+ for mansrc in $^; do $(A2X) $$mansrc; done
+# Manuals from types
+mantype:
+ for man in conf/type/*/man.text; do $(A2X) $$man; done
+
+# Move into manpath directories
+manmove: mantype mancore
+ for manpage in $(MANDIR)/*.[1-9] conf/type/*/*.7; do \
+ cat=$${manpage##*.}; \
+ mandir=$(MANDIR)/man$$cat; \
+ mkdir -p $$mandir; \
+ mv $$manpage $$mandir; \
+ done
+
+# Reference depends on conf/type/*/man.text - HOWTO with posix make?
+$(MANDIR)/cdist-reference.text: manmove $(MANDIR)/cdist-reference.text.sh
+ $(MANDIR)/cdist-reference.text.sh
+ $(A2X) $(MANDIR)/cdist-reference.text
+ # Move us to the destination as well
+ make manmove
+
clean:
rm -rf doc/man/*.html doc/man/*.[1-9] doc/man/man[1-9] $(MANGENERATED)
diff --git a/REAL_README b/REAL_README
index ab070b38..0938289f 100644
--- a/REAL_README
+++ b/REAL_README
@@ -1,5 +1,20 @@
[[!meta title="cdist - configuration management"]]
+
+ .. . .x+=:. s
+ dF @88> z` ^% :8
+ '88bu. %8P . .
+#
+#
+# Setup environment for use with cdist
+#
+
+. cdist-config
+[ $# -eq 0 ] || __cdist_usage "no arguments"
+
+# Allow access to unset variables like PATH and MANPATH
+set +u
+
+echo export PATH=$__cdist_abs_mydir:$PATH
+
+cd "$__cdist_abs_mydir/../doc/man"
+echo export MANPATH=$(pwd -P):$MANPATH
diff --git a/bin/cdist-type-emulator b/bin/cdist-type-emulator
index 69be9405..a4f66e5b 100755
--- a/bin/cdist-type-emulator
+++ b/bin/cdist-type-emulator
@@ -25,12 +25,18 @@
#
. cdist-config
-[ $# -ge 1 ] || __cdist_usage " "
set -eu
-__cdist_object_id="$1"; shift
__cdist_type="$__cdist_myname"
+# Find out whether type is a singleton or regular type
+if [ -f "$(__cdist_type_singleton "$__cdist_type")" ]; then
+ __cdist_object_id="singleton"
+else
+ [ $# -ge 1 ] || __cdist_usage " "
+ __cdist_object_id="$1"; shift
+fi
+
echo "$__cdist_object_id" | grep -q "^${__cdist_sane_regexp}\$" || \
__cdist_usage "Insane object id, ${__cdist_object_id}."
@@ -72,20 +78,24 @@ while [ $# -gt 0 ]; do
done
# Ensure required parameters are given
-while read required; do
- if [ ! -f "${tempparameter}/${required}" ]; then
- __cdist_usage "Missing required parameter $required"
- fi
+if [ -f "$(__cdist_type_parameter_required "$__cdist_type")" ]; then
+ while read required; do
+ if [ ! -f "${tempparameter}/${required}" ]; then
+ __cdist_usage "Missing required parameter $required"
+ fi
- mv "${tempparameter}/${required}" "${__cdist_parameter_dir}"
-done < "$(__cdist_type_parameter_file "$__cdist_type" "$__cdist_name_parameter_required")"
+ mv "${tempparameter}/${required}" "${__cdist_parameter_dir}"
+ done < "$(__cdist_type_parameter_required "$__cdist_type")"
+fi
# Allow optional parameters
-while read optional; do
- if [ -f "${tempparameter}/${optional}" ]; then
- mv "${tempparameter}/${optional}" "${__cdist_parameter_dir}"
- fi
-done < "$(__cdist_type_parameter_file "$__cdist_type" "$__cdist_name_parameter_optional")"
+if [ -f "$(__cdist_type_parameter_optional "$__cdist_type")" ]; then
+ while read optional; do
+ if [ -f "${tempparameter}/${optional}" ]; then
+ mv "${tempparameter}/${optional}" "${__cdist_parameter_dir}"
+ fi
+ done < "$(__cdist_type_parameter_optional "$__cdist_type")"
+fi
# Error out on other paramaters
cd "${tempparameter}"
diff --git a/conf/manifest/init b/conf/manifest/init
deleted file mode 100755
index beccc84b..00000000
--- a/conf/manifest/init
+++ /dev/null
@@ -1,34 +0,0 @@
-#
-# This is a sample manifest, but used in real world
-#
-
-# This is debug and should not be in a production environment
-echo "We could access other manifests in $__manifest"
-
-__file /etc/cdist-configured --type file
-
-case "$__target_host" in
- # Everybody has this
- localhost)
- __file test --type file --destination /tmp/cdist-testfile
- ;;
-
- # Alias in /etc/hosts for localhost
- cdist-archlinux)
- __package_pacman django --state uninstalled
- __package_pacman wireshark-cli --state installed
- __package_pacman zsh --state installed
- ;;
- cdist-gentoo)
- __package tree --state installed
- ;;
-
- # Real machines
- ikq*)
- __package_apt zsh --state installed
- __package_apt apache2 --state uninstalled
- ;;
- kr)
- __issue iddoesnotmatterhere
- ;;
-esac
diff --git a/conf/type/__addifnosuchline/explorer/findline b/conf/type/__addifnosuchline/explorer/findline
new file mode 100755
index 00000000..c1633626
--- /dev/null
+++ b/conf/type/__addifnosuchline/explorer/findline
@@ -0,0 +1,38 @@
+#!/bin/sh
+#
+# 2010-2011 Daniel Roth (dani-cdist@d-roth.li)
+#
+# This file is part of cdist.
+#
+# cdist is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# cdist is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with cdist. If not, see .
+#
+#
+
+if [ -f "$__object/parameter/file" ]; then
+ file=$(cat "$__object/parameter/file")
+else
+ file="/$__object_id"
+fi
+
+regex=$(cat "$__object/parameter/line")
+if [ -f "$file" ]; then
+ grep -q "^$regex\$" "$file"
+ if [ $? -eq 1 ]; then
+ echo "NOTFOUND"
+ else
+ echo "FOUND"
+ fi
+else
+ echo "NOTFOUND"
+fi
diff --git a/conf/type/__addifnosuchline/gencode b/conf/type/__addifnosuchline/gencode
new file mode 100755
index 00000000..f97789ae
--- /dev/null
+++ b/conf/type/__addifnosuchline/gencode
@@ -0,0 +1,33 @@
+#!/bin/sh
+#
+# 2010-2011 Daniel Roth (dani-cdist@d-roth.li)
+#
+# This file is part of cdist.
+#
+# cdist is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# cdist is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with cdist. If not, see .
+#
+#
+
+if [ -f "$__object/parameter/file" ]; then
+ file=$(cat "$__object/parameter/file")
+else
+ file="/$__object_id"
+fi
+
+result=$(cat "$__object/explorer/findline")
+
+if [ "$result" = "NOTFOUND" ]; then
+ line=$(cat "$__object/parameter/line")
+ echo "echo $line >> $file"
+fi
diff --git a/conf/type/__addifnosuchline/parameter/optional b/conf/type/__addifnosuchline/parameter/optional
new file mode 100644
index 00000000..f73f3093
--- /dev/null
+++ b/conf/type/__addifnosuchline/parameter/optional
@@ -0,0 +1 @@
+file
diff --git a/conf/type/__addifnosuchline/parameter/required b/conf/type/__addifnosuchline/parameter/required
new file mode 100644
index 00000000..a999a0c2
--- /dev/null
+++ b/conf/type/__addifnosuchline/parameter/required
@@ -0,0 +1 @@
+line
diff --git a/conf/type/__file/explorer/exists b/conf/type/__file/explorer/exists
new file mode 100755
index 00000000..b0be82fc
--- /dev/null
+++ b/conf/type/__file/explorer/exists
@@ -0,0 +1,34 @@
+#!/bin/sh
+#
+# 2011 Nico Schottelius (nico-cdist at schottelius.org)
+#
+# This file is part of cdist.
+#
+# cdist is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# cdist is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with cdist. If not, see .
+#
+#
+# Check whether file exists or not
+#
+
+if [ -f "$__object/parameter/destination" ]; then
+ destination="$(cat "$__object/parameter/destination")"
+else
+ destination="/$__object_id"
+fi
+
+if [ -e "$destination" ]; then
+ echo yes
+else
+ echo no
+fi
diff --git a/conf/type/__file/explorer/md5sum b/conf/type/__file/explorer/md5sum
index b2867385..4ac0e1b9 100755
--- a/conf/type/__file/explorer/md5sum
+++ b/conf/type/__file/explorer/md5sum
@@ -41,7 +41,11 @@ esac
# No output if file does not exist - does definitely not match the md5sum :-)
if [ -e "$destination" ]; then
- $md5sum < "$destination"
+ if [ -f "$destination" ]; then
+ $md5sum < "$destination"
+ else
+ echo "NO REGULAR FILE"
+ fi
else
echo "NO FILE FOUND, NO CHECKSUM CALCULATED."
fi
diff --git a/conf/type/__file/gencode b/conf/type/__file/gencode
index 0f3b1bf8..5f386349 100755
--- a/conf/type/__file/gencode
+++ b/conf/type/__file/gencode
@@ -22,8 +22,6 @@
# example for typewrites later
#
-type="$(cat "$__object/parameter/type")"
-
# If destination was specified, do not use the id
if [ -f "$__object/parameter/destination" ]; then
destination="$(cat "$__object/parameter/destination")"
@@ -40,6 +38,7 @@ if ! $(echo "$destination" | grep -q ^/); then
exit 1
fi
+# Use correct md5sum binary - MacOSx is different here
case "$os" in
macosx)
md5sum="md5"
@@ -50,40 +49,65 @@ case "$os" in
;;
esac
-# Copy source if existing
-# FIXME: directory handling not supported - add recursive flag?
-if [ -f "$__object/parameter/source" ]; then
- source="$(cat "$__object/parameter/source")"
+type="$(cat "$__object/parameter/type")"
- local_md5sum="$($md5sum < "$source")"
- remote_md5sum="$(cat "$__object/explorer/md5sum")"
-
- # Is md5sum the right approach?
- if [ "$local_md5sum" != "$remote_md5sum" ]; then
- # FIXME: This is ugly and hardcoded, replace after 1.0!
- # Probably a better aproach is to have the user configured
- # ~/.ssh/config to contain the right username
- # Probably describe it in cdist-quickstart...
- scp "$source" "root@${__target_host}:${destination}"
- fi
-# No source? Create empty file/dir
-else
- case "$type" in
- directory)
- echo mkdir \"$destination\"
- ;;
-
- file)
- echo touch \"$destination\"
- ;;
-
- *)
- echo "Unsupported type: \"$type\"" >&2
+case "$type" in
+ directory)
+ if [ -f "$__object/parameter/source" ]; then
+ echo "Source not supported for directory currently - FIXME" >&2
exit 1
- ;;
- esac
-fi
+ else
+ if [ no = "$(cat "$__object/explorer/exists")" ]; then
+ echo mkdir \"$destination\"
+ fi
+ fi
+ ;;
+ file)
+ if [ -f "$__object/parameter/source" ]; then
+ source="$(cat "$__object/parameter/source")"
+
+ if [ -f "$source" ]; then
+ local_md5sum="$($md5sum < "$source")"
+ remote_md5sum="$(cat "$__object/explorer/md5sum")"
+
+ # FIXME: Is md5sum the right approach?
+ if [ "$local_md5sum" != "$remote_md5sum" ]; then
+ # FIXME: This is ugly and hardcoded, replace after 1.0!
+ # Probably a better aproach is to have the user configured
+ # ~/.ssh/config to contain the right username
+ # Probably describe it in cdist-quickstart...
+ scp "$source" "root@${__target_host}:${destination}"
+ fi
+ else
+ echo "Source \"$source\" does not exist." >&2
+ exit 1
+ fi
+ else
+ if [ no = "$(cat "$__object/explorer/exists")" ]; then
+ echo touch \"$destination\"
+ fi
+ fi
+ ;;
+
+ symlink)
+ if [ ! -f "$__object/parameter/source" ]; then
+ echo "Source required for symlink" >&2
+ exit 1
+ fi
+ source="$(cat "$__object/parameter/source")"
+
+ # FIXME: handle directories or document & ignore?
+ echo ln -sf \"$source\" \"$destination\"
+ ;;
+
+ *)
+ echo "Unsupported type: \"$type\"" >&2
+ exit 1
+ ;;
+esac
+
+# Mode settings
if [ -f "$__object/parameter/mode" ]; then
mode="$(cat "$__object/parameters/mode")"
echo chmod \"$mode\" \"$destination\"
diff --git a/doc/man/cdist-type__file.text b/conf/type/__file/man.text
similarity index 100%
rename from doc/man/cdist-type__file.text
rename to conf/type/__file/man.text
diff --git a/conf/type/__issue/README b/conf/type/__issue/README
deleted file mode 100644
index f7bbde5c..00000000
--- a/conf/type/__issue/README
+++ /dev/null
@@ -1 +0,0 @@
-Manage /etc/issue
diff --git a/conf/type/__issue/man.text b/conf/type/__issue/man.text
new file mode 100644
index 00000000..57ece530
--- /dev/null
+++ b/conf/type/__issue/man.text
@@ -0,0 +1,41 @@
+cdist-type__issue(7)
+===================
+Nico Schottelius
+
+
+NAME
+----
+cdist-type__issue - Manage issue
+
+
+DESCRIPTION
+-----------
+This cdist type allows you to easily setup /etc/issue.
+
+
+REQUIRED PARAMETERS
+-------------------
+None.
+
+
+OPTIONAL PARAMETERS
+-------------------
+None
+
+EXAMPLES
+--------
+
+--------------------------------------------------------------------------------
+__issue
+--------------------------------------------------------------------------------
+
+
+SEE ALSO
+--------
+- cdist-type(7)
+
+
+COPYING
+-------
+Copyright \(C) 2011 Nico Schottelius. Free use of this software is
+granted under the terms of the GNU General Public License version 3 (GPLv3).
diff --git a/conf/type/__issue/manifest b/conf/type/__issue/manifest
index a79544ee..aa6f7629 100755
--- a/conf/type/__issue/manifest
+++ b/conf/type/__issue/manifest
@@ -20,7 +20,7 @@
#
destination=/etc/issue
-os="$(cat "out/explorer/os")"
+source="$(cat "out/explorer/os")"
case "$os" in
archlinux)
diff --git a/conf/type/__issue/parameter/optional b/conf/type/__issue/singleton
similarity index 100%
rename from conf/type/__issue/parameter/optional
rename to conf/type/__issue/singleton
diff --git a/conf/type/__motd/files/motd b/conf/type/__motd/files/motd
new file mode 100644
index 00000000..fcba183d
--- /dev/null
+++ b/conf/type/__motd/files/motd
@@ -0,0 +1,16 @@
+
+ .. . .x+=:. s
+ dF @88> z` ^% :8
+ '88bu. %8P .
+
+
+NAME
+----
+cdist-type__motd - Manage message of the day
+
+
+DESCRIPTION
+-----------
+This cdist type allows you to easily setup /etc/motd.
+
+
+REQUIRED PARAMETERS
+-------------------
+None.
+
+
+OPTIONAL PARAMETERS
+-------------------
+source::
+ If supplied, copy this file from the host running cdist to the target.
+ If not supplied, a default message will be placed onto the target.
+
+
+EXAMPLES
+--------
+
+--------------------------------------------------------------------------------
+# Use cdist defaults
+__motd
+
+# Supply source file from a different type
+__file --source "$__type/files/my-motd"
+--------------------------------------------------------------------------------
+
+
+SEE ALSO
+--------
+- cdist-type(7)
+
+
+COPYING
+-------
+Copyright \(C) 2011 Nico Schottelius. Free use of this software is
+granted under the terms of the GNU General Public License version 3 (GPLv3).
diff --git a/conf/type/__motd/manifest b/conf/type/__motd/manifest
new file mode 100755
index 00000000..594977b9
--- /dev/null
+++ b/conf/type/__motd/manifest
@@ -0,0 +1,31 @@
+#!/bin/sh
+#
+# 2011 Nico Schottelius (nico-cdist at schottelius.org)
+#
+# This file is part of cdist.
+#
+# cdist is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# cdist is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with cdist. If not, see .
+#
+#
+
+destination=/etc/motd
+
+# Select motd source
+if [ -f "$__object/parameter/source" ]; then
+ source="$(cat "$__object/parameter/source")"
+else
+ source="$__type/files/motd"
+fi
+
+__file "$destination" --source "$source" --type file
diff --git a/conf/type/__issue/parameter/required b/conf/type/__motd/singleton
similarity index 100%
rename from conf/type/__issue/parameter/required
rename to conf/type/__motd/singleton
diff --git a/conf/type/__package_apt/gencode b/conf/type/__package_apt/gencode
index c85242e6..370f0102 100755
--- a/conf/type/__package_apt/gencode
+++ b/conf/type/__package_apt/gencode
@@ -29,7 +29,7 @@ fi
state="$(cat "$__object/parameter/state")"
-is_installed="$(grep "^Status: install ok installed" "$__object/explorer/pkg_status")"
+is_installed="$(grep "^Status: install ok installed" "$__object/explorer/pkg_status" || true)"
case "$state" in
installed)
diff --git a/doc/changelog b/doc/changelog
index 4ec2c47f..c939b547 100644
--- a/doc/changelog
+++ b/doc/changelog
@@ -1,3 +1,14 @@
+1.0.4:
+ * New type __motd
+ * New type __addifnosuchline
+ * Document type __issue
+
+1.0.3: 2011-03-11
+ * Update regexp used for sane characters
+ * Allow types without parameters
+ * Allow type to be singleton
+ * Type __file learned --type symlink
+
1.0.2: 2011-03-09
* Add manpages: cdist-type, cdist-type__file, cdist-reference, cdist-explorer
* Make doc/man/ usable as MANPATH entry
diff --git a/doc/dev/logs/2011-03-09 b/doc/dev/logs/2011-03-09
new file mode 100644
index 00000000..4666ccb3
--- /dev/null
+++ b/doc/dev/logs/2011-03-09
@@ -0,0 +1,3 @@
+Steven & Nico:
+- types are closed in themselves
+- manpage will be stored in conf/type/NAME/man.text
diff --git a/doc/dev/todo/daninext b/doc/dev/todo/daninext
new file mode 100644
index 00000000..19ebc573
--- /dev/null
+++ b/doc/dev/todo/daninext
@@ -0,0 +1,2 @@
+file-edit
+ - add_line_to_file_if_not_existing
diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext
index 04dfc21b..e69de29b 100644
--- a/doc/dev/todo/niconext
+++ b/doc/dev/todo/niconext
@@ -1 +0,0 @@
-Documentation cleanup
diff --git a/doc/dev/todo/post-1.0 b/doc/dev/todo/post-1.0
index 9d6031b4..49c6f8b0 100644
--- a/doc/dev/todo/post-1.0
+++ b/doc/dev/todo/post-1.0
@@ -1,31 +1,32 @@
-Core:
- - Support singletons (see types/issue for a good reason)
- - probably name them only_once and use that as the internal id!
- - cdist-deploy-to: Configure more than one host
- - plus parallel mode like in ccollect
-
-Type handler:
- - add dependency parameters to core available for every type
- --requires
- --excludes?
-
-Stage 5 (code execution):
- - check return codes
- - abort on first error?
- - dependencies
-
+Dependencies:
+ - Add meta parameters like --requires --excludes --depends?
+ - Build dependency tree
+ - Exit on any error
+ - Check return codes
Types to be written/extended:
- __ssh-keys (host/user)
- __service
- __user
- __file_edit
- - add_line_to_file_if_not_existing
- delete_line_from_file
- regexp replace (can probably cover all?)
- __file:
- template == [shell script] stdout
- cron
+ - __file: think about splitting
+ __file
+ source
+ mode
+ owner
+ __directory
+ parents
+ mode
+ owner
+ __link
+ type symbolic | hard
+ - __issue: add --source
+
Documentation:
- Describe Multi master setups
@@ -36,8 +37,6 @@ Documentation:
- cdist-trigger after first run from /var/lib/cdist/out/bin?
- Different environments (production, integration, development)
- via version control
- - Define how to raise errors in types
-
- Check all references in manpages, ensure all manpages exist, generic ones:
+ cdist
+ cdist-deploy-to
@@ -47,10 +46,6 @@ Documentation:
- install packages only if not existent
- copy file only if different
- DOC document that $type/manifest is executed for every object/instance
- - category 7:
- - cdist-manifest(7)
- - cdist-explorer
- - cdist-config-layout
- ensure every file in bin/ has a correspondent manpage
- cdist-code-run-all
- cdist-config
@@ -69,8 +64,4 @@ Documentation:
- cdist-run-remote
- cdist-type-build-emulation
- cdist-type-emulator
- - Cleanup READMEs
- Ensure html output of manpages are published on the web
-
-- Makefile:
- - Include manpage generation
diff --git a/doc/man/cdist-manifest.text b/doc/man/cdist-manifest.text
index 40ab2c4e..efa5a8eb 100644
--- a/doc/man/cdist-manifest.text
+++ b/doc/man/cdist-manifest.text
@@ -43,10 +43,10 @@ __file /etc/nologin --type file --source "$__type/files/default.nologin"
SEE ALSO
--------
-cdist-manifest-run(1),
-cdist-manifest-run-all(1),
-cdist-manifest-run-init(1),
-cdist-type(7)
+- cdist-manifest-run(1)
+- cdist-manifest-run-all(1)
+- cdist-manifest-run-init(1)
+- cdist-type(7)
COPYING
diff --git a/doc/man/cdist-reference.text.sh b/doc/man/cdist-reference.text.sh
index 2453c216..f900e35e 100755
--- a/doc/man/cdist-reference.text.sh
+++ b/doc/man/cdist-reference.text.sh
@@ -83,6 +83,9 @@ conf/type//::
This directory is referenced by the variable __type (see below).
+conf/type//man.text::
+ Manpage in Asciidoc format (nequired for inclusion into upstream)
+
conf/type//manifest::
Used to generate additional objects from a type.
@@ -132,9 +135,9 @@ TYPES
The following types are available:
eof
-for type in cdist-type__*.text; do
- name_1="${type#cdist-type}"
- name_2="${name_1%.text}"
+for type in man7/cdist-type__*; do
+ name_1="${type#man7/cdist-type}"
+ name_2="${name_1%.7}"
name="$name_2"
echo "- $name"
@@ -175,8 +178,9 @@ SEE ALSO
--------
- cdist(7)
eof
-for type in cdist-type__*.text; do
- name_2="${type%.text}"
+for type in man7/cdist-type__*; do
+ name_1="${type#man7/}"
+ name_2="${name_1%.7}"
name="$name_2"
echo "- ${name}(7)"
diff --git a/doc/man/cdist-type.text b/doc/man/cdist-type.text
index b5097a5c..7c8b49f3 100644
--- a/doc/man/cdist-type.text
+++ b/doc/man/cdist-type.text
@@ -10,7 +10,9 @@ cdist-type - Functionality bundled
SYNOPSIS
--------
-Other languages name this module or class
+__TYPE ID --parameter value [--parameter value ...]
+
+__TYPE --parameter value [--parameter value ...] (for singletons)
DESCRIPTION
@@ -37,7 +39,23 @@ Internally cdist-type-emulator(1) will be called from cdist-manifest-run(1) to
save the given parameters into a cconfig database, so they can be accessed by
the manifest and gencode scripts of the type (see below).
-A list of supported types can be found in the cdist-type-listing(7) manpage.
+A list of supported types can be found in the cdist-reference(7) manpage.
+
+SINGLETON TYPES
+---------------
+If a type is flagged as a singleton, it may me used only once. This
+is useful for types which can be used only once on a system. If a type
+can only be used once, it does not take an
+
+Example:
+--------------------------------------------------------------------------------
+# __issue type manages /etc/issue
+__issue
+
+# Probably your own type - singletons may use parameters
+__myfancysingleton --colour green
+--------------------------------------------------------------------------------
+
HOW TO WRITE A NEW TYPE
@@ -46,6 +64,7 @@ A type consists of
- parameter (optional)
- manifest (optional)
+- singleton (optional)
- explorer (optional)
- gencode (optional)
@@ -98,6 +117,20 @@ Always ensure the manifest is executable, otherwise cdist will not be able
to execute it.
+SINGLETON - ONLY INSTANCE ONLY
+------------------------------
+If you want to ensure that a type can only be used once per target, you can
+mark it as a singleton: Just create the (empty) file "singleton" in your type
+directory. This will also change the way your type must be called:
+
+--------------------------------------------------------------------------------
+__YOURTYPE --parameter value
+--------------------------------------------------------------------------------
+
+As you can see, the ID is omitted, because it does not make any sense, if your
+type can be used only once.
+
+
THE TYPE EXPLORERS
------------------
If a type needs to explore specific details, it can provide type specific
@@ -153,7 +186,8 @@ If you think your type may be useful for others, ensure it works with the
current master branch of cdist and submit the git url containing the type for
inclusion to the mailinglist **cdist at cdist -- at -- l.schottelius.org**.
-Ensure a corresponding manpage named cdist-type__NAME is included.
+Ensure a corresponding manpage named man.text in asciidoc format with
+the manpage-name "cdist-type__NAME" is included in the type directory.
SEE ALSO
diff --git a/doc/man/to_check/cdist-type-addifnosuchline.text b/doc/man/to_check/cdist-type-addifnosuchline.text
new file mode 100644
index 00000000..09618dc3
--- /dev/null
+++ b/doc/man/to_check/cdist-type-addifnosuchline.text
@@ -0,0 +1,30 @@
+cdist-type-addifnosuchline(1)
+======================
+Daniel Roth
+
+
+NAME
+----
+cdist-type-addifnosuchline
+
+
+SYNOPSIS
+--------
+cdist-type-addifnosuchline Add if no such line
+
+
+DESCRIPTION
+-----------
+cdist-type-addifnosuchline can be used to check a file for existence of a
+specific line and adding that if not found
+
+
+SEE ALSO
+--------
+cdist(7)
+
+
+COPYING
+-------
+Copyright \(C) 2011 Daniel Roth. Free use of this software is
+granted under the terms of the GNU General Public License version 3 (GPLv3).