~ubuntu-branches/ubuntu/lucid/loop-aes-utils/lucid-security

« back to all changes in this revision

Viewing changes to tests/ts-fstab-label

  • Committer: Bazaar Package Importer
  • Author(s): Max Vozeler
  • Date: 2008-08-22 11:57:17 UTC
  • mfrom: (8.1.3 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080822115717-v8wfa8pxwlfvyje0
Tags: 2.13.1-4
* patches/losetup_add_option_f.dpatch: 
  - Added to support "find next free loop" in losetup.
    (closes: #495682)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
 
 
3
#
 
4
# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
 
5
#
 
6
# This file is part of util-linux-ng.
 
7
#
 
8
# This file is free software; you can redistribute it and/or modify
 
9
# it under the terms of the GNU General Public License as published by
 
10
# the Free Software Foundation; either version 2 of the License, or
 
11
# (at your option) any later version.
 
12
#
 
13
# This file is distributed in the hope that it will be useful,
 
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
16
# GNU General Public License for more details.
 
17
#
 
18
. ./commands.sh
 
19
. ./functions.sh
 
20
 
 
21
TS_COMPONENT="fstab"
 
22
TS_DESC="label"
 
23
 
 
24
LABEL="testFstabLabel"
 
25
 
 
26
ts_init "$*"
 
27
ts_skip_nonroot
 
28
 
 
29
set -o pipefail
 
30
 
 
31
DEVICE=$(ts_device_init)
 
32
[ "$?" == 0 ] || ts_die "Cannot init device"
 
33
 
 
34
mkfs.ext3 -L $LABEL $DEVICE &> /dev/null
 
35
[ "$?" == "0" ] || ts_die "Cannot make ext3 on $DEVICE" $DEVICE
 
36
 
 
37
ts_device_has "LABEL" $LABEL $DEVICE
 
38
[ "$?" == "0" ] || ts_die "Cannot found LABEL '$LABEL' on $DEVICE" $DEVICE
 
39
 
 
40
ts_udev_dev_support "by-label" $LABEL
 
41
[ "$?" == "0" ] || ts_skip "udev ignores /dev/loop*" $DEVICE
 
42
 
 
43
[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
 
44
 
 
45
ts_fstab_add "LABEL=$LABEL"
 
46
 
 
47
# variant A)
 
48
$TS_CMD_MOUNT $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT
 
49
grep -q $DEVICE /proc/mounts
 
50
[ "$?" == "0" ] || ts_die "A) Cannot found $DEVICE in /proc/mounts" $DEVICE
 
51
$TS_CMD_UMOUNT $DEVICE
 
52
[ "$?" == "0" ] || ts_die "A) Cannot umount $DEVICE" $DEVICE
 
53
 
 
54
# variant B)
 
55
$TS_CMD_MOUNT -L $LABEL 2>&1 >> $TS_OUTPUT
 
56
grep -q $DEVICE /proc/mounts
 
57
[ "$?" == "0" ] || ts_die "B) Cannot found $DEVICE in /proc/mounts" $DEVICE
 
58
$TS_CMD_UMOUNT $DEVICE
 
59
[ "$?" == "0" ] || ts_die "B) Cannot umount $DEVICE" $DEVICE
 
60
 
 
61
# variant C)
 
62
$TS_CMD_MOUNT LABEL=$LABEL 2>&1 >> $TS_OUTPUT
 
63
grep -q $DEVICE /proc/mounts
 
64
[ "$?" == "0" ] || ts_die "C) Cannot found $DEVICE in /proc/mounts" $DEVICE
 
65
$TS_CMD_UMOUNT $DEVICE
 
66
[ "$?" == "0" ] || ts_die "C) Cannot umount $DEVICE" $DEVICE
 
67
 
 
68
ts_device_deinit $DEVICE
 
69
ts_fstab_clean
 
70
 
 
71
ts_log "Success"
 
72
ts_finalize
 
73