From b29538a78486b9aac975427c48f110255e3ed1b6 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 6 Apr 2011 23:26:28 +0200 Subject: [PATCH] new types: __autofs_map, __autofs_master Signed-off-by: Steven Armstrong --- conf/type/__autofs_map/man.text | 60 +++++++++++++++++++ conf/type/__autofs_map/manifest | 42 +++++++++++++ conf/type/__autofs_map/parameter/optional | 3 + conf/type/__autofs_map/parameter/required | 1 + .../__autofs_master/files/auto.master.header | 3 + conf/type/__autofs_master/gencode-local | 26 ++++++++ conf/type/__autofs_master/man.text | 47 +++++++++++++++ conf/type/__autofs_master/manifest | 31 ++++++++++ conf/type/__autofs_master/parameter/optional | 1 + conf/type/__autofs_master/singleton | 0 10 files changed, 214 insertions(+) create mode 100644 conf/type/__autofs_map/man.text create mode 100755 conf/type/__autofs_map/manifest create mode 100644 conf/type/__autofs_map/parameter/optional create mode 100644 conf/type/__autofs_map/parameter/required create mode 100644 conf/type/__autofs_master/files/auto.master.header create mode 100755 conf/type/__autofs_master/gencode-local create mode 100644 conf/type/__autofs_master/man.text create mode 100755 conf/type/__autofs_master/manifest create mode 100644 conf/type/__autofs_master/parameter/optional create mode 100644 conf/type/__autofs_master/singleton diff --git a/conf/type/__autofs_map/man.text b/conf/type/__autofs_map/man.text new file mode 100644 index 00000000..fbbd15d6 --- /dev/null +++ b/conf/type/__autofs_map/man.text @@ -0,0 +1,60 @@ +cdist-type__autofs_map(7) +======================== +Steven Armstrong + + +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). diff --git a/conf/type/__autofs_map/manifest b/conf/type/__autofs_map/manifest new file mode 100755 index 00000000..74672e46 --- /dev/null +++ b/conf/type/__autofs_map/manifest @@ -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 . +# + +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 + diff --git a/conf/type/__autofs_map/parameter/optional b/conf/type/__autofs_map/parameter/optional new file mode 100644 index 00000000..b1aa3a7e --- /dev/null +++ b/conf/type/__autofs_map/parameter/optional @@ -0,0 +1,3 @@ +type +options +comment diff --git a/conf/type/__autofs_map/parameter/required b/conf/type/__autofs_map/parameter/required new file mode 100644 index 00000000..b4a284c5 --- /dev/null +++ b/conf/type/__autofs_map/parameter/required @@ -0,0 +1 @@ +map diff --git a/conf/type/__autofs_master/files/auto.master.header b/conf/type/__autofs_master/files/auto.master.header new file mode 100644 index 00000000..53590257 --- /dev/null +++ b/conf/type/__autofs_master/files/auto.master.header @@ -0,0 +1,3 @@ +# Generated from cdist __autofs_master +# Do not change this file. Changes will be overwritten. + diff --git a/conf/type/__autofs_master/gencode-local b/conf/type/__autofs_master/gencode-local new file mode 100755 index 00000000..701f97a8 --- /dev/null +++ b/conf/type/__autofs_master/gencode-local @@ -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 . +# +# +# 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" diff --git a/conf/type/__autofs_master/man.text b/conf/type/__autofs_master/man.text new file mode 100644 index 00000000..d889b1f6 --- /dev/null +++ b/conf/type/__autofs_master/man.text @@ -0,0 +1,47 @@ +cdist-type__autofs_master(7) +======================== +Steven Armstrong + + +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). diff --git a/conf/type/__autofs_master/manifest b/conf/type/__autofs_master/manifest new file mode 100755 index 00000000..e37a5d34 --- /dev/null +++ b/conf/type/__autofs_master/manifest @@ -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 . +# + + +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 + diff --git a/conf/type/__autofs_master/parameter/optional b/conf/type/__autofs_master/parameter/optional new file mode 100644 index 00000000..8e83f898 --- /dev/null +++ b/conf/type/__autofs_master/parameter/optional @@ -0,0 +1 @@ +header diff --git a/conf/type/__autofs_master/singleton b/conf/type/__autofs_master/singleton new file mode 100644 index 00000000..e69de29b