1.1 --- a/tests/mk_e2test.sh Sun Aug 01 22:10:26 2021 +0200
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,72 +0,0 @@
1.4 -#!/bin/sh
1.5 -
1.6 -THIS_DIR=$(realpath $(dirname "$0"))
1.7 -
1.8 -PKGDIR=$1
1.9 -E2ACCESS_DIR=$2
1.10 -TARGET=$3
1.11 -
1.12 -if [ ! -e "$PKGDIR" ] || [ ! -e "$E2ACCESS_DIR" ] || [ ! "$TARGET" ] ; then
1.13 - echo "Usage: $0 <package directory> <e2access directory> <target>" 1>&2
1.14 - exit 1
1.15 -fi
1.16 -
1.17 -TARGET=`realpath "$TARGET"`
1.18 -
1.19 -# Initialise the program details and environment.
1.20 -
1.21 -E2ACCESS="$E2ACCESS_DIR"/e2access
1.22 -export LD_LIBRARY_PATH="$E2ACCESS_DIR"
1.23 -
1.24 -# Make a filesystem for the example.
1.25 -
1.26 -mkdir tmp_e2test
1.27 -cd tmp_e2test
1.28 -mkdir -p home/paulb/many
1.29 -cd home/paulb/many
1.30 -
1.31 -# Populate the directory with plenty of files.
1.32 -
1.33 -for N in `seq 1 400`; do
1.34 - echo "Contents of #$N." > "file-$N".txt
1.35 -done
1.36 -
1.37 -cd ..
1.38 -
1.39 -# Put a file in the directory above.
1.40 -
1.41 -cp "$PKGDIR/../docs/LICENCE.txt" .
1.42 -
1.43 -# Leave the filesystem root.
1.44 -
1.45 -cd ../..
1.46 -
1.47 -# Create a filesystem image.
1.48 -
1.49 -EXTRA=2000
1.50 -SIZE=$(du -s -k home | cut -f 1)
1.51 -TOTAL=$(($SIZE + $EXTRA))
1.52 -
1.53 -dd if=/dev/zero of="$TARGET" bs=1024 count=$TOTAL
1.54 -
1.55 -if ! $(/sbin/mkfs.ext2 -q "$TARGET") ; then
1.56 - exit 1
1.57 -fi
1.58 -
1.59 -# Add the directory and files to the image.
1.60 -
1.61 -"$E2ACCESS" "$TARGET" --make-dirs home/paulb/many
1.62 -
1.63 -"$E2ACCESS" "$TARGET" --copy-in $(find home/paulb/many -maxdepth 1 -type f | sort) home/paulb/many
1.64 -"$E2ACCESS" "$TARGET" --copy-in $(find home/paulb -maxdepth 1 -type f | sort) home/paulb
1.65 -
1.66 -# Leave the root of the filesystem.
1.67 -
1.68 -cd ..
1.69 -
1.70 -"$E2ACCESS" "$TARGET" --list-dirs ''
1.71 -"$E2ACCESS" "$TARGET" --list-dirs 'home'
1.72 -"$E2ACCESS" "$TARGET" --list-dirs 'home/paulb'
1.73 -"$E2ACCESS" "$TARGET" --list-dirs 'home/paulb/many'
1.74 -
1.75 -rm -r tmp_e2test