backport __install_partition_msdos from Steven

Signed-off-by: Nico Schottelius <nico@feder.schottelius.org>
This commit is contained in:
Nico Schottelius 2017-06-19 10:58:45 +02:00
parent 7e768cc42a
commit 19b6dce8da
3 changed files with 20 additions and 5 deletions

View File

@ -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 <steven-cdist--@--armstrong.cc>
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.

View File

@ -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"

View File

@ -1,3 +1,5 @@
device
minor
partition
bootable
size