4 ##############################################################
6 # Copyright (c) International Business Machines Corp., 2003
8 # This program 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.
13 # This program 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
16 # the GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 # USAGE : isofs.sh <optional> -n (no clean up)
25 # DESCRIPTION : A script that will test isofs on Linux system.
26 # It makes ISO9660 file system with different options and also
27 # mounts the ISO9660 file system with different mount options.
32 # 06/27/2003 Prakash Narayana (prakashn@us.ibm.com)
33 # 07/28/2005 Michael Reed (mreed10@us.ibm.com)
34 # - Changed the directory where the filesytems were being created
35 # from /etc to copying /etc to /tmp/for_isofs_test/etc and
36 # creating the file systems there
37 # - Added the -n option to not remove the directories created for
39 # - Added -d option to specify a different directory to copy to /tmp
40 # to make the file system
42 # CODE COVERAGE: 40.5% - fs/isofs (Total Coverage)
44 # 23.7% - fs/isofs/dir.c
45 # 46.0% - fs/isofs/inode.c
46 # 22.9% - fs/isofs/joliet.c
47 # 50.0% - fs/isofs/namei.c
48 # 38.5% - fs/isofs/rock.c
49 # 10.7% - fs/isofs/util.c
51 ##############################################################
58 echo "USAGE: $USAGE <optional> -n -h -d [directory name]"
62 #Initialize directory variables
63 MNT_POINT
="/tmp/isofs_$$"
65 TEMP_DIR
="/tmp/for_isofs_test"
66 MAKE_FILE_SYS_DIR
=$TEMP_DIR$COPY_DIR
68 while getopts :hnd
: arg
72 MAKE_FILE_SYS_DIR
="/tmp/for_isofs_test"$COPY_DIR
76 echo "n - The directories created will not be removed"
77 echo "d - Specify a directory to copy into /tmp"
78 echo "h - Help options"
90 ##############################################################
92 # Make sure that uid=root is running this script.
93 # Validate the command line arguments.
95 ##############################################################
99 echo "FAILED: Must have root access to execute this script"
104 mkdir
-p -m 777 $MNT_POINT
105 mkdir
-p $MAKE_FILE_SYS_DIR
108 if [ -e "$COPY_DIR" ]; then
109 cp -rf $COPY_DIR* $MAKE_FILE_SYS_DIR
111 echo "$COPY_DIR not found"
112 echo "use the -d option to copy a different directory into"
113 echo "/tmp to makethe ISO9660 file system with different"
120 # Make ISO9660 file system with different options.
121 # Mount the ISO9660 file system with different mount options.
129 "-f -l -D -J -L -R" \
130 "-allow-lowercase -allow-multidot -iso-level 3 -f -l -D -J -L -R"
132 echo "Running mkisofs -o isofs.iso -quiet $mkisofs_opt $MAKE_FILE_SYS_DIR Command"
133 mkisofs
-o isofs.iso
-quiet $mkisofs_opt $MAKE_FILE_SYS_DIR
136 rm -rf isofs.iso
$MNT_POINT
137 echo "FAILED: mkisofs -o isofs.iso $mkisofs_opt $MAKE_FILE_SYS_DIR failed"
144 "loop,block=512,unhide" \
145 "loop,block=1024,cruft" \
146 "loop,block=2048,nocompress" \
147 "loop,check=strict,map=off,gid=bin,uid=bin" \
148 "loop,check=strict,map=acorn,gid=bin,uid=bin" \
149 "loop,check=relaxed,map=normal" \
150 "loop,block=512,unhide,session=2"
153 echo "Running mount -o $mount_opt isofs.iso $MNT_POINT Command"
154 mount
-t iso9660
-o $mount_opt isofs.iso
$MNT_POINT
157 rm -rf isofs.iso
$MNT_POINT
158 echo "FAILED: mount -t iso9660 -o $mount_opt isofs.iso $MNT_POINT failed"
161 echo "Running ls -lR $MNT_POINT Command"
163 exportfs
-i -o no_root_squash
,rw
*:$MNT_POINT
164 exportfs
-u :$MNT_POINT
170 #######################################################
172 # Just before exit, perform the cleanup.
174 #######################################################
176 if [ "$NO_CLEANUP" == "no" ]; then
177 echo "$MAKE_FILE_SYS_DIR and $MNT_POINT were not removed"
178 echo "These directories will have to be removed manually"
185 echo "PASSED: $0 passed!"