summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Bauer2018-11-12 12:26:08 +0100
committerJonathan Bauer2018-11-12 17:30:33 +0100
commit9794441a32deb90d22a358207763aff7224acbfa (patch)
tree905efed6d7df223073c624add6de7dbbbddadebc
parent[slx-splash] restore cursor after splashscreen (diff)
downloadsystemd-init-9794441a32deb90d22a358207763aff7224acbfa.tar.gz
systemd-init-9794441a32deb90d22a358207763aff7224acbfa.tar.xz
systemd-init-9794441a32deb90d22a358207763aff7224acbfa.zip
rework scratch partition detected in deprecated module
-rwxr-xr-xbuilder/modules.d/openslx_tmp_format/scripts/openslx_tmp_format.sh18
1 files 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}" ] ||