mirror of
https://github.com/mgree/ffs.git
synced 2024-08-16 23:00:48 +03:00
Mountpoints are typically inferred/generated from filenames with a -m/--mount flag for when reading from STDIN or to manually specify a mountpoint.
28 lines
497 B
Bash
Executable File
28 lines
497 B
Bash
Executable File
#!/bin/sh
|
|
|
|
fail() {
|
|
echo FAILED: $1
|
|
if [ "$MNT" ]
|
|
then
|
|
umount "$MNT"
|
|
rmdir "$MNT"
|
|
rm "$MSG" "$OUT"
|
|
fi
|
|
exit 1
|
|
}
|
|
|
|
MNT=$(mktemp -d)
|
|
OUT=$(mktemp)
|
|
MSG=$(mktemp)
|
|
|
|
echo \"just a string\" | ffs -m "$MNT" >"$OUT" 2>"$MSG" &
|
|
PID=$!
|
|
sleep 1
|
|
kill -0 $PID >/dev/null 2>&1 && fail process
|
|
cat "$MSG" | grep -i -e "must be a directory" >/dev/null 2>&1 || fail error
|
|
[ -f "$OUT" ] && ! [ -s "$OUT" ] || fail output
|
|
sleep 1
|
|
|
|
rmdir "$MNT" || fail mount
|
|
rm "$MSG" "$OUT"
|