new types: __autofs_map, __autofs_master

Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
Steven Armstrong 2011-04-06 23:26:28 +02:00
parent 152efae913
commit b29538a784
10 changed files with 214 additions and 0 deletions

View file

@ -0,0 +1,60 @@
cdist-type__autofs_map(7)
========================
Steven Armstrong <steven-cdist--@--armstrong.cc>
NAME
----
cdist-type__autofs_map - Manage autofs maps
DESCRIPTION
-----------
This cdist type allows you to define maps for autofs.
OBJECT ID
---------
The object_id Is used as the mount-point as described in auto.master(5).
REQUIRED PARAMETERS
-------------------
map::
Name of the map to use. See auto.master(5).
OPTIONAL PARAMETERS
-------------------
type::
Type of map used for this mount point. Defaults to 'file'.
See map-type in auto.master(5) for possible values.
options::
See auto.master(5).
comment::
A comment describing this map. Is added to the generated entry in
auto.master.
EXAMPLES
--------
--------------------------------------------------------------------------------
# Add auto mounter at /net
__autofs_map /net --map /etc/auto.net --type program
# Add auto mounter at /pub
__autofs_map /pub --map /etc/auto.pub \
--type file --options nosuid,rw,bg,hard,intr --ghost
--------------------------------------------------------------------------------
SEE ALSO
--------
- cdist-type(7)
COPYING
-------
Copyright \(C) 2011 Steven Armstrong. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).

42
conf/type/__autofs_map/manifest Executable file
View file

@ -0,0 +1,42 @@
#!/bin/sh
#
# 2011 Steven Armstrong (steven-cdist at armstrong.cc)
#
# 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/>.
#
name="/$__object_id"
map="$(cat "$__object/parameter/map")"
if [ -f "$__object/parameter/type" ]; then
type="$(cat "$__object/parameter/type")"
else
type="file"
echo "$type" > "$__object/parameter/type"
fi
# Generate entry for use in auto.master
entry="${name} ${type}:${map}"
if [ -f "$__object/parameter/options" ]; then
entry="$entry $(cat "$__object/parameter/options")"
fi
if [ -f "$__object/parameter/comment" ]; then
echo "# $(cat "$__object/parameter/comment")" > "$__object/parameter/entry"
fi
echo "$entry" >> "$__object/parameter/entry"
require="$__self" __autofs_master

View file

@ -0,0 +1,3 @@
type
options
comment

View file

@ -0,0 +1 @@
map

View file

@ -0,0 +1,3 @@
# Generated from cdist __autofs_master
# Do not change this file. Changes will be overwritten.

View file

@ -0,0 +1,26 @@
#!/bin/sh
#
# 2011 Steven Armstrong (steven-cdist at armstrong.cc)
#
# 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/>.
#
#
# Generate auto.master config based on all defined __autofs_map ojbects.
#
auto_master="$__object/files/auto.master"
cat "$(cat "$__object/parameter/header")" > "$auto_master"
find "$__global/object/__autofs_map" -path "*.cdist/parameter/entry" | xargs cat >> "$auto_master"

View file

@ -0,0 +1,47 @@
cdist-type__autofs_master(7)
========================
Steven Armstrong <steven-cdist--@--armstrong.cc>
NAME
----
cdist-type__autofs_master - Generate the auto.master file
DESCRIPTION
-----------
This cdist type generates a auto.master configuration from given __autofs_map
definitions. See cdist-type__auto_map(7).
REQUIRED PARAMETERS
-------------------
None
OPTIONAL PARAMETERS
-------------------
header::
Absolute path to a file used as the header for the generated auto.master
file.
EXAMPLES
--------
--------------------------------------------------------------------------------
# auto.master with default header
__autofs_master
# auto.master with custom header
__autofs_master --header /path/to/header
--------------------------------------------------------------------------------
SEE ALSO
--------
- cdist-type(7)
COPYING
-------
Copyright \(C) 2011 Steven Armstrong. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).

View file

@ -0,0 +1,31 @@
#!/bin/sh
#
# 2011 Steven Armstrong (steven-cdist at armstrong.cc)
#
# 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/>.
#
if [ ! -f "$__object/parameter/header" ]; then
echo "$__type/files/auto.master.header" > "$__object/parameter/header"
fi
[ -d "$__object/files" ] || mkdir "$__object/files"
require="$__self" __file /etc/auto.master --source "$__object/files/auto.master" \
--mode 644 \
--owner root \
--group root

View file

@ -0,0 +1 @@
header

View file