From acc64caf95524156686f3aabbe7fea1b9c4fab60 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Tue, 4 Oct 2011 22:23:26 +0200 Subject: [PATCH] new type: __mkfs Signed-off-by: Steven Armstrong --- conf/type/__mkfs/gencode-remote | 36 ++++++++++++++++++ conf/type/__mkfs/installer | 0 conf/type/__mkfs/man.text | 57 +++++++++++++++++++++++++++++ conf/type/__mkfs/manifest | 31 ++++++++++++++++ conf/type/__mkfs/parameter/optional | 3 ++ conf/type/__mkfs/parameter/required | 1 + 6 files changed, 128 insertions(+) create mode 100755 conf/type/__mkfs/gencode-remote create mode 100644 conf/type/__mkfs/installer create mode 100644 conf/type/__mkfs/man.text create mode 100755 conf/type/__mkfs/manifest create mode 100644 conf/type/__mkfs/parameter/optional create mode 100644 conf/type/__mkfs/parameter/required diff --git a/conf/type/__mkfs/gencode-remote b/conf/type/__mkfs/gencode-remote new file mode 100755 index 00000000..e5061013 --- /dev/null +++ b/conf/type/__mkfs/gencode-remote @@ -0,0 +1,36 @@ +#!/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 . +# + +device="(cat "$__object/parameter/device")" +type="(cat "$__object/parameter/type")" + +command="mkfs -t $type" + +if [ -f "$__object/parameter/options" ]; then + options="(cat "$__object/parameter/options")" + command="$command -o '$options'" +fi +command="$command $device" +if [ -f "$__object/parameter/blocks" ]; then + blocks="(cat "$__object/parameter/blocks")" + command="$command $blocks" +fi + +echo "$command" diff --git a/conf/type/__mkfs/installer b/conf/type/__mkfs/installer new file mode 100644 index 00000000..e69de29b diff --git a/conf/type/__mkfs/man.text b/conf/type/__mkfs/man.text new file mode 100644 index 00000000..4320c639 --- /dev/null +++ b/conf/type/__mkfs/man.text @@ -0,0 +1,57 @@ +cdist-type__mkfs(7) +=================== +Steven Armstrong + + +NAME +---- +cdist-type__mkfs - build a linux file system + + +DESCRIPTION +----------- +This cdist type is a wrapper for the mkfs command. + + +REQUIRED PARAMETERS +------------------- +type:: + The filesystem type to use. Same as mkfs -t. + + +OPTIONAL PARAMETERS +------------------- +device:: + defaults to object_id + +options:: + file system-specific options to be passed to the mkfs command + +blocks:: + the number of blocks to be used for the file system + + +EXAMPLES +-------- + +-------------------------------------------------------------------------------- +# reiserfs /dev/sda5 +__mkfs /dev/sda5 --type reiserfs +# same thing with explicit device +__mkfs whatever --device /dev/sda5 --type reiserfs + +# jfs with journal on /dev/sda2 +__mkfs /dev/sda1 --type jfs --options "-j /dev/sda2" +-------------------------------------------------------------------------------- + + +SEE ALSO +-------- +- cdist-type(7) +- mkfs(8) + + +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/__mkfs/manifest b/conf/type/__mkfs/manifest new file mode 100755 index 00000000..e9d275a4 --- /dev/null +++ b/conf/type/__mkfs/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 . +# + +# set defaults +if [ -f "$__object/parameter/device" ]; then + device="(cat "$__object/parameter/device")" +else + device="/$__object_id" + echo "$device" > "$__object/parameter/device" +fi + +type="(cat "$__object/parameter/type")" + +options="(cat "$__object/parameter/options")" diff --git a/conf/type/__mkfs/parameter/optional b/conf/type/__mkfs/parameter/optional new file mode 100644 index 00000000..86aeae30 --- /dev/null +++ b/conf/type/__mkfs/parameter/optional @@ -0,0 +1,3 @@ +device +options +blocks diff --git a/conf/type/__mkfs/parameter/required b/conf/type/__mkfs/parameter/required new file mode 100644 index 00000000..aa80e646 --- /dev/null +++ b/conf/type/__mkfs/parameter/required @@ -0,0 +1 @@ +type