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/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/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/gencode b/conf/type/__file/gencode
index 1fb20bf9..5f386349 100755
--- a/conf/type/__file/gencode
+++ b/conf/type/__file/gencode
@@ -79,6 +79,9 @@ case "$type" in
# 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
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/parameter/required b/conf/type/__issue/parameter/required
deleted file mode 100644
index e69de29b..00000000
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/optional b/conf/type/__motd/singleton
similarity index 100%
rename from conf/type/__issue/parameter/optional
rename to conf/type/__motd/singleton
diff --git a/doc/changelog b/doc/changelog
index 4bca6d9c..c939b547 100644
--- a/doc/changelog
+++ b/doc/changelog
@@ -1,7 +1,12 @@
-1.0.3: upcoming
+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 (DOCUMENTATION MISSING)
+ * Allow type to be singleton
* Type __file learned --type symlink
1.0.2: 2011-03-09
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 87b61b47..e69de29b 100644
--- a/doc/dev/todo/niconext
+++ b/doc/dev/todo/niconext
@@ -1,3 +0,0 @@
-- Support singletons (see types/issue for a good reason)
- - add documentation!
-
diff --git a/doc/dev/todo/post-1.0 b/doc/dev/todo/post-1.0
index 8ea11dd4..49c6f8b0 100644
--- a/doc/dev/todo/post-1.0
+++ b/doc/dev/todo/post-1.0
@@ -1,25 +1,32 @@
-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
@@ -58,9 +65,3 @@ Documentation:
- cdist-type-build-emulation
- cdist-type-emulator
- Ensure html output of manpages are published on the web
---------------------------------------------------------------------------------
-Fix:
-Running initial manifest for sgv-wiki-01 ...
-/tmp/cdist.VfhjaH8LP3GE/out/type_bin/__ethz_systems_wiki: Zeile 87: /home/users/nico/privat/firmen/ethz/vcs/cdist/conf/type/__ethz_systems_wiki/parameter/required: Datei oder Verzeichnis nicht gefunden
-/tmp/cdist.VfhjaH8LP3GE/out/type_bin/__ethz_systems_wiki: Zeile 94: /home/users/nico/privat/firmen/ethz/vcs/cdist/conf/type/__ethz_systems_wiki/parameter/optional: Datei oder Verzeichnis nicht gefunden
-
diff --git a/doc/man/cdist-type.text b/doc/man/cdist-type.text
index 2835815e..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
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).