new type: __mkfs

Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
Steven Armstrong 2011-10-04 22:23:26 +02:00
parent b142435abd
commit acc64caf95
6 changed files with 128 additions and 0 deletions

36
conf/type/__mkfs/gencode-remote Executable file
View File

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

View File

57
conf/type/__mkfs/man.text Normal file
View File

@ -0,0 +1,57 @@
cdist-type__mkfs(7)
===================
Steven Armstrong <steven-cdist--@--armstrong.cc>
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).

31
conf/type/__mkfs/manifest Executable file
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/>.
#
# 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")"

View File

@ -0,0 +1,3 @@
device
options
blocks

View File

@ -0,0 +1 @@
type