diff options
author | Jonathan Bauer | 2018-03-15 11:27:02 +0100 |
---|---|---|
committer | Jonathan Bauer | 2018-03-15 11:27:02 +0100 |
commit | dcc3097b55b67b1b1c605b9023015723815ee47f (patch) | |
tree | 200d4000f74c71d5cb436d2a030847d968ab5d02 | |
parent | [dnbd3-rootfs] formatting (diff) | |
download | systemd-init-dcc3097b55b67b1b1c605b9023015723815ee47f.tar.gz systemd-init-dcc3097b55b67b1b1c605b9023015723815ee47f.tar.xz systemd-init-dcc3097b55b67b1b1c605b9023015723815ee47f.zip |
[openslx_tmp_*] support list of tmp identifier
... comma-separated.
openslx_tmp_mount expect to read the discovered device from
/etc/openslx as SLX_TMP_PARTITION_DEVICE
-rwxr-xr-x | builder/modules.d/openslx_tmp_format/scripts/openslx_tmp_format.sh | 22 | ||||
-rwxr-xr-x | builder/modules.d/openslx_tmp_mount/scripts/openslx_tmp_mount.sh | 8 |
2 files changed, 23 insertions, 7 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 ef34b6c0..35eb6146 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 @@ -11,13 +11,27 @@ command -v emergency_shell >/dev/null || source /lib/dracut-lib.sh # If it is not set, assume the functionality is unwanted [ -z "${SLX_TMP_PARTITION_IDENTIFIER}" ] && return 0 -SLX_TMP_PARTITION_DEVICE="/dev/disk/by-partlabel/${SLX_TMP_PARTITION_IDENTIFIER}" -if [ ! -b "$(readlink -f ${SLX_TMP_PARTITION_DEVICE})" ]; then +# 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:-10}")" + if [ -n "${SLX_TMP_PARTITION_DEVICE}" ]; then + echo "SLX_TMP_PARTITION_DEVICE=${SLX_TMP_PARTITION_DEVICE}" >> /etc/openslx + break + fi +done +IFS="$OLDIFS" + +if [ -z "${SLX_TMP_PARTITION_DEVICE}" ]; then warn "[${BASH_SOURCE[0]}] \ - '${SLX_TMP_PARTITION_DEVICE}' does not point to a block device" + Could not find device matching identifiers: ${SLX_TMP_PARTITION_IDENTIFIER}." return 1 fi - # 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}" ] || diff --git a/builder/modules.d/openslx_tmp_mount/scripts/openslx_tmp_mount.sh b/builder/modules.d/openslx_tmp_mount/scripts/openslx_tmp_mount.sh index 48e733c7..ddf974fc 100755 --- a/builder/modules.d/openslx_tmp_mount/scripts/openslx_tmp_mount.sh +++ b/builder/modules.d/openslx_tmp_mount/scripts/openslx_tmp_mount.sh @@ -2,8 +2,10 @@ . /etc/openslx -if [ -n "$SLX_TMP_PARTITION_IDENTIFIER" ]; then - mount -t auto "/dev/disk/by-partlabel/$SLX_TMP_PARTITION_IDENTIFIER" "$NEWROOT/tmp" - chmod a+rwxt "$NEWROOT/tmp" +# The device should have been discovered by openslx_tmp_format hook +# and written to /etc/openslx +if [ -n "${SLX_TMP_PARTITION_DEVICE}" ]; then + mount -t auto "${SLX_TMP_PARTITION_DEVICE}" "${NEWROOT}/tmp" + chmod a+rwxt "${NEWROOT}/tmp" # TODO fstab fi |