From 37865c2c4ad26cd5e947b08abf1fde8145699919 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 23 Jan 2017 14:35:59 +0300 Subject: [PATCH 003/250] fs-tester: make sh-compatible --- tests/util/grub-fs-tester.in | 306 ++++++++++++++++++++++++------------------- 1 file changed, 169 insertions(+), 137 deletions(-) diff --git a/tests/util/grub-fs-tester.in b/tests/util/grub-fs-tester.in index 2337771a1b9..4515d165e6e 100644 --- a/tests/util/grub-fs-tester.in +++ b/tests/util/grub-fs-tester.in @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh set -e @@ -13,8 +13,29 @@ run_it () { LC_ALL=C "$GRUBFSTEST" "$@" } +range() { + range_counter="$1" + while test "$range_counter" -le "$2"; do + echo "$range_counter" + range_counter="$((range_counter + $3))" + done +} + +powrange() { + range_counter="$1" + while test "$range_counter" -le "$2"; do + echo "$range_counter" + range_counter="$((range_counter * 2))" + done +} + run_grubfstest () { - run_it -c $NEED_IMAGES_N "${NEED_IMAGES[@]}" "$@" + need_images= + for i in $(range 0 $((NEED_IMAGES_N-1)) 1); do + need_images="$need_images $FSIMAGEP${i}.img"; + done + + run_it -c $NEED_IMAGES_N $need_images "$@" } # OS LIMITATION: GNU/Linux has no AFS support, so we use a premade image and a reference tar file. I.a. no multiblocksize test @@ -51,7 +72,7 @@ case x"$fs" in # OS limitation: zfs-fuse always uses ashift=9 with loop devices MAXLOGSECSIZE=9;; esac -for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + 1)); do +for LOGSECSIZE in $(range "$MINLOGSECSIZE" "$MAXLOGSECSIZE" 1); do SECSIZE="$((1 << LOGSECSIZE))" MINBLKSIZE=512 MAXBLKSIZE=512 @@ -169,7 +190,12 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + MINBLKSIZE=1024 MAXBLKSIZE=4096;; esac - for ((BLKSIZE=MINBLKSIZE;BLKSIZE<=MAXBLKSIZE;BLKSIZE=BLKSTEP?BLKSIZE+BLKSTEP:2*BLKSIZE)); do + if test "$BLKSTEP" -eq 0; then + blksizes="$(powrange "$MINBLKSIZE" "$MAXBLKSIZE")" + else + blksizes="$(range "$MINBLKSIZE" "$MAXBLKSIZE" "$BLKSTEP")" + fi + for BLKSIZE in $blksizes; do MAXDEVICES=1 MINDEVICES=1 export fs @@ -199,13 +225,11 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + MAXDEVICES=7;; esac - for ((NDEVICES=MINDEVICES; NDEVICES <= MAXDEVICES; NDEVICES++)); do + for NDEVICES in $(range "$MINDEVICES" "$MAXDEVICES" 1); do export NDEVICES - unset FSIMAGES - for ((i=0; i < NDEVICES; i++)); do - FSIMAGES[i]="${tempdir}/${fs}_${SECSIZE}_${BLKSIZE}_${NDEVICES}_$i.img" - done - export FSIMAGES + unset FSIMAGEP + FSIMAGEP="${tempdir}/${fs}_${SECSIZE}_${BLKSIZE}_${NDEVICES}_" + export FSIMAGEP unset NEED_IMAGES; case x$fs in @@ -226,11 +250,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + *) NEED_IMAGES_N=$NDEVICES;; esac - for ((i=0;i < NEED_IMAGES_N; i++)); do - NEED_IMAGES[i]="${FSIMAGES[i]}"; - done export NEED_IMAGES_N - export NEED_IMAGES MNTPOINTRO="${tempdir}/${fs}_ro" MNTPOINTRW="${tempdir}/${fs}_rw" @@ -238,20 +258,25 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + MOUNTFS="$fs" MASTER="${tempdir}/master" FSLABEL="grub_;/testé莭莽茝😁киритi urewfceniuewruevrewnuuireurevueurnievrewfnerfcnevirivinrewvnirewnivrewiuvcrewvnuewvrrrewniuerwreiuviurewiuviurewnuvewnvrenurnunuvrevuurerejiremvreijnvcreivire nverivnreivrevnureiorfnfrvoeoiroireoireoifrefoieroifoireoifoirefoireoifoijfoirereoireoivoioirevoinvoinreoinvnoieoinreoinveoinveoinreoinvoineoinoinoineoinernoiveoinvreoiioewdioewoirvnoireoivfoirewfewoifoijewoijfoijewfoijfewoijoijoijoijoijoijoijfewceniuewruevrewnuuireurevueurnievrewfnerfcnevirivinrewvnirewnivrewiuvcrewvnuewvrrrewniuerwreiuviurewiuviurewnuvewnvrenurnunuvrevuurerejiremvreijnvcreivire nverivnreivrevnureiorfnfrvoeoiroireoireoifrefoieroifoireoifoirefoireoifoijfoirereoireoivoioirevoinvoinreoinvnoieoinreoinveoinveoinreoinvoineoinoinoineoinernoiveoinvreoiioewdioewoirvnoireoivfoirewfewoifoijewoijfoijewfoijfewoijoijoijoijoijoijoijfewrewfceniuewruevrewnuuireurevueurnievrewfnerfcnevirivinrewvnirewnivrewiuvcrewvnuewvrrrewniuerwreiuviurewiuviurewnuvewnvrenurnunuvrevuurerejiremvreijnvcreivire nverivnreivrevnureiorfnfrvoeoiroireoireoifrefoieroifoireoifoirefoireoifoijfoirereoireoivoioirevoinvoinreoinvnoieoinreoinveoinveoinreoinvoineoinoinoineoinernoiveoinvreoiioewdioewoirvnoireoivfoirewfewoifoijewoijfoijewfoijfewoijoijoijoijoijoijoijfewceniuewruevrewnuuireurevueurnievrewfnerfcnevirivinrewvnirewnivrewiuvcrewvnuewvrrrewniuerwreiuviurewiuviurewnuvewnvrenurnunuvrevuurerejiremvreijnvcreivire nverivnreivrevnureiorfnfrvoeoiroireoireoifrefoieroifoireoifoirefoireoifoijfoirereoireoivoioirevoinvoinreoinvnoieoinreoinveoinveoinreoinvoineoinoinoineoinernoiveoinvreoiioewdioewoirvnoireoivfoirewfewoifoijewoijfoijewfoijfewoijoijoijoijoijoijoijfew" - CFILESN=1 - if test -f /usr/share/dict/american-english; then - CFILESSRC[0]="/usr/share/dict/american-english" - else - CFILESSRC[0]="/usr/share/dict/linux.words" + CFILESRC= + for cand in /usr/share/dict/american-english /usr/share/dict/linux.words; do + if test -f "$cand" ; then + CFILESRC="$cand" + break + fi + done + if test "$CFILESRC" = "" ; then + echo "Couldn't find compressible file" >&2 + exit 1 fi case x"$fs" in # FS LIMITATION: 8.3 names xmsdos*) - CFILES[0]="american.eng";; + CFILE="american.eng";; xiso9660) - CFILES[0]="american_english";; + CFILE="american_english";; *) - CFILES[0]="american-english";; + CFILE="american-english";; esac # OS LIMITATION: Limited by NAME_MAX (usually 255) in GNU/Linux LONGNAME="qwertzuiopasdfghjklyxcvbnm1234567890qwertzuiopasdfghjklyxcvbnm1234567890oiewqfiewioqoiqoiurqruewqoiuwoieoiiuewqroreqiufieiuwrnureweriuvceoiroiewqoiricdsalkcndsakfirefoiwqeoircorejwoijfreoijojoiewjfwnfcoirenfoirefnreoifenoiwfnoi" @@ -388,8 +413,8 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + ;; x"vfat16" | xmsdos16) BIGBLOCKCNT=$((25000 * BLKSIZE)) - if [ $BIGBLOCKCNT -gt $((16#ffffffff)) ]; then - BIGBLOCKCNT=$((16#ffffffff)) + if [ $BIGBLOCKCNT -gt 4294967295 ]; then + BIGBLOCKCNT=4294967295 fi ;; x"minix") @@ -410,7 +435,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + BIGBLOCKCNT=$((4000 * 1048576));; # FS LIMITATION: These FS have uint32 as file size field x"vfat"* | xmsdos* | x"cpio_crc" | x"cpio_newc" | x"cpio_bin" | x"cpio_hpbin" | xsfs*) - BIGBLOCKCNT=$((16#ffffffff));; + BIGBLOCKCNT=4294967295;; # FS LIMITATION: These FS have int32 as file size field # FIXME: not so sure about AFFS # OS LIMITATION: minix2/minix3 could be formatted in a way to permit more. @@ -543,18 +568,18 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + PDIR="" # OS LIMITATION: Limited by PATH_MAX (usually 1024) - for ((i=0;i /dev/null - LODEVICES[i]=`losetup -f` - losetup "${LODEVICES[i]}" "${FSIMAGES[i]}" + for i in $(range 0 $((NDEVICES-1)) 1); do + dd if=/dev/zero of="$FSIMAGEP${i}.img" count=1 bs=1 seek=$((DISKSIZE-1)) &> /dev/null + LODEVICE="$(losetup -f)" + LODEVICES="$LODEVICES $LODEVICE" + losetup "$LODEVICE" "$FSIMAGEP${i}.img" + if test "$i" = 0; then + MOUNTDEVICE="$LODEVICE" + fi done ;; esac - MOUNTDEVICE="${LODEVICES[0]}" case x"$fs" in x"afs") ;; x"btrfs") - "mkfs.btrfs" -s $SECSIZE -L "$FSLABEL" "${LODEVICES[0]}" ;; + "mkfs.btrfs" -s $SECSIZE -L "$FSLABEL" "${MOUNTDEVICE}" ;; x"btrfs_zlib" | x"btrfs_lzo") - "mkfs.btrfs" -s $SECSIZE -L "$FSLABEL" "${LODEVICES[0]}" + "mkfs.btrfs" -s $SECSIZE -L "$FSLABEL" "${MOUNTDEVICE}" MOUNTOPTS="compress=${fs/btrfs_/}," MOUNTFS="btrfs" ;; x"btrfs_raid0") - "mkfs.btrfs" -s $SECSIZE -d raid0 -m raid0 -L "$FSLABEL" "${LODEVICES[@]}" + "mkfs.btrfs" -s $SECSIZE -d raid0 -m raid0 -L "$FSLABEL" $LODEVICES MOUNTFS="btrfs" ;; x"btrfs_raid1") - "mkfs.btrfs" -s $SECSIZE -d raid1 -m raid1 -L "$FSLABEL" "${LODEVICES[@]}" + "mkfs.btrfs" -s $SECSIZE -d raid1 -m raid1 -L "$FSLABEL" $LODEVICES MOUNTFS="btrfs" ;; x"btrfs_raid10") - "mkfs.btrfs" -s $SECSIZE -d raid10 -m raid10 -L "$FSLABEL" "${LODEVICES[@]}" + "mkfs.btrfs" -s $SECSIZE -d raid10 -m raid10 -L "$FSLABEL" $LODEVICES MOUNTFS="btrfs" ;; x"btrfs_single") - "mkfs.btrfs" -s $SECSIZE -d single -L "$FSLABEL" "${LODEVICES[@]}" + "mkfs.btrfs" -s $SECSIZE -d single -L "$FSLABEL" $LODEVICES MOUNTFS="btrfs" ;; x"exfat") - "mkfs.$fs" -s $((BLKSIZE/512)) -n "$FSLABEL" "${LODEVICES[0]}" + "mkfs.$fs" -s $((BLKSIZE/512)) -n "$FSLABEL" "${MOUNTDEVICE}" MOUNTOPTS="iocharset=utf8," MOUNTFS="exfat-fuse";; x"minix") - "mkfs.minix" "${LODEVICES[0]}" + "mkfs.minix" "${MOUNTDEVICE}" ;; # mkfs.hfs and mkfs.hfsplus don't fill UUID. x"hfsplus") - "mkfs.hfsplus" -b $BLKSIZE -v "$FSLABEL" "${LODEVICES[0]}" - dd if=/dev/urandom of="${LODEVICES[0]}" bs=1 seek=$((16#468)) conv=notrunc count=8 ;; + "mkfs.hfsplus" -b $BLKSIZE -v "$FSLABEL" "${MOUNTDEVICE}" + dd if=/dev/urandom of="${MOUNTDEVICE}" bs=1 seek=$((16#468)) conv=notrunc count=8 ;; x"hfsplus_wrap") - "mkfs.hfsplus" -w -b $BLKSIZE -v "$FSLABEL" "${LODEVICES[0]}" - dd if=/dev/urandom of="${LODEVICES[0]}" bs=1 seek=$((16#468)) conv=notrunc count=8 + "mkfs.hfsplus" -w -b $BLKSIZE -v "$FSLABEL" "${MOUNTDEVICE}" + dd if=/dev/urandom of="${MOUNTDEVICE}" bs=1 seek=$((16#468)) conv=notrunc count=8 MOUNTFS="hfsplus";; x"hfsplus_casesens") - "mkfs.hfsplus" -s -b $BLKSIZE -v "$FSLABEL" "${LODEVICES[0]}" - dd if=/dev/urandom of="${LODEVICES[0]}" bs=1 seek=$((16#468)) conv=notrunc count=8 + "mkfs.hfsplus" -s -b $BLKSIZE -v "$FSLABEL" "${MOUNTDEVICE}" + dd if=/dev/urandom of="${MOUNTDEVICE}" bs=1 seek=$((16#468)) conv=notrunc count=8 MOUNTFS="hfsplus";; x"hfs") - "mkfs.hfs" -b $BLKSIZE -v "`echo $FSLABEL |recode utf8..macroman`" -h "${LODEVICES[0]}" - dd if=/dev/urandom of="${LODEVICES[0]}" bs=1 seek=$((16#474)) conv=notrunc count=8 + "mkfs.hfs" -b $BLKSIZE -v "`echo $FSLABEL |recode utf8..macroman`" -h "${MOUNTDEVICE}" + dd if=/dev/urandom of="${MOUNTDEVICE}" bs=1 seek=$((16#474)) conv=notrunc count=8 MOUNTOPTS="iocharset=utf8,codepage=macroman," ;; x"vfat"*|xmsdos*) @@ -643,98 +673,98 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + else A= fi - "mkfs.vfat" -a $A -S $SECSIZE -s $((BLKSIZE/SECSIZE)) -F "${BITS:0:2}" -n "$FSLABEL" "${FSIMAGES[0]}" + "mkfs.vfat" -a $A -S $SECSIZE -s $((BLKSIZE/SECSIZE)) -F "${BITS:0:2}" -n "$FSLABEL" "${MOUNTDEVICE}" MOUNTOPTS="iocharset=utf8,codepage=437," MOUNTFS="$(echo "$fs"|sed 's,[0-9]*a\?$,,')";; x"minix2") - "mkfs.minix" -v "${LODEVICES[0]}" + "mkfs.minix" -v "${MOUNTDEVICE}" MOUNTFS="minix";; x"minix3") - "mkfs.minix" -B $BLKSIZE -3 "${LODEVICES[0]}" + "mkfs.minix" -B $BLKSIZE -3 "${MOUNTDEVICE}" MOUNTFS="minix";; x"ntfs"*) - "mkfs.ntfs" -s "$SECSIZE" -c "$BLKSIZE" -L "$FSLABEL" -Q -q "${LODEVICES[0]}" + "mkfs.ntfs" -s "$SECSIZE" -c "$BLKSIZE" -L "$FSLABEL" -Q -q "${MOUNTDEVICE}" MOUNTOPTS="iocharset=utf8,compression," MOUNTFS="ntfs-3g";; x"udf") - "mkudffs" --utf8 -b $BLKSIZE --lvid="$FSLABEL" "${LODEVICES[0]}" + "mkudffs" --utf8 -b $BLKSIZE --lvid="$FSLABEL" "${MOUNTDEVICE}" MOUNTOPTS="iocharset=utf8,bs=$BLKSIZE,";; x"ufs2") - "mkfs.ufs" -b $BLKSIZE -L "$FSLABEL" -O 2 "${LODEVICES[0]}" + "mkfs.ufs" -b $BLKSIZE -L "$FSLABEL" -O 2 "${MOUNTDEVICE}" MOUNTOPTS="ufstype=ufs2," MOUNTFS="ufs";; x"ufs1") - "mkfs.ufs" -b $BLKSIZE -L "$FSLABEL" -O 1 "${LODEVICES[0]}" + "mkfs.ufs" -b $BLKSIZE -L "$FSLABEL" -O 1 "${MOUNTDEVICE}" MOUNTOPTS="ufstype=44bsd," MOUNTFS="ufs";; x"ufs1_sun") - "mkfs.ufs" -b $BLKSIZE -L "$FSLABEL" -O 1 "${LODEVICES[0]}" + "mkfs.ufs" -b $BLKSIZE -L "$FSLABEL" -O 1 "${MOUNTDEVICE}" MOUNTOPTS="ufstype=sun," MOUNTFS="ufs";; x"zfs") - "zpool" create -R "$MNTPOINTRW" "$FSLABEL" "${LODEVICES[0]}" + "zpool" create -R "$MNTPOINTRW" "$FSLABEL" "${MOUNTDEVICE}" sleep 1 "zfs" create "$FSLABEL"/"grub fs" sleep 1;; x"zfs_caseins") - "zpool" create -R "$MNTPOINTRW" "$FSLABEL" "${LODEVICES[0]}" + "zpool" create -R "$MNTPOINTRW" "$FSLABEL" "${MOUNTDEVICE}" sleep 1 "zfs" create -o casesensitivity=insensitive "$FSLABEL"/"grub fs" sleep 1;; x"zfs_lzjb" | xzfs_gzip | xzfs_zle) - "zpool" create -O compression=${fs/zfs_/} -R "$MNTPOINTRW" "$FSLABEL" "${LODEVICES[0]}" + "zpool" create -O compression=${fs/zfs_/} -R "$MNTPOINTRW" "$FSLABEL" "${MOUNTDEVICE}" sleep 1 "zfs" create -o compression=${fs/zfs_/} "$FSLABEL"/"grub fs" sleep 1;; x"zfs_raidz") - "zpool" create -R "$MNTPOINTRW" "$FSLABEL" raidz1 "${LODEVICES[@]}" + "zpool" create -R "$MNTPOINTRW" "$FSLABEL" raidz1 $LODEVICES sleep 1 "zfs" create "$FSLABEL"/"grub fs" sleep 1;; x"zfs_raidz2") - "zpool" create -R "$MNTPOINTRW" "$FSLABEL" raidz2 "${LODEVICES[@]}" + "zpool" create -R "$MNTPOINTRW" "$FSLABEL" raidz2 $LODEVICES sleep 1 "zfs" create "$FSLABEL"/"grub fs" sleep 1;; x"zfs_raidz3") - "zpool" create -R "$MNTPOINTRW" "$FSLABEL" raidz3 "${LODEVICES[@]}" + "zpool" create -R "$MNTPOINTRW" "$FSLABEL" raidz3 $LODEVICES sleep 1 "zfs" create "$FSLABEL"/"grub fs" sleep 1;; x"zfs_mirror") - "zpool" create -R "$MNTPOINTRW" "$FSLABEL" mirror "${LODEVICES[@]}" + "zpool" create -R "$MNTPOINTRW" "$FSLABEL" mirror $LODEVICES sleep 1 "zfs" create "$FSLABEL"/"grub fs" sleep 1;; x"zfs_stripe") - "zpool" create -R "$MNTPOINTRW" "$FSLABEL" "${LODEVICES[@]}" + "zpool" create -R "$MNTPOINTRW" "$FSLABEL" $LODEVICES sleep 1 "zfs" create "$FSLABEL"/"grub fs" sleep 1;; x"tarfs" | x"cpio_"* | x"iso9660" | xjoliet | xrockridge | xrockridge_joliet | x"iso9660_1999" | xjoliet_1999 | xrockridge_1999 | xrockridge_joliet_1999 | x"ziso9660" | x"romfs" | x"squash4_"*) INSTDEVICE=/dev/null;; x"reiserfs") - "mkfs.reiserfs" --format=3.6 -b $BLKSIZE -l "$FSLABEL" -q "${LODEVICES[0]}" ;; + "mkfs.reiserfs" --format=3.6 -b $BLKSIZE -l "$FSLABEL" -q "${MOUNTDEVICE}" ;; x"reiserfs_old") - "mkfs.reiserfs" --format=3.5 -b $BLKSIZE -l "$FSLABEL" -q "${LODEVICES[0]}" + "mkfs.reiserfs" --format=3.5 -b $BLKSIZE -l "$FSLABEL" -q "${MOUNTDEVICE}" MOUNTFS=reiserfs;; x"jfs") - "mkfs.jfs" -L "$FSLABEL" -q "${LODEVICES[0]}" + "mkfs.jfs" -L "$FSLABEL" -q "${MOUNTDEVICE}" MOUNTOPTS="iocharset=utf8,";; x"jfs_caseins") - "mkfs.jfs" -O -L "$FSLABEL" -q "${LODEVICES[0]}" + "mkfs.jfs" -O -L "$FSLABEL" -q "${MOUNTDEVICE}" MOUNTFS=jfs MOUNTOPTS="iocharset=utf8,";; x"mdraid"*) - mdadm -C --chunk=$((BLKSIZE/1024)) --force -e "${fs:6:1}.${fs:7:1}" "/dev/md/${fs}_${NDEVICES}" --level="${fs:13}" --raid-devices="$NDEVICES" "${LODEVICES[@]}" + mdadm -C --chunk=$((BLKSIZE/1024)) --force -e "${fs:6:1}.${fs:7:1}" "/dev/md/${fs}_${NDEVICES}" --level="${fs:13}" --raid-devices="$NDEVICES" $LODEVICES MOUNTDEVICE="/dev/md/${fs}_${NDEVICES}" MOUNTFS=ext2 "mkfs.ext2" -L "$FSLABEL" -q "${MOUNTDEVICE}" ;; x"lvm"*) - for ((i=0;i /dev/null; + cp "${CFILESRC}" "$MNTPOINTRW/$OSDIR/${CFILE}" &> /dev/null; else - for ((i=0;i<$CFILESN;i++)); do - cp "${CFILESSRC[i]}" "$MNTPOINTRW/$OSDIR/${CFILES[i]}"; - done + + cp "${CFILESRC}" "$MNTPOINTRW/$OSDIR/${CFILE}"; + fi if [ x$NOSYMLINK != xy ]; then @@ -968,48 +1000,48 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + sleep 2 ;; x"tarfs") - (cd "$MASTER"; tar cf "${FSIMAGES[0]}" .) ;; + (cd "$MASTER"; tar cf "${FSIMAGEP}0.img" .) ;; x"cpio_"*) - (cd "$MASTER"; find . | cpio -o -H "${fs/cpio_/}" > "${FSIMAGES[0]}" ) ;; + (cd "$MASTER"; find . | cpio -o -H "$(echo ${fs} | sed 's@^cpio_@@')" > "${FSIMAGEP}0.img" ) ;; x"ziso9660") FSUUID=$(date -u +%Y-%m-%d-%H-%M-%S-00); - xorriso -compliance rec_mtime -set_filter_r --zisofs -- -zisofs default -as mkisofs -iso-level 3 -graft-points -R -J -joliet-long -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGES[0]}" -- -set_filter_r --zisofs -- -zisofs default -add /="$MASTER" ;; + xorriso -compliance rec_mtime -set_filter_r --zisofs -- -zisofs default -as mkisofs -iso-level 3 -graft-points -R -J -joliet-long -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGEP}0.img" -- -set_filter_r --zisofs -- -zisofs default -add /="$MASTER" ;; x"iso9660") FSUUID=$(date -u +%Y-%m-%d-%H-%M-%S-00); - xorriso --rockridge off -compliance rec_mtime -as mkisofs -iso-level 3 -graft-points -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGES[0]}" /="$MASTER" ;; + xorriso --rockridge off -compliance rec_mtime -as mkisofs -iso-level 3 -graft-points -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGEP}0.img" /="$MASTER" ;; x"joliet") FSUUID=$(date -u +%Y-%m-%d-%H-%M-%S-00); - xorriso --rockridge off -compliance rec_mtime -as mkisofs -iso-level 3 -graft-points -J -joliet-long -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGES[0]}" /="$MASTER" ;; + xorriso --rockridge off -compliance rec_mtime -as mkisofs -iso-level 3 -graft-points -J -joliet-long -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGEP}0.img" /="$MASTER" ;; x"rockridge") FSUUID=$(date -u +%Y-%m-%d-%H-%M-%S-00); - xorriso --rockridge on -compliance rec_mtime -as mkisofs -iso-level 3 -graft-points -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGES[0]}" /="$MASTER" ;; + xorriso --rockridge on -compliance rec_mtime -as mkisofs -iso-level 3 -graft-points -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGEP}0.img" /="$MASTER" ;; x"rockridge_joliet") FSUUID=$(date -u +%Y-%m-%d-%H-%M-%S-00); - xorriso --rockridge on -compliance rec_mtime -as mkisofs -iso-level 3 -graft-points -J -joliet-long -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGES[0]}" /="$MASTER" ;; + xorriso --rockridge on -compliance rec_mtime -as mkisofs -iso-level 3 -graft-points -J -joliet-long -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGEP}0.img" /="$MASTER" ;; x"iso9660_1999") FSUUID=$(date -u +%Y-%m-%d-%H-%M-%S-00); - xorriso --rockridge off -compliance rec_mtime -as mkisofs -iso-level 4 -graft-points -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGES[0]}" /="$MASTER" ;; + xorriso --rockridge off -compliance rec_mtime -as mkisofs -iso-level 4 -graft-points -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGEP}0.img" /="$MASTER" ;; x"joliet_1999") FSUUID=$(date -u +%Y-%m-%d-%H-%M-%S-00); - xorriso --rockridge off -compliance rec_mtime -as mkisofs -iso-level 4 -graft-points -J -joliet-long -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGES[0]}" /="$MASTER" ;; + xorriso --rockridge off -compliance rec_mtime -as mkisofs -iso-level 4 -graft-points -J -joliet-long -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGEP}0.img" /="$MASTER" ;; x"rockridge_1999") FSUUID=$(date -u +%Y-%m-%d-%H-%M-%S-00); - xorriso --rockridge on -compliance rec_mtime -as mkisofs -iso-level 4 -graft-points -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGES[0]}" /="$MASTER" ;; + xorriso --rockridge on -compliance rec_mtime -as mkisofs -iso-level 4 -graft-points -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGEP}0.img" /="$MASTER" ;; x"rockridge_joliet_1999") FSUUID=$(date -u +%Y-%m-%d-%H-%M-%S-00); - xorriso --rockridge on -compliance rec_mtime -as mkisofs -iso-level 4 -graft-points -J -joliet-long -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGES[0]}" /="$MASTER" ;; + xorriso --rockridge on -compliance rec_mtime -as mkisofs -iso-level 4 -graft-points -J -joliet-long -V "$FSLABEL" --modification-date=$(echo ${FSUUID} | sed 's/-//g;') -o "${FSIMAGEP}0.img" /="$MASTER" ;; x"romfs") - genromfs -V "$FSLABEL" -f "${FSIMAGES[0]}" -d "$MASTER" ;; + genromfs -V "$FSLABEL" -f "${FSIMAGEP}0.img" -d "$MASTER" ;; xsquash4_*) - echo mksquashfs "$MASTER" "${FSIMAGES[0]}" -always-use-fragments -comp "${fs/squash4_/}" -b $BLKSIZE - mksquashfs "$MASTER" "${FSIMAGES[0]}" -always-use-fragments -comp "${fs/squash4_/}" -b $BLKSIZE ;; + echo mksquashfs "$MASTER" "${FSIMAGEP}0.img" -always-use-fragments -comp "${fs/squash4_/}" -b $BLKSIZE + mksquashfs "$MASTER" "${FSIMAGEP}0.img" -always-use-fragments -comp "${fs/squash4_/}" -b $BLKSIZE ;; x"bfs") sleep 1 fusermount -u "$MNTPOINTRW" ;; xlvm*) sleep 1 - for ((try=0;try < 20; try++)); do + for try in $(range 0 20 1); do if umount "$MNTPOINTRW" ; then break; fi @@ -1021,7 +1053,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + ;; xmdraid*) sleep 1 - for ((try=0;try < 20; try++)); do + for try in $(range 0 20 1); do if umount "$MNTPOINTRW" ; then break; fi @@ -1033,7 +1065,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + ;; *) sleep 1 - for ((try=0;try < 20; try++)); do + for try in $(range 0 20 1); do if umount "$MNTPOINTRW" ; then break; fi @@ -1066,7 +1098,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + sleep 1 mount -t "$MOUNTFS" "${MOUNTDEVICE}" "$MNTPOINTRO" -o ${MOUNTOPTS}${SELINUXOPTS}ro ;; xmdraid*) - mdadm --assemble /dev/md/"${fs}_$NDEVICES" "${LODEVICES[@]}" + mdadm --assemble /dev/md/"${fs}_$NDEVICES" $LODEVICES sleep 1 mount -t "$MOUNTFS" "${MOUNTDEVICE}" "$MNTPOINTRO" -o ${MOUNTOPTS}${SELINUXOPTS}ro ;; *) @@ -1085,7 +1117,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + else echo LIST FAIL echo "$LSROUT" - TZ=UTC ls --time-style=+%Y%m%d%H%M%S.%N -l "$MNTPOINTRO" + TZ=UTC ls -l "$MNTPOINTRO" exit 1 fi @@ -1094,7 +1126,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + else echo NLIST FAIL echo "$LSROUT" - TZ=UTC ls --time-style=+%Y%m%d%H%M%S.%N -lA "$MNTPOINTRO" + TZ=UTC ls -lA "$MNTPOINTRO" exit 1 fi @@ -1103,7 +1135,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + else echo ILIST FAIL echo "$LSROUT" - TZ=UTC ls --time-style=+%Y%m%d%H%M%S.%N -l "$MNTPOINTRO" + TZ=UTC ls -l "$MNTPOINTRO" exit 1 fi @@ -1112,7 +1144,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + else echo LONG LIST FAIL echo "$LSROUT" - TZ=UTC ls --time-style=+%Y%m%d%H%M%S.%N -l "$MNTPOINTRO" + TZ=UTC ls -l "$MNTPOINTRO" exit 1 fi @@ -1123,7 +1155,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + else echo TIME FAIL echo "$LSROUT" - TZ=UTC ls --time-style=+%Y%m%d%H%M%S.%N -l "$MNTPOINTRO" + TZ=UTC ls -l "$MNTPOINTRO" exit 1 fi @@ -1133,7 +1165,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + else echo LONG TIME FAIL echo "$LSROUT" - TZ=UTC ls --time-style=+%Y%m%d%H%M%S.%N -l "$MNTPOINTRO" + TZ=UTC ls -l "$MNTPOINTRO" exit 1 fi fi @@ -1149,7 +1181,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + else echo DOT IN ROOTDIR FAIL echo "$LSROUT" - TZ=UTC ls --time-style=+%Y%m%d%H%M%S.%N -l "$MNTPOINTRO" + TZ=UTC ls -l "$MNTPOINTRO" exit 1 fi @@ -1163,7 +1195,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + else echo DOTDOT IN ROOTDIR FAIL echo "$LSROUT" - TZ=UTC ls --time-style=+%Y%m%d%H%M%S.%N -l "$MNTPOINTRO" + TZ=UTC ls -l "$MNTPOINTRO" exit 1 fi ;; @@ -1180,7 +1212,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + else echo SLIST FAIL echo "$LSROUT" - TZ=UTC ls --time-style=+%Y%m%d%H%M%S.%N -l "$MNTPOINTRO/sdir" + TZ=UTC ls -l "$MNTPOINTRO/sdir" exit 1 fi @@ -1195,7 +1227,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + else echo PLIST FAIL echo "$LSROUT" - TZ=UTC ls --time-style=+%Y%m%d%H%M%S.%N -l "$MNTPOINTRO/$PDIR" + TZ=UTC ls -l "$MNTPOINTRO/$PDIR" exit 1 fi @@ -1210,7 +1242,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + else echo DOT IN SUBDIR FAIL echo "$LSROUT" - TZ=UTC ls --time-style=+%Y%m%d%H%M%S.%N -l "$MNTPOINTRO/$OSDIR/sdir" + TZ=UTC ls -l "$MNTPOINTRO/$OSDIR/sdir" exit 1 fi @@ -1225,7 +1257,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + else echo DOTDOT IN SUBDIR FAIL echo "$LSROUT" - TZ=UTC ls --time-style=+%Y%m%d%H%M%S.%N -l "$MNTPOINTRO/$OSDIR/ssdir" + TZ=UTC ls -l "$MNTPOINTRO/$OSDIR/ssdir" exit 1 fi @@ -1245,8 +1277,8 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + case x"$fs" in x"iso9660" | x"ziso9660" | xrockridge | xjoliet | xrockridge_joliet | x"iso9660_1999" | xrockridge_1999 | xjoliet_1999 | xrockridge_joliet_1999) ;; x"zfs"*) - for ((i=0;i