From 31e9937098ebbcd9dd0b8535bb68c94bbb56b0eb Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Sat, 17 Sep 2011 06:53:18 +0200 Subject: [PATCH] finish new type for partition definition Signed-off-by: Steven Armstrong --- conf/type/__partition_msdos/gencode-remote | 20 ---------------- conf/type/__partition_msdos/man.text | 2 +- conf/type/__partition_msdos/manifest | 24 +++++++++++++++---- .../type/__partition_msdos/parameter/optional | 2 +- 4 files changed, 22 insertions(+), 26 deletions(-) delete mode 100755 conf/type/__partition_msdos/gencode-remote diff --git a/conf/type/__partition_msdos/gencode-remote b/conf/type/__partition_msdos/gencode-remote deleted file mode 100755 index 211bc1db..00000000 --- a/conf/type/__partition_msdos/gencode-remote +++ /dev/null @@ -1,20 +0,0 @@ -#!/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 . -# - diff --git a/conf/type/__partition_msdos/man.text b/conf/type/__partition_msdos/man.text index 611451ed..c9ef0cf1 100644 --- a/conf/type/__partition_msdos/man.text +++ b/conf/type/__partition_msdos/man.text @@ -21,7 +21,7 @@ type:: OPTIONAL PARAMETERS ------------------- -device:: +partition:: defaults to object_id bootable:: mark partition as bootable, true or false, defaults to false diff --git a/conf/type/__partition_msdos/manifest b/conf/type/__partition_msdos/manifest index e5b04c02..0d73c405 100755 --- a/conf/type/__partition_msdos/manifest +++ b/conf/type/__partition_msdos/manifest @@ -18,8 +18,24 @@ # along with cdist. If not, see . # -type +# set defaults +if [ -f "$__object/parameter/partition" ]; then + partition="(cat "$__object/parameter/partition")" +else + partition="/$__object_id" + echo "$partition" > "$__object/parameter/partition" +fi +device="$(echo "$partition" | sed 's/[0-9]//g')" +echo "$device" > "$__object/parameter/device" +minor="$(echo "$partition" | sed 's/[^0-9]//g')" +echo "$minor" > "$__object/parameter/minor" -device -bootable -size +if [ ! -f "$__object/parameter/bootable" ]; then + echo "false" > "$__object/parameter/bootable" +fi +if [ ! -f "$__object/parameter/size" ]; then + echo "+" > "$__object/parameter/size" +fi + +# pull in the type that actually does something with the above parameters +require="$__self" __partition_msdos_apply diff --git a/conf/type/__partition_msdos/parameter/optional b/conf/type/__partition_msdos/parameter/optional index 612fe769..b2b0a4c2 100644 --- a/conf/type/__partition_msdos/parameter/optional +++ b/conf/type/__partition_msdos/parameter/optional @@ -1,3 +1,3 @@ -device +partition bootable size