From dc6f9db8bdf6292ca303369d2f5bc2398fb2610f Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Wed, 5 Nov 2008 11:05:55 -0500 Subject: blkid has a -l option to pick a single device. Use it. (#470027) Notably, it prioritizes RAID/DM/LVM, etc. over the underlying block devices. Given that initial RAID0 members share a UUID with the RAID device itself, we need that. --- rc.d/rc.sysinit | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'rc.d') diff --git a/rc.d/rc.sysinit b/rc.d/rc.sysinit index 5d9a710d..df911805 100755 --- a/rc.d/rc.sysinit +++ b/rc.d/rc.sysinit @@ -154,7 +154,7 @@ init_crypto() { skip="" # Parse the src field for UUID= and convert to real device names if [ "${src%%=*}" == "UUID" ]; then - src=`/sbin/blkid -t "$src" -o device|(read oneline;echo $oneline)` + src=$(/sbin/blkid -t "$src" -l -o device) elif [ "${src/^\/dev\/disk\/by-uuid\/}" != "$src" ]; then src=$(__readlink $src) fi @@ -454,7 +454,7 @@ if [ "$READONLY" = "yes" -o "$TEMPORARY_STATE" = "yes" ]; then mountopts= # Scan partitions for local scratch storage - rw_mount_dev=$(blkid -t LABEL="$RW_LABEL" -o device | awk '{ print ; exit }') + rw_mount_dev=$(blkid -t LABEL="$RW_LABEL" -l -o device) # First try to mount scratch storage from /etc/fstab, then any # partition with the proper label. If either succeeds, be sure @@ -511,7 +511,7 @@ if [ "$READONLY" = "yes" -o "$TEMPORARY_STATE" = "yes" ]; then # First try to mount persistent data from /etc/fstab, then any # partition with the proper label, then fallback to NFS - state_mount_dev=$(blkid -t LABEL="$STATE_LABEL" -o device | awk '{ print ; exit }') + state_mount_dev=$(blkid -t LABEL="$STATE_LABEL" -l -o device) if mount $mountopts $STATE_OPTIONS "$STATE_MOUNT" > /dev/null 2>&1 ; then /bin/true elif [ x$state_mount_dev != x ] && mount $state_mount_dev $mountopts "$STATE_MOUNT" > /dev/null 2>&1; then @@ -787,7 +787,7 @@ update_boot_stage RCswap action $"Enabling /etc/fstab swaps: " swapon -a -e if [ "$AUTOSWAP" = "yes" ]; then curswap=$(awk '/^\/dev/ { print $1 }' /proc/swaps | while read x; do get_numeric_dev dec $x ; echo -n " "; done) - swappartitions=`blkid -t TYPE=swap -o device` + swappartitions=$(blkid -t TYPE=swap -o device) if [ x"$swappartitions" != x ]; then for partition in $swappartitions ; do [ ! -e $partition ] && continue -- cgit v1.2.1