From 819991ea7f7bda19f47dabc78997e574e3e21eae Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Thu, 15 Mar 2018 11:01:33 +0100 Subject: [dnbd3-rootfs] support multiple identifiers RW dev --- .../dnbd3-rootfs/hooks/prepare-root-partition.sh | 23 +++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'builder') 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 -- cgit v1.2.3-55-g7522