1 # Create and verify a simple ISO filesystem
9 # Somehow timezones mess up the timestamp comparison, so unset the timezone for
10 # now. TODO: sort out if this is actually a bug or simply expected behavior.
13 # testing ISO 9660 Level 3 compliance isn't possible for the time being
14 # (not possible to store a >4GB ISO file into a ramdisk)
27 create_contents_level3
() {
29 seq 1 1000000000 > $testdir/HUGEFILE
32 create_contents_rockridge
() {
34 mkdir
-p $testdir/rockridge
/longnames
35 echo "this is a test" > $testdir/rockridge
/longnames
/azertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopaz
36 echo "this is a test" > $testdir/rockridge
/longnames
/azertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopaze
37 echo "this is a test" > $testdir/rockridge
/longnames
/azertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazertyuiopazer
40 mkdir
-p $testdir/rockridge
/devices
42 cd $testdir/rockridge
/devices
&& MAKEDEV
-s
46 mkdir
-p $testdir/rockridge
/symlinks
47 ln -s .
$testdir/rockridge
/symlinks
/cur_dir
48 ln -s ..
$testdir/rockridge
/symlinks
/parent_dir
49 ln -s / $testdir/rockridge
/symlinks
/root_dir
50 ln -s /mnt
$testdir/rockridge
/symlinks
/root_mnt_dir
51 ln -s ..
/..
/rockridge
$testdir/rockridge
/symlinks
/rockridge_dir
52 ln -s ..
/..
/rockridge
/symlinks
$testdir/rockridge
/symlinks
/symlinks_dir
53 ln -s ..
/..
/rockridge
/symlinks
/..
/symlinks
$testdir/rockridge
/symlinks
/symlinks_dir_bis
54 ln -s cur_dir
$testdir/rockridge
/symlinks
/to_cur_dir
55 ln -s rockridge_dir
$testdir/rockridge
/symlinks
/to_rockridge_dir
58 mkdir
-p $testdir/rockridge
/deep_dirs
/this
/is
/a
/ridiculously
/deep
/directory
/hierarchy
/dont
/you
/think
59 mkdir
-p $testdir/rockridge
/deep_dirs
/this
/is
/a
/ridiculously
/deep
/directory
/hierarchy
/dont
/you
/think
/yes
60 mkdir
-p $testdir/rockridge
/deep_dirs
/this
/is
/a
/ridiculously
/deep
/directory
/hierarchy
/dont
/you
/think
/no
61 echo "I agree." > $testdir/rockridge
/deep_dirs
/this
/is
/a
/ridiculously
/deep
/directory
/hierarchy
/dont
/you
/think
/yes
/awnser1
62 echo "Yes, totally." > $testdir/rockridge
/deep_dirs
/this
/is
/a
/ridiculously
/deep
/directory
/hierarchy
/dont
/you
/think
/yes
/awnser2
63 echo "Nah." > $testdir/rockridge
/deep_dirs
/this
/is
/a
/ridiculously
/deep
/directory
/hierarchy
/dont
/you
/think
/no
/awnser1
64 echo "Meh." > $testdir/rockridge
/deep_dirs
/this
/is
/a
/ridiculously
/deep
/directory
/hierarchy
/dont
/you
/think
/no
/awnser2
67 mkdir
-p $testdir/rockridge
/permissions
68 for u
in $
(seq 0 7); do
69 for g
in $
(seq 0 7); do
70 for o
in $
(seq 0 7); do
71 echo "$u$g$o" > $testdir/rockridge
/permissions
/mode-
$u$g$o
72 chmod $u$g$o $testdir/rockridge
/permissions
/mode-
$u$g$o
76 echo "uid-gid test" > $testdir/rockridge
/permissions
/uid-1-gid-2
77 chown
1:2 $testdir/rockridge
/permissions
/uid-1-gid-2
78 echo "uid-gid test" > $testdir/rockridge
/permissions
/uid-128-gid-256
79 chown
128:256 $testdir/rockridge
/permissions
/uid-128-gid-256
80 echo "uid-gid test" > $testdir/rockridge
/permissions
/uid-12345-gid-23456
81 chown
12345:23456 $testdir/rockridge
/permissions
/uid-12345-gid-23456
84 create_contents_base
() {
86 echo $
(date) > $testdir/DATE
89 seq 1 100000 > $testdir/BIGFILE
91 # lots of files in a directory
93 for i
in $
(seq 1 250); do
94 HASH
=$
(cksum -a SHA1
<<EOF
98 FILE
=$
(echo $HASH | cut
-c 1-30 |
sed -e "y/abcdef/ABCDEF/")
99 echo $HASH > $testdir/BIGDIR
/$FILE
102 # lots of directories
103 mkdir
$testdir/SUBDIRS
104 for i
in $
(seq 1 1000); do
105 HASH
=$
(cksum -a SHA1
<<EOF
109 DIR1
=$
(echo $HASH | cut
-c 1-2 |
sed -e "y/abcdef/ABCDEF/")
110 DIR2
=$
(echo $HASH | cut
-c 3-4 |
sed -e "y/abcdef/ABCDEF/")
111 FILE
=$
(echo $HASH | cut
-c 5-12 |
sed -e "y/abcdef/ABCDEF/")
112 mkdir
-p $testdir/SUBDIRS
/$DIR1/$DIR2
113 echo $HASH > $testdir/SUBDIRS
/$DIR1/$DIR2/$FILE
117 rm -rf $testdir $fsimage $out1 $out2 $excludes
133 # make some small & big & bigger files
136 if [ "$testLevel3" -eq 1 ]
138 create_contents_level3
140 if [ "$testRockRidge" -eq 1 ]
142 create_contents_rockridge
143 OPTIONS
="-o rockridge"
145 # fixups for the fact that bare ISO 9660 isn't POSIX enough
148 find $testdir -exec chmod 555 {} ";"
152 /usr
/sbin
/makefs
-t cd9660
$OPTIONS $fsimage $testdir
154 # umount previous things
155 umount
$ramdev >/dev
/null
2>&1 || true
156 umount
$mp >/dev
/null
2>&1 || true
158 # mount it on a RAM disk
159 ramdisk $
(expr $
(wc -c < $fsimage) / 1024) $ramdev >/dev
/null
2>&1
160 cat < $fsimage > $ramdev
161 mount
-t isofs
$ramdev $mp >/dev
/null
2>&1
164 if [ "$testRockRidge" -eq 1 ]
166 # get rid of root directory time
167 echo 'RR_MOVED' >$excludes
168 /usr
/sbin
/mtree
-c -p $testdir |
sed -e "s/\. *type=dir.*/\. type=dir/" |
/usr
/sbin
/mtree
-p $mp -X $excludes
170 # fixups for the fact that bare ISO 9660 isn't POSIX enough
173 /usr
/sbin
/mtree
-c -p $testdir |
sed -e "s/time=[0-9]*.[0-9]*//" |
/usr
/sbin
/mtree
-p $mp
176 umount
$ramdev >/dev
/null
2>&1
179 rm -rf $testdir $fsimage $out1 $out2 $excludes