Upload Tizen:Base source
[framework/base/util-linux-ng.git] / tests / ts / minix / mkfs
1 #!/bin/bash
2 #
3 # Copyright (C) 2009 Karel Zak <kzak@redhat.com>
4 #
5 # This file is part of util-linux-ng.
6 #
7 # This file is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
11 #
12 # This file is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
16 #
17 TS_TOPDIR="$(dirname $0)/../.."
18 TS_DESC="mkfs"
19
20 . $TS_TOPDIR/functions.sh
21 ts_init "$*"
22 ts_skip_nonroot
23
24 set -o pipefail
25
26 IMAGE="$TS_OUTDIR/${TS_TESTNAME}-loop.img"
27 DEVICE=$(ts_device_init)
28
29 ts_log "create minix fs"
30 $TS_CMD_MKMINIX $DEVICE 2>&1 >> $TS_OUTPUT
31
32 ts_log "create mountpoint dir"
33 [ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
34
35 ts_log "mount the filesystem"
36 $TS_CMD_MOUNT $DEVICE $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT
37
38 # check it
39 ts_is_mounted $DEVICE || ts_die "Cannot found $DEVICE in /proc/mounts" $DEVICE
40
41 ts_log "umount the image"
42 $TS_CMD_UMOUNT $DEVICE
43 ts_device_deinit $DEVICE
44 ts_finalize
45