2009-02-18 16:10:45 +01:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# Copyright (C) 2009 Karel Zak <kzak@redhat.com>
|
|
|
|
#
|
2010-11-30 11:41:59 +01:00
|
|
|
# This file is part of util-linux.
|
2009-02-18 16:10:45 +01:00
|
|
|
#
|
|
|
|
# This file is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This file is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
2014-02-16 23:54:14 +00:00
|
|
|
TS_TOPDIR="${0%/*}/../.."
|
2009-02-18 16:10:45 +01:00
|
|
|
TS_DESC="is mounted"
|
|
|
|
|
2022-11-23 16:03:37 +09:00
|
|
|
. "$TS_TOPDIR"/functions.sh
|
2009-02-18 16:10:45 +01:00
|
|
|
ts_init "$*"
|
2014-02-16 15:22:56 +00:00
|
|
|
|
|
|
|
ts_check_test_command "$TS_CMD_MOUNT"
|
2019-03-04 16:42:30 +01:00
|
|
|
ts_check_test_command "$TS_CMD_UMOUNT"
|
|
|
|
ts_check_test_command "$TS_HELPER_ISMOUNTED"
|
2014-02-16 15:22:56 +00:00
|
|
|
|
2009-02-18 16:10:45 +01:00
|
|
|
ts_skip_nonroot
|
2014-05-12 12:45:03 +02:00
|
|
|
ts_check_losetup
|
2021-01-26 11:11:14 +01:00
|
|
|
ts_check_prog "mkfs.ext2"
|
2009-02-18 16:10:45 +01:00
|
|
|
|
|
|
|
> $TS_OUTPUT
|
|
|
|
|
2015-03-31 14:19:40 +02:00
|
|
|
ts_device_init
|
|
|
|
DEVICE=$TS_LODEV
|
2009-02-18 16:10:45 +01:00
|
|
|
|
2021-01-26 11:11:14 +01:00
|
|
|
mkfs.ext2 $DEVICE &> /dev/null || ts_die "Cannot make ext2 on $DEVICE"
|
2009-02-18 16:10:45 +01:00
|
|
|
|
2021-01-26 11:11:14 +01:00
|
|
|
ts_device_has "TYPE" "ext2" $DEVICE || ts_die "Cannot find ext2 on $DEVICE"
|
2009-02-18 16:10:45 +01:00
|
|
|
|
|
|
|
[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
|
|
|
|
|
2019-08-30 15:50:07 +02:00
|
|
|
$TS_CMD_MOUNT $DEVICE $TS_MOUNTPOINT >> $TS_OUTPUT 2>> $TS_ERRLOG
|
2009-02-18 16:10:45 +01:00
|
|
|
|
|
|
|
# test by ismounted.c
|
2019-08-30 15:50:07 +02:00
|
|
|
$TS_HELPER_ISMOUNTED $DEVICE | awk '{print $1}' >> $TS_OUTPUT 2>> $TS_ERRLOG
|
2009-02-18 16:10:45 +01:00
|
|
|
|
2015-03-31 14:35:07 +02:00
|
|
|
$TS_CMD_UMOUNT $DEVICE || ts_die "Cannot umount $DEVICE"
|
2009-02-18 16:10:45 +01:00
|
|
|
|
|
|
|
ts_finalize
|