. functions.sh
TS_COMPONENT="fstab"
-TS_DESC="label"
+TS_DESC="devname"
ts_init "$1"
ts_skip_nonroot
DEVICE=$(ts_device_init)
[ "$?" == 0 ] || ts_die "Cannot init device"
-mkfs.ext3 $DEVICE &> /dev/null
+mkfs.ext3 $DEVICE &> /dev/null
[ "$?" == "0" ] || ts_die "Cannot make ext3 on $DEVICE" $DEVICE
ts_device_has "TYPE" "ext3" $DEVICE
ts_fstab_add $DEVICE
+# variant A)
$TS_CMD_MOUNT $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT
-
grep -q $DEVICE /proc/mounts
-[ "$?" == "0" ] || ts_die "Cannot found $DEVICE in /proc/mounts" $DEVICE
+[ "$?" == "0" ] || ts_die "A) Cannot found $DEVICE in /proc/mounts" $DEVICE
+$TS_CMD_UMOUNT $DEVICE
+[ "$?" == "0" ] || ts_die "A) Cannot umount $DEVICE" $DEVICE
+# variant B)
+$TS_CMD_MOUNT $DEVICE 2>&1 >> $TS_OUTPUT
+grep -q $DEVICE /proc/mounts
+[ "$?" == "0" ] || ts_die "B) Cannot found $DEVICE in /proc/mounts" $DEVICE
$TS_CMD_UMOUNT $DEVICE
-[ "$?" == "0" ] || ts_die "Cannot umount $DEVICE" $DEVICE
+[ "$?" == "0" ] || ts_die "B) Cannot umount $DEVICE" $DEVICE
ts_device_deinit $DEVICE
ts_fstab_clean
ts_fstab_add "LABEL=$LABEL"
+# variant A)
$TS_CMD_MOUNT $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT
+grep -q $DEVICE /proc/mounts
+[ "$?" == "0" ] || ts_die "A) Cannot found $DEVICE in /proc/mounts" $DEVICE
+$TS_CMD_UMOUNT $DEVICE
+[ "$?" == "0" ] || ts_die "A) Cannot umount $DEVICE" $DEVICE
+# variant B)
+$TS_CMD_MOUNT -L $LABEL 2>&1 >> $TS_OUTPUT
grep -q $DEVICE /proc/mounts
-[ "$?" == "0" ] || ts_die "Cannot found $DEVICE in /proc/mounts" $DEVICE
+[ "$?" == "0" ] || ts_die "B) Cannot found $DEVICE in /proc/mounts" $DEVICE
+$TS_CMD_UMOUNT $DEVICE
+[ "$?" == "0" ] || ts_die "B) Cannot umount $DEVICE" $DEVICE
+# variant C)
+$TS_CMD_MOUNT LABEL=$LABEL 2>&1 >> $TS_OUTPUT
+grep -q $DEVICE /proc/mounts
+[ "$?" == "0" ] || ts_die "C) Cannot found $DEVICE in /proc/mounts" $DEVICE
$TS_CMD_UMOUNT $DEVICE
-[ "$?" == "0" ] || ts_die "Cannot umount $DEVICE" $DEVICE
+[ "$?" == "0" ] || ts_die "C) Cannot umount $DEVICE" $DEVICE
ts_device_deinit $DEVICE
ts_fstab_clean
ts_fstab_add "UUID=$UUID"
+# varian A)
$TS_CMD_MOUNT $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT
+grep -q $DEVICE /proc/mounts
+[ "$?" == "0" ] || ts_die "A) Cannot found $DEVICE in /proc/mounts" $DEVICE
+$TS_CMD_UMOUNT $DEVICE
+[ "$?" == "0" ] || ts_die "A) Cannot umount $DEVICE" $DEVICE
+# varian B)
+$TS_CMD_MOUNT -U $UUID 2>&1 >> $TS_OUTPUT
grep -q $DEVICE /proc/mounts
-[ "$?" == "0" ] || ts_die "Cannot found $DEVICE in /proc/mounts" $DEVICE
+[ "$?" == "0" ] || ts_die "B) Cannot found $DEVICE in /proc/mounts" $DEVICE
+$TS_CMD_UMOUNT $DEVICE
+[ "$?" == "0" ] || ts_die "B) Cannot umount $DEVICE" $DEVICE
+# varian C)
+$TS_CMD_MOUNT UUID=$UUID 2>&1 >> $TS_OUTPUT
+grep -q $DEVICE /proc/mounts
+[ "$?" == "0" ] || ts_die "C) Cannot found $DEVICE in /proc/mounts" $DEVICE
$TS_CMD_UMOUNT $DEVICE
-[ "$?" == "0" ] || ts_die "Cannot umount $DEVICE" $DEVICE
+[ "$?" == "0" ] || ts_die "C) Cannot umount $DEVICE" $DEVICE
ts_device_deinit $DEVICE
ts_fstab_clean
[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
+# variant A)
$TS_CMD_MOUNT -L $LABEL $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT
-
grep -q $DEVICE /proc/mounts
-[ "$?" == "0" ] || ts_die "Cannot found $DEVICE in /proc/mounts" $DEVICE
+[ "$?" == "0" ] || ts_die "A) Cannot found $DEVICE in /proc/mounts" $DEVICE
+$TS_CMD_UMOUNT $DEVICE
+[ "$?" == "0" ] || ts_die "A) Cannot umount $DEVICE" $DEVICE
+# variant B)
+$TS_CMD_MOUNT LABEL=$LABEL $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT
+grep -q $DEVICE /proc/mounts
+[ "$?" == "0" ] || ts_die "B) Cannot found $DEVICE in /proc/mounts" $DEVICE
$TS_CMD_UMOUNT $DEVICE
-[ "$?" == "0" ] || ts_die "Cannot umount $DEVICE" $DEVICE
+[ "$?" == "0" ] || ts_die "B) Cannot umount $DEVICE" $DEVICE
ts_device_deinit $DEVICE
[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
+# variant A)
$TS_CMD_MOUNT -U $UUID $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT
-
grep -q $DEVICE /proc/mounts
-[ "$?" == "0" ] || ts_die "Cannot found $DEVICE in /proc/mounts" $DEVICE
+[ "$?" == "0" ] || ts_die "A) Cannot found $DEVICE in /proc/mounts" $DEVICE
+$TS_CMD_UMOUNT $DEVICE
+[ "$?" == "0" ] || ts_die "A) Cannot umount $DEVICE" $DEVICE
+# variant B)
+$TS_CMD_MOUNT UUID=$UUID $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT
+grep -q $DEVICE /proc/mounts
+[ "$?" == "0" ] || ts_die "B) Cannot found $DEVICE in /proc/mounts" $DEVICE
$TS_CMD_UMOUNT $DEVICE
-[ "$?" == "0" ] || ts_die "Cannot umount $DEVICE" $DEVICE
+[ "$?" == "0" ] || ts_die "B) Cannot umount $DEVICE" $DEVICE
ts_device_deinit $DEVICE