From 19b6dce8da60c85d22cf0eff0abc9a5ac3f32eb3 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 19 Jun 2017 10:58:45 +0200 Subject: [PATCH] backport __install_partition_msdos from Steven Signed-off-by: Nico Schottelius --- cdist/conf/type/__install_partition_msdos/man.rst | 10 +++++++++- cdist/conf/type/__install_partition_msdos/manifest | 13 +++++++++---- .../__install_partition_msdos/parameter/optional | 2 ++ 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/cdist/conf/type/__install_partition_msdos/man.rst b/cdist/conf/type/__install_partition_msdos/man.rst index 5ebb9218..c408a614 100644 --- a/cdist/conf/type/__install_partition_msdos/man.rst +++ b/cdist/conf/type/__install_partition_msdos/man.rst @@ -19,6 +19,12 @@ type OPTIONAL PARAMETERS ------------------- +device + the device we're working on. Defaults to the string prefix of --partition + +minor + the partition number we're working on. Defaults to the numeric suffix of --partition + partition defaults to object_id @@ -49,6 +55,8 @@ EXAMPLES __install_partition_msdos /dev/sda6 --type 83 --size 50% # rest of the extended partition, linux __install_partition_msdos /dev/sda7 --type 83 --size + + # nvm device partition 2 + __install_partition_msdos /dev/nvme0n1p2 --device /dev/nvme0n1 --minor 2 --type 83 --size 128M --bootable true AUTHORS @@ -58,7 +66,7 @@ Steven Armstrong COPYING ------- -Copyright \(C) 2011 Steven Armstrong. You can redistribute it +Copyright \(C) 2011-2017 Steven Armstrong. 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. diff --git a/cdist/conf/type/__install_partition_msdos/manifest b/cdist/conf/type/__install_partition_msdos/manifest index e55d3f24..636fbd6a 100755 --- a/cdist/conf/type/__install_partition_msdos/manifest +++ b/cdist/conf/type/__install_partition_msdos/manifest @@ -25,10 +25,15 @@ 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" + +if [ ! -f "$__object/parameter/device" ]; then + device="$(echo "$partition" | sed 's/[0-9]//g')" + echo "$device" > "$__object/parameter/device" +fi +if [ ! -f "$__object/parameter/minor" ]; then + minor="$(echo "$partition" | sed 's/[^0-9]//g')" + echo "$minor" > "$__object/parameter/minor" +fi if [ ! -f "$__object/parameter/bootable" ]; then echo "false" > "$__object/parameter/bootable" diff --git a/cdist/conf/type/__install_partition_msdos/parameter/optional b/cdist/conf/type/__install_partition_msdos/parameter/optional index b2b0a4c2..3b3f2083 100644 --- a/cdist/conf/type/__install_partition_msdos/parameter/optional +++ b/cdist/conf/type/__install_partition_msdos/parameter/optional @@ -1,3 +1,5 @@ +device +minor partition bootable size