From 9794441a32deb90d22a358207763aff7224acbfa Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Mon, 12 Nov 2018 12:26:08 +0100 Subject: rework scratch partition detected in deprecated module --- .../openslx_tmp_format/scripts/openslx_tmp_format.sh | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/builder/modules.d/openslx_tmp_format/scripts/openslx_tmp_format.sh b/builder/modules.d/openslx_tmp_format/scripts/openslx_tmp_format.sh index bbcde895..3cf5615e 100755 --- a/builder/modules.d/openslx_tmp_format/scripts/openslx_tmp_format.sh +++ b/builder/modules.d/openslx_tmp_format/scripts/openslx_tmp_format.sh @@ -14,25 +14,21 @@ command -v emergency_shell >/dev/null || source /lib/dracut-lib.sh # Support comma-separated list of identifiers, e.g. # "OpenSLX-ID44,0x44" as these can match GPT label (recommended) -# and even MBR partition types (more of an ugly hack currently...) -OLDIFS="$IFS" -IFS="," SLX_TMP_PARTITION_DEVICE= -for identifier in ${SLX_TMP_PARTITION_IDENTIFIER}; do - SLX_TMP_PARTITION_DEVICE="$(tools.find_block_device "${identifier}" '' \ - "${SLX_TMP_PARTITION_IDENTIFIER_TIMEOUT_IN_SECONDS:-5}")" - if [ -n "${SLX_TMP_PARTITION_DEVICE}" ]; then - echo "SLX_TMP_PARTITION_DEVICE=${SLX_TMP_PARTITION_DEVICE}" >> /etc/openslx - break - fi +for dev in $(find /dev -type b); do + udevadm info "$dev" \ + | grep -qE 'ID_PART_ENTRY_(NAME|TYPE)=('"${SLX_TMP_PARTITION_IDENTIFIER//,/|}"')' \ + && SLX_TMP_PARTITION_DEVICE="$dev" && break done -IFS="$OLDIFS" if [ -z "${SLX_TMP_PARTITION_DEVICE}" ]; then warn "[${BASH_SOURCE[0]}] \ Could not find device matching identifiers: ${SLX_TMP_PARTITION_IDENTIFIER}." return 1 fi +# remember in the main openslx config +echo "SLX_TMP_PARTITION_DEVICE=${SLX_TMP_PARTITION_DEVICE}" >> /etc/openslx + # Since a partition identifier is set and this module was built # assume that the partition should always be formatted. if [ -z "${SLX_TMP_PARTITION_FILESYSTEM_CREATE_COMMAND}" ] || -- cgit v1.2.3-55-g7522