AM_CONDITIONAL([LINUX], test "x$linux_os" = xyes)
AC_PATH_PROG(PERL, perl)
-AC_PATH_PROG(BLKID, blkid, [], [$PATH:/sbin])
-AC_PATH_PROG(VOLID, vol_id, [], [$PATH:/lib/udev])
AC_SYS_LARGEFILE
# TODO: use partx
TS_HELPER_PARTITIONS="$TOPDIR/shlibs/blkid/samples/partitions"
-# external commands
-TS_ECMD_BLKID="@BLKID@"
-TS_ECMD_VOLID="@VOLID@"
-
U_L_LIBRARY_PATH="$TOPDIR/shlibs/blkid/src/.libs:$TOPDIR/shlibs/uuid/src/.libs"
# paths to commands
TS_MOUNTPOINT="$TS_OUTDIR/${TS_TESTNAME}-mnt"
TS_VERBOSE=$(ts_has_option "verbose" "$*")
- TS_HAS_VOLUMEID="no"
BLKID_FILE="$TS_OUTDIR/${TS_TESTNAME}.blkidtab"
export BLKID_FILE
- if [ -x $TS_CMD_MOUNT ]; then
- ldd $TS_CMD_MOUNT | grep -q 'libvolume_id' &> /dev/null
- [ "$?" == "0" ] && TS_HAS_VOLUMEID="yes"
- fi
-
rm -f $TS_OUTPUT
touch $TS_OUTPUT
fi
}
-function ts_udev_dev_support {
- if [ "$TS_HAS_VOLUMEID" == "yes" ] && [ ! -L "/dev/disk/$1/$2" ]; then
- return 1
- fi
- return 0
-}
-
function ts_uuid_by_devname {
- local DEV="$1"
- local UUID=""
- if [ -x "$TS_ECMD_BLKID" ]; then
- UUID=$($TS_ECMD_BLKID -c /dev/null -w /dev/null -s "UUID" $DEV | sed 's/.*UUID="//g; s/"//g')
- elif [ -x "$TS_ECMD_VOLID" ]; then
- UUID=$($TS_ECMD_VOLID -u $DEV)
- fi
- echo $UUID
+ echo $($TS_CMD_BLKID -p -s UUID -o value $1)
}
function ts_label_by_devname {
- local DEV="$1"
- local TYPE=""
- if [ -x "$TS_ECMD_BLKID" ]; then
- LABEL=$($TS_ECMD_BLKID -c /dev/null -w /dev/null -s "LABEL" $DEV | sed 's/.*LABEL="//g; s/"//g')
- elif [ -x "$TS_ECMD_VOLID" ]; then
- LABEL=$($TS_ECMD_VOLID -l $DEV)
- fi
- echo $LABEL
+ echo $($TS_CMD_BLKID -p -s LABEL -o value $1)
}
function ts_fstype_by_devname {
- local DEV="$1"
- local TYPE=""
- if [ -x "$TS_ECMD_BLKID" ]; then
- TYPE=$($TS_ECMD_BLKID -c /dev/null -w /dev/null -s "TYPE" $DEV | sed 's/.*TYPE="//g; s/"//g')
- elif [ -x "$TS_ECMD_VOLID" ]; then
- TYPE=$($TS_ECMD_VOLID -t $DEV)
- fi
- echo $TYPE
+ echo $($TS_CMD_BLKID -p -s TYPE -o value $1)
}
function ts_device_has {
ts_device_has "TYPE" "cramfs" $DEVICE
[ "$?" == "0" ] || ts_die "Cannot found cramfs on $DEVICE" $DEVICE
-ts_udev_dev_support "by-label" $LABEL
-[ "$?" == "0" ] || ts_skip "udev ignores /dev/loop*" $DEVICE
-
ts_log "mount the image"
$TS_CMD_MOUNT -L $LABEL $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT
ts_device_has "LABEL" $LABEL $DEVICE \
|| ts_die "Cannot found LABEL '$LABEL' on $DEVICE" $DEVICE
-ts_udev_dev_support "by-label" $LABEL || ts_skip "udev ignores /dev/loop*" $DEVICE
-
[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
ts_fstab_add "LABEL=$LABEL"
ts_device_has "LABEL" $LABEL $DEVICE \
|| ts_die "Cannot found LABEL '$LABEL' on $DEVICE" $DEVICE
-ts_udev_dev_support "by-label" $LABEL || ts_skip "udev ignores /dev/loop*" $DEVICE
-
[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
ts_fstab_add "$DEVICE"
ts_device_has "LABEL" $LABEL $DEVICE \
|| ts_die "Cannot found LABEL '$LABEL' on $DEVICE" $DEVICE
-ts_udev_dev_support "by-label" $LABEL || ts_skip "udev ignores /dev/loop*" $DEVICE
-
ts_device_has_uuid $DEVICE || ts_die "Cannot found UUID on $DEVICE" $DEVICE
UUID=$(ts_uuid_by_devname $DEVICE)
UUID=$(ts_uuid_by_devname $DEVICE)
-ts_udev_dev_support "by-uuid" $UUID || ts_skip "udev ignores /dev/loop*" $DEVICE
-
[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
ts_fstab_add "UUID=$UUID"
UUID=$(ts_uuid_by_devname $DEVICE)
-ts_udev_dev_support "by-uuid" $UUID || ts_skip "udev ignores /dev/loop*" $DEVICE
-
[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
ts_fstab_add "$DEVICE"
ts_device_has "LABEL" $LABEL $DEVICE \
|| ts_die "Cannot found LABEL '$LABEL' on $DEVICE" $DEVICE
-ts_udev_dev_support "by-label" $LABEL || ts_skip "udev ignores /dev/loop*" $DEVICE
-
ts_device_has_uuid $DEVICE || ts_die "Cannot found UUID on $DEVICE" $DEVICE
UUID=$(ts_uuid_by_devname $DEVICE)
ts_device_has "LABEL" $LABEL $DEVICE \
|| ts_die "Cannot found LABEL '$LABEL' on $DEVICE" $DEVICE
-ts_udev_dev_support "by-label" $LABEL \
- || ts_skip "udev ignores /dev/loop*" $DEVICE
-
[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
# variant A)
UUID=$(ts_uuid_by_devname $DEVICE)
-ts_udev_dev_support "by-uuid" $UUID \
- || ts_skip "udev ignores /dev/loop*" $DEVICE
-
[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
# variant A)
ts_device_has "LABEL" $LABEL $DEVICE \
|| ts_die "Cannot found LABEL '$LABEL' on $DEVICE" $DEVICE
-ts_udev_dev_support "by-label" $LABEL || ts_skip "udev ignores /dev/loop*" $DEVICE
-
LD_LIBRARY_PATH="$U_L_LIBRARY_PATH" \
$TS_CMD_SWAPON -L $LABEL 2>&1 >> $TS_OUTPUT
UUID=$(ts_uuid_by_devname $DEVICE)
-ts_udev_dev_support "by-uuid" $UUID || ts_skip "udev ignores /dev/loop*" $DEVICE
-
LD_LIBRARY_PATH="$U_L_LIBRARY_PATH" \
$TS_CMD_SWAPON -U $UUID 2>&1 >> $TS_OUTPUT