summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2021-10-20 16:32:47 +0200
committerSimon Rettberg2021-10-20 16:32:47 +0200
commit705a14c57d0f57b4998baad174596600a8a48c5b (patch)
treed0408905e74782b356434fbcc91c8dcf28c69e89
parent[dnbd3-rootfs] Accept kernel and xloop, default to xloop (diff)
downloadsystemd-init-705a14c57d0f57b4998baad174596600a8a48c5b.tar.gz
systemd-init-705a14c57d0f57b4998baad174596600a8a48c5b.tar.xz
systemd-init-705a14c57d0f57b4998baad174596600a8a48c5b.zip
[dnbd3-rootfs] Allow ro image with no partition table
-rwxr-xr-xmodules.d/dnbd3-rootfs/hooks/prepare-root-partition.sh27
1 files changed, 17 insertions, 10 deletions
diff --git a/modules.d/dnbd3-rootfs/hooks/prepare-root-partition.sh b/modules.d/dnbd3-rootfs/hooks/prepare-root-partition.sh
index e32595dc..bef92ce9 100755
--- a/modules.d/dnbd3-rootfs/hooks/prepare-root-partition.sh
+++ b/modules.d/dnbd3-rootfs/hooks/prepare-root-partition.sh
@@ -79,11 +79,11 @@ for try in {1..5} ""; do
fi
info "Trying hosts '$SLX_DNBD3_SERVERS'."
if dnbd3-client \
- --host "$SLX_DNBD3_SERVERS" \
- --image "$SLX_DNBD3_IMAGE" \
- --device "$_dnbd3_dev" \
- "${_dnbd3_client_additional_args[@]}"; then
- break
+ --host "$SLX_DNBD3_SERVERS" \
+ --image "$SLX_DNBD3_IMAGE" \
+ --device "$_dnbd3_dev" \
+ "${_dnbd3_client_additional_args[@]}"; then
+ break
fi
sleep 1
done
@@ -113,16 +113,23 @@ fi
# endregion
# region find system partition within dnbd3 image
if [ -z "$SLX_SYSTEM_PARTITION_PREPARATION_SCRIPT" ]; then
+ # Find requested root partition - default to SLX_SYS label
+ read_only_partition="$( slx-tools dev_find_partitions \
+ "$read_only_device" "${SLX_SYSTEM_PARTITION_IDENTIFIER:-SLX_SYS}" )"
if [ -z "$SLX_SYSTEM_PARTITION_IDENTIFIER" ]; then
- SLX_SYSTEM_PARTITION_IDENTIFIER="SLX_SYS"
- echo "SLX_SYSTEM_PARTITION_IDENTIFIER='$SLX_SYSTEM_PARTITION_IDENTIFIER'" >> /etc/openslx
+ if [ -n "$read_only_partition" ]; then
+ # Defaulting to SLX_SYS worked
+ echo "SLX_SYSTEM_PARTITION_IDENTIFIER='SLX_SYS'" >> /etc/openslx
+ else
+ # Aussume there is no partition table
+ read_only_partition="$read_only_device"
+ fi
fi
- read_only_partition="$(slx-tools dev_find_partitions \
- "$read_only_device" "$SLX_SYSTEM_PARTITION_IDENTIFIER")"
+
else
eval "$SLX_SYSTEM_PARTITION_PREPARATION_SCRIPT"
fi
-if [[ ! $? || -z "$read_only_partition" ]]; then
+if [[ -z "$read_only_partition" ]]; then
warn "Failed to find unique device with identifier" \
"\"${SLX_SYSTEM_PARTITION_IDENTIFIER}\"; matched devices:" \
"\"${read_only_partition}\""