#!/bin/sh # Build the synthetic test tree used by schfs_roundtrip.sh into $1. # Kept separate so the tree can be recreated for debugging without running # the whole round-trip. set -e TREE=${1:?usage: mktree.sh } rm -rf "$TREE" mkdir -p "$TREE/bin" "$TREE/etc/conf.d" "$TREE/empty-dir" "$TREE/a/b/c/d/e/f/g" : > "$TREE/etc/empty-file" echo "hello schfs" > "$TREE/etc/motd" printf 'x' > "$TREE/etc/one-byte" dd if=/dev/zero bs=4096 count=1 2>/dev/null | tr '\0' 'A' > "$TREE/etc/exactly-4096" cp "$TREE/etc/exactly-4096" "$TREE/etc/block-plus-one" printf 'B' >> "$TREE/etc/block-plus-one" dd if=/dev/zero bs=1000 count=37 2>/dev/null | tr '\0' 'C' > "$TREE/bin/multiblock" cp "$TREE/bin/multiblock" "$TREE/bin/multiblock-twin" dd if=/dev/zero bs=1000 count=37 2>/dev/null | tr '\0' 'D' > "$TREE/bin/decoy" ln -s ../etc/motd "$TREE/bin/motd-link" ln -s /nowhere "$TREE/bin/dangling-link" echo deep > "$TREE/a/b/c/d/e/f/g/deep.txt" echo one > "$TREE/etc/conf.d/one" echo spaced > "$TREE/etc/a file with spaces" echo dotted > "$TREE/etc/.hidden" LONG=$(printf 'n%.0s' $(seq 1 255)) echo long > "$TREE/etc/$LONG" mkdir -p "$TREE/many" i=0 while [ $i -lt 300 ]; do echo "file $i" > "$TREE/many/f$i" i=$((i + 1)) done