summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Bauer2018-03-15 11:01:33 +0100
committerJonathan Bauer2018-03-15 11:01:33 +0100
commit819991ea7f7bda19f47dabc78997e574e3e21eae (patch)
treeea9230414a0a79d6faee7e1bf1e56f7c6aeb3e04
parent[openslx_tmp_format] only warn if sanity checks fails and do not spawn an eme... (diff)
downloadsystemd-init-819991ea7f7bda19f47dabc78997e574e3e21eae.tar.gz
systemd-init-819991ea7f7bda19f47dabc78997e574e3e21eae.tar.xz
systemd-init-819991ea7f7bda19f47dabc78997e574e3e21eae.zip
[dnbd3-rootfs] support multiple identifiers RW dev
-rwxr-xr-xbuilder/modules.d/dnbd3-rootfs/hooks/prepare-root-partition.sh23
1 files changed, 16 insertions, 7 deletions
diff --git a/builder/modules.d/dnbd3-rootfs/hooks/prepare-root-partition.sh b/builder/modules.d/dnbd3-rootfs/hooks/prepare-root-partition.sh
index 3e93253f..fc8ee828 100755
--- a/builder/modules.d/dnbd3-rootfs/hooks/prepare-root-partition.sh
+++ b/builder/modules.d/dnbd3-rootfs/hooks/prepare-root-partition.sh
@@ -16,16 +16,25 @@ logging.set_level debug
logging.set_log_file "$SLX_LOG_FILE_PATH"
# region find writable partition
-if [[ "$SLX_WRITABLE_DEVICE_IDENTIFIER" != '' ]] &&
- ! persistent_device="$(
- tools.find_block_device "$SLX_WRITABLE_DEVICE_IDENTIFIER" '' \
- "$SLX_WRITABLE_DEVICE_IDENTIFIER_TIMEOUT_IN_SECONDS"
- )"
-then
- logging.warn "Failed to find unique device with identifier" \
+# support comma-separated list of identifiers
+IFS_backup="$IFS"
+IFS=','
+for identifier in $SLX_WRITABLE_DEVICE_IDENTIFIER; do
+ if [[ "$identifier" != '' ]] &&
+ persistent_device="$(
+ tools.find_block_device "$identifier" '' \
+ "$SLX_WRITABLE_DEVICE_IDENTIFIER_TIMEOUT_IN_SECONDS")"; then
+ break
+ fi
+ persistent_device=
+done
+IFS="$IFS_backup"
+if [ -z "$persistent_device" ]; then
+ logging.warn "Failed to find unique device with identifiers" \
"\"${SLX_WRITABLE_DEVICE_IDENTIFIER}\"; matched devices:" \
"\"${persistent_device}\""
fi
+
if [ -n "$SLX_WRITABLE_DEVICE_STORAGE_FILE_PATH" ] && [ -n "$persistent_device" ]
then
persistent_mountpoint=/mnt/slx_writable_device