udev has used blkid since version 142, so we can rely on it being present at build and boot time. Signed-off-by: Ben Hutchings <ben@decadent.org.uk> --- hooks/fsck | 6 ++---- hooks/resume | 5 ++--- scripts/functions | 11 ++--------- 3 files changed, 6 insertions(+), 16 deletions(-) diff --git a/hooks/fsck b/hooks/fsck index 4472f6a..ad0fbc5 100755 --- a/hooks/fsck +++ b/hooks/fsck @@ -57,10 +57,8 @@ get_fsck_type_fstab () { if [ "$1" = "$MNT_DIR" ] && [ "$MNT_PASS" != 0 ]; then case "$MNT_TYPE" in auto) - if command -v blkid >/dev/null 2>&1 ; then - MNT_FSNAME=$(resolve_device "$MNT_FSNAME") - MNT_TYPE=$(blkid -o value -s TYPE "${MNT_FSNAME}") - fi + MNT_FSNAME=$(resolve_device "$MNT_FSNAME") + MNT_TYPE=$(blkid -o value -s TYPE "${MNT_FSNAME}") if [ -z "${MNT_TYPE}" ]; then MNT_TYPE="auto" fi diff --git a/hooks/resume b/hooks/resume index 96e2ffd..0d33977 100755 --- a/hooks/resume +++ b/hooks/resume @@ -18,8 +18,7 @@ esac # First check if a location is set and is a valid swap partition test -r /etc/initramfs-tools/conf.d/resume \ && . /etc/initramfs-tools/conf.d/resume -if [ -n "$RESUME" ] && command -v blkid >/dev/null 2>&1 \ - && blkid -p -n swap $RESUME >/dev/null 2>&1; then +if [ -n "$RESUME" ] && blkid -p -n swap $RESUME >/dev/null 2>&1; then # As mkinitramfs copies the config file nothing to do. exit 0 fi @@ -42,7 +41,7 @@ chrooted() { # Try to autodetect the RESUME partition, using biggest swap? RESUME=$(grep ^/dev/ /proc/swaps | sort -rk3 | head -n 1 | cut -d " " -f 1) -if [ -n "$RESUME" ] && command -v blkid >/dev/null 2>&1; then +if [ -n "$RESUME" ]; then UUID=$(blkid -s UUID -o value "$RESUME" || true) if [ -n "$UUID" ]; then RESUME="UUID=$UUID" diff --git a/scripts/functions b/scripts/functions index 930a12c..2c36ed2 100644 --- a/scripts/functions +++ b/scripts/functions @@ -143,10 +143,8 @@ get_fstype () # but fstype is more robust FSTYPE="unknown" eval $(fstype "${FS}" 2> /dev/null) - if [ "$FSTYPE" = "unknown" ] && command -v blkid >/dev/null 2>&1 ; then + if [ "$FSTYPE" = "unknown" ]; then FSTYPE=$(blkid -o value -s TYPE "${FS}") - elif [ "$FSTYPE" = "unknown" ] && [ -x /lib/udev/vol_id ]; then - FSTYPE=$(/lib/udev/vol_id -t "${FS}" 2> /dev/null) fi RET=$? @@ -299,12 +297,7 @@ resolve_device() { case "$DEV" in LABEL=* | UUID=* | PARTLABEL=* | PARTUUID=*) - if command -v blkid >/dev/null 2>&1; then - DEV="$(blkid -l -t "$DEV" -o device)" || return 1 - else - log_warning_msg "blkid not present, so cannot resolve $DEV" - return 1 - fi + DEV="$(blkid -l -t "$DEV" -o device)" || return 1 ;; esac [ -e "$DEV" ] && echo "$DEV"
Attachment:
signature.asc
Description: Digital signature