fix merge conflict in changelog

Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
Steven Armstrong 2011-03-16 14:41:43 +01:00
commit 59e774b08d
43 changed files with 916 additions and 480 deletions

View file

@ -0,0 +1,50 @@
cdist-type__addifnosuchline(7)
==============================
Daniel Roth <dani-cdist--@--d-roth.li>
NAME
----
cdist-type__addifnosuchline - Add a line (if not existing already)
DESCRIPTION
-----------
This type can be used to check a file for existence of a
specific line and adding it, if it was not found.
REQUIRED PARAMETERS
-------------------
line::
Specifies the content which shall be added if not existing.
OPTIONAL PARAMETERS
-------------------
file::
If supplied, use this as the destination file.
Otherwise the object_id is used.
EXAMPLES
--------
--------------------------------------------------------------------------------
# Creates or appends the line specifiend in "include_www" to the file "lighttpd.conf"
__addifnosuchline www --file /etc/lighttpd.conf --line include_www
# Adds the line "include_git" to the file "lighttpd.conf"
__addifnosuchline /etc/lighttpd.conf --line include_git
--------------------------------------------------------------------------------
SEE ALSO
--------
- cdist-type(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).

View file

@ -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 <http://www.gnu.org/licenses/>.
#
#
# 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

57
conf/type/__directory/gencode Executable file
View file

@ -0,0 +1,57 @@
#!/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 <http://www.gnu.org/licenses/>.
#
#
# Handle directories
#
#
# __directory /etc [--mode --owner --group --parents [yes|no] ]
#
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 $mkdiropt \"$destination\"
fi
# Mode settings
if [ -f "$__object/parameter/mode" ]; then
echo chmod \"$(cat "$__object/parameter/mode")\" \"$destination\"
fi
# Group
if [ -f "$__object/parameter/group" ]; then
echo chgrp \"$(cat "$__object/parameter/group")\" \"$destination\"
fi
# Owner
if [ -f "$__object/parameter/owner" ]; then
echo chown \"$(cat "$__object/parameter/owner")\" \"$destination\"
fi

View file

@ -0,0 +1,56 @@
cdist-type__directory(7)
========================
Nico Schottelius <nico-cdist--@--schottelius.org>
NAME
----
cdist-type__directory - Create a directory
DESCRIPTION
-----------
This cdist type allows you to create directories on the target.
REQUIRED PARAMETERS
-------------------
None.
OPTIONAL PARAMETERS
-------------------
group::
Group to chgrp to.
mode::
Unix permissions, suitable for chmod.
owner::
User to chown to.
parents::
Whether to create parents as well (mkdir -p behaviour)
EXAMPLES
--------
--------------------------------------------------------------------------------
# A silly example
__directory /tmp/foobar
# Ensure /etc exists correctly
__file /etc --owner root --group root --mode 0755
--------------------------------------------------------------------------------
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).

View file

@ -0,0 +1,4 @@
group
mode
owner
parents

View file

@ -21,28 +21,11 @@
# Retrieve the md5sum of a file to be created, if it is already existing.
#
if [ -f "$__object/parameter/destination" ]; then
destination="$(cat "$__object/parameter/destination")"
else
destination="/$__object_id"
fi
destination="/$__object_id"
os="$(cat $__global/explorer/os)"
case "$os" in
macosx)
md5sum="md5"
;;
*)
md5sum="md5sum"
;;
esac
# No output if file does not exist - does definitely not match the md5sum :-)
if [ -e "$destination" ]; then
if [ -f "$destination" ]; then
$md5sum < "$destination"
cksum < "$destination"
else
echo "NO REGULAR FILE"
fi

View file

@ -21,11 +21,7 @@
# Check whether file exists or not
#
if [ -f "$__object/parameter/destination" ]; then
destination="$(cat "$__object/parameter/destination")"
else
destination="/$__object_id"
fi
destination="/$__object_id"
if [ -e "$destination" ]; then
echo yes

View file

@ -18,97 +18,47 @@
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
#
#
# __file is a very basic type and should be able to be used as an
# example for typewrites later
# __file is a very basic type, which will probably be reused quite often
#
# 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
destination="/$__object_id"
# 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
if [ -f "$__object/parameter/source" ]; then
source="$(cat "$__object/parameter/source")"
# Use correct md5sum binary - MacOSx is different here
case "$os" in
macosx)
md5sum="md5"
;;
if [ -f "$source" ]; then
local_cksum="$(cksum < "$source")"
remote_cksum="$(cat "$__object/explorer/cksum")"
*)
md5sum="md5sum"
;;
esac
type="$(cat "$__object/parameter/type")"
case "$type" in
directory)
if [ -f "$__object/parameter/source" ]; then
echo "Source not supported for directory currently - FIXME" >&2
exit 1
else
if [ no = "$(cat "$__object/explorer/exists")" ]; then
echo mkdir \"$destination\"
fi
if [ "$local_cksum" != "$remote_cksum" ]; then
# FIXME: The username 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
;;
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
else
echo "Source \"$source\" does not exist." >&2
exit 1
;;
esac
fi
else
if [ no = "$(cat "$__object/explorer/exists")" ]; then
echo touch \"$destination\"
fi
fi
# Mode settings
if [ -f "$__object/parameter/mode" ]; then
mode="$(cat "$__object/parameters/mode")"
echo chmod \"$mode\" \"$destination\"
echo chmod \"$(cat "$__object/parameter/mode")\" \"$destination\"
fi
# Group
if [ -f "$__object/parameter/group" ]; then
echo chgrp \"$(cat "$__object/parameter/group")\" \"$destination\"
fi
# Owner
if [ -f "$__object/parameter/owner" ]; then
echo chown \"$(cat "$__object/parameter/owner")\" \"$destination\"
fi

View file

@ -15,19 +15,20 @@ This cdist type allows you to create files 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.
mode::
Unix permissions, suitable for chmod.
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.
@ -38,13 +39,14 @@ EXAMPLES
--------------------------------------------------------------------------------
# Create /etc/cdist-configured as an empty file
__file /etc/cdist-configured --type file
# Same but with a different object id
__file cdist-marker --type file --destination /etc/cdist-configured
__file /etc/cdist-configured
# Use __file from another type
__file /etc/issue --source "$__type/files/archlinux" --type file
__file /etc/issue --source "$__type/files/archlinux"
# Supply some more settings
__file /etc/shadow --source "$__type/files/shadow" \
--owner root --group shadow --mode 0640
--------------------------------------------------------------------------------

View file

@ -1,3 +1,4 @@
group
mode
owner
source
destination

View file

@ -1 +0,0 @@
type

View file

@ -0,0 +1,3 @@
Red Hat Enterprise Linux Server (cdist-automated)
Kernel \r on an \m

View file

@ -1,5 +1,5 @@
cdist-type__issue(7)
===================
====================
Nico Schottelius <nico-cdist--@--schottelius.org>

View file

@ -23,12 +23,12 @@ destination=/etc/issue
source="$(cat "out/explorer/os")"
case "$os" in
archlinux)
source="$__type/files/archlinux"
archlinux|redhat)
source="$__type/files/$os"
;;
*)
source="$__type/files/default"
;;
esac
__file "$destination" --source "$source" --type file
__file "$destination" --source "$source"

43
conf/type/__link/gencode Executable file
View file

@ -0,0 +1,43 @@
#!/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 <http://www.gnu.org/licenses/>.
#
#
# __file is a very basic type and should be able to be used as an
# example for typewrites later
#
destination="/$__object_id"
type="$(cat "$__object/parameter/type")"
source="$(cat "$__object/parameter/source")"
case "$type" in
symbolic)
lnopt="-s"
;;
hard)
lnopt=""
;;
*)
echo "Unknown type: $type" >&2
exit 1
;;
esac
echo ln ${lnopt} -f \"$source\" \"$destination\"

56
conf/type/__link/man.text Normal file
View file

@ -0,0 +1,56 @@
cdist-type__link(7)
===================
Nico Schottelius <nico-cdist--@--schottelius.org>
NAME
----
cdist-type__link - Create links
DESCRIPTION
-----------
This cdist type allows you to hard and symoblic links. The given
object id is the destination for the link.
REQUIRED PARAMETERS
-------------------
source::
Specifies the link source.
type::
Specifies the link type: Either hard or symoblic.
OPTIONAL PARAMETERS
-------------------
None.
EXAMPLES
--------
--------------------------------------------------------------------------------
# Create hard link of /etc/shadow
__link /root/shadow --source /etc/shadow --type hard
# Relative symbolic link
__link /etc/apache2/sites-enabled/www.test.ch \
--source ../sites-available/www.test.ch \
--type symbolic
# Absolute symbolic link
__link /opt/plone --source /home/services/plone --type symbolic
--------------------------------------------------------------------------------
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).

View file

@ -0,0 +1,2 @@
source
type

View file

@ -33,7 +33,7 @@ EXAMPLES
__motd
# Supply source file from a different type
__file --source "$__type/files/my-motd"
__motd --source "$__type/files/my-motd"
--------------------------------------------------------------------------------

View file

@ -19,8 +19,6 @@
#
#
destination=/etc/motd
# Select motd source
if [ -f "$__object/parameter/source" ]; then
source="$(cat "$__object/parameter/source")"
@ -28,4 +26,16 @@ else
source="$__type/files/motd"
fi
__file "$destination" --source "$source" --type file
os=$(cat $__global/explorer/os)
case "$os" in
debian|ubuntu)
destination=/etc/motd.tail
;;
*)
destination=/etc/motd
;;
esac
__file "$destination" --source "$source" --mode 0644

View file

@ -0,0 +1,53 @@
cdist-type__package_apt(7)
==========================
Nico Schottelius <nico-cdist--@--schottelius.org>
NAME
----
cdist-type__package_apt - Manage packages with apt-get
DESCRIPTION
-----------
apt-get is usually used on Debian and variants (like Ubuntu) to
manage packages.
REQUIRED PARAMETERS
-------------------
state::
Either "installed" or "deinstalled".
OPTIONAL PARAMETERS
-------------------
name::
If supplied, use the name and not the object id as the package name.
EXAMPLES
--------
--------------------------------------------------------------------------------
# Ensure zsh in installed
__package_apt zsh --state installed
# In case you only want *a* webserver, but don't care which one
__package_apt webserver --state installed --name nginx
# Remove obsolete package
__package_apt puppet --state deinstalled
--------------------------------------------------------------------------------
SEE ALSO
--------
- cdist-type(7)
- cdist-type__package(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).

View file

@ -0,0 +1,53 @@
cdist-type__package_pacman(7)
=============================
Nico Schottelius <nico-cdist--@--schottelius.org>
NAME
----
cdist-type__package_pacman - Manage packages with pacman
DESCRIPTION
-----------
Pacman is usually used on the Archlinux distribution to manage
packages.
REQUIRED PARAMETERS
-------------------
state::
Either "installed" or "deinstalled".
OPTIONAL PARAMETERS
-------------------
name::
If supplied, use the name and not the object id as the package name.
EXAMPLES
--------
--------------------------------------------------------------------------------
# Ensure zsh in installed
__package_pacman zsh --state installed
# If you don't want to follow pythonX packages, but always use python
__package_pacman python --state installed --name python2
# Remove obsolete package
__package_pacman puppet --state deinstalled
--------------------------------------------------------------------------------
SEE ALSO
--------
- cdist-type(7)
- cdist-type__package(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).