forked from ungleich-public/cdist
backport __install_mount from Steven
Signed-off-by: Nico Schottelius <nico@feder.schottelius.org>
This commit is contained in:
parent
174fb3b7c8
commit
d9a513e2a4
1 changed files with 19 additions and 12 deletions
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
get_type_from_mkfs() {
|
get_type_from_mkfs() {
|
||||||
_device="$1"
|
_device="$1"
|
||||||
for mkfs_object in $(find "$__global/object/__install_mkfs" -path "*.cdist"); do
|
for mkfs_object in $(find "$__global/object/__install_mkfs" -type d -name "$__cdist_object_marker"); do
|
||||||
mkfs_device="$(cat "$mkfs_object/parameter/device")"
|
mkfs_device="$(cat "$mkfs_object/parameter/device")"
|
||||||
if [ "$_device" = "$mkfs_device" ]; then
|
if [ "$_device" = "$mkfs_device" ]; then
|
||||||
cat "$mkfs_object/parameter/type"
|
cat "$mkfs_object/parameter/type"
|
||||||
|
@ -42,18 +42,25 @@ else
|
||||||
# store for later use by others
|
# store for later use by others
|
||||||
echo "$type" > "$__object/parameter/type"
|
echo "$type" > "$__object/parameter/type"
|
||||||
fi
|
fi
|
||||||
[ -n "$type" ] || die "Can't determine type for $__object"
|
[ -n "$type" ] || {
|
||||||
|
echo "Can't determine type for $__object" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
if [ "$type" = "swap" ]; then
|
if [ "$type" = "swap" ]; then
|
||||||
echo "swapon \"$device\""
|
printf 'swapon "%s"\n' "$device"
|
||||||
else
|
else
|
||||||
if [ -f "$__object/parameter/options" ]; then
|
|
||||||
options="$(cat "$__object/parameter/options")"
|
|
||||||
else
|
|
||||||
options=""
|
|
||||||
fi
|
|
||||||
[ -n "$options" ] && options="-o $options"
|
|
||||||
mount_point="${prefix}${dir}"
|
mount_point="${prefix}${dir}"
|
||||||
|
printf '[ -d "%s" ] || mkdir -p "%s"\n' "$mount_point" "$mount_point"
|
||||||
echo "[ -d \"$mount_point\" ] || mkdir -p \"$mount_point\""
|
printf 'mount'
|
||||||
echo "mount -t \"$type\" $options \"$device\" \"$mount_point\""
|
if [ "$type" = "bind" ]; then
|
||||||
|
printf ' --bind'
|
||||||
|
device="${prefix}${device}"
|
||||||
|
else
|
||||||
|
printf ' -t "%s"' "$type"
|
||||||
|
fi
|
||||||
|
if [ -f "$__object/parameter/options" ]; then
|
||||||
|
printf ' -o %s' "$(cat "$__object/parameter/options")"
|
||||||
|
fi
|
||||||
|
printf ' "%s"' "$device"
|
||||||
|
printf ' "%s"\n' "$mount_point"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue