-# imagex mount
-
-for flag in "--compress=none" "--compress=maximum" "--compress=fast"; do
- echo "Using flag $flag"
- echo "Testing mounting WIM read-only"
- imagex capture dir dir.wim $flag
- mkdir tmp
- imagex mount dir.wim dir tmp
- echo "Testing extracting file from mounted read-only WIM"
- cp tmp/lz.c lz.c
- diff -q dir/lz.c lz.c
- diff -q tmp/lz.c dir/lz.c
- rm -f lz.c
- echo "Testing modifying mounted read-only WIM (should fail)"
- ! rm tmp/lz.c
- ! touch tmp/newfile
- ! echo 3 > tmp/newfile
- echo "Testing diff of mounted read-only WIM with original directory"
- diff -q -r tmp dir
- echo "Testing unmount of read-only filesystem"
- imagex unmount tmp
- echo "Testing unmount of read-only filesystem with --commit given"
- imagex mount dir.wim dir tmp
- imagex unmount tmp --commit
- rm -rf tmp dir.wim
-done
-
-# imagex mountrw
-for flag in "--compress=none" "--compress=maximum" "--compress=fast"; do
- echo "Using flag $flag"
- echo "Testing mounting WIM read-write"
- imagex capture dir dir.wim $flag
- mkdir tmp
- imagex mountrw dir.wim dir tmp
- echo "Testing unmounting WIM unmodified"
- imagex unmount tmp
- echo "Testing unmounting WIM unmodified with --commit and --check"
- imagex mountrw dir.wim dir tmp
- imagex unmount tmp --commit --check
- echo "Testing removing file from mounted WIM"
- imagex mountrw dir.wim dir tmp
- rm tmp/lz.c
- test ! -e tmp/lz.c
- echo "Testing making directory in mounted WIM"
- mkdir tmp/newdir
- test -d tmp/newdir
- echo "Testing making new empty file in mounted WIM"
- touch tmp/newdir/empty_file
- test -e tmp/newdir/empty_file
- test `stat -c %s tmp/newdir/empty_file` = 0;
- echo "Testing making new non-empty file in mounted WIM"
- dd if=/dev/zero of=tmp/newdir/zeroes1 bs=1 count=4096
- dd if=/dev/zero of=tmp/newdir/zeroes2 bs=4096 count=1
- cmp tmp/newdir/zeroes1 tmp/newdir/zeroes2
- echo "Unmounting WIM with changes committed and --check"
- imagex unmount tmp --commit --check
- test "`imagex info dir.wim | grep Integrity | awk '{print $3}'`" = "yes";
- rm -rf tmp
- imagex apply dir.wim tmp
- cmp tmp/newdir/zeroes1 tmp/newdir/zeroes2
- test `stat -c %s tmp/newdir/empty_file` = 0;
- test `stat -c %s tmp/newdir/zeroes1` = 4096;
- rm -rf tmp dir.wim
-done