Files
mars-dosutils/test/cmnwmeta.sh
2026-06-12 10:17:31 +02:00

54 lines
1.3 KiB
Bash
Executable File

#!/bin/sh
# Collect decoded OES/NSS netware.* metadata from a host-side SYS tree.
#
# Use after running DOS-side tests such as grant/rights/flag/quota tests:
# sh dosutils/test/cmnwmeta.sh /path/to/SYS /path/to/nwfs_xattr_dump > meta.log
#
# The dumper reads the mars-nwe userspace xattr mapping, so on Linux it looks
# at user.netware.metadata, user.netware.quota and user.netware.userquota.0.
set -eu
SYSROOT=${1:-}
DUMPER=${2:-}
if [ -z "$SYSROOT" ] || [ -z "$DUMPER" ]; then
echo "usage: $0 SYSROOT nwfs_xattr_dump [path ...]" >&2
exit 2
fi
if [ ! -d "$SYSROOT" ]; then
echo "cmnwmeta: SYSROOT is not a directory: $SYSROOT" >&2
exit 2
fi
if [ ! -x "$DUMPER" ]; then
echo "cmnwmeta: nwfs_xattr_dump is not executable: $DUMPER" >&2
exit 2
fi
shift 2
if [ "$#" -gt 0 ]; then
exec "$DUMPER" "$@"
fi
# Known test roots from dosutils/test/*.BAT. Missing roots are ignored so this
# script can be run after any subset of tests.
for rel in \
CIXTEST CIXCMP \
FLGTEST FLGCMP \
FDGTEST FDGCMP \
GRNTEST GRNTCMP \
RGHTEST RGHTCMP \
RMVTEST RMVCMP \
RVKTEST RVKCMP \
NDIRTST NDIRCMP \
TFILE \
NCPTST NCPCMP \
RUTEST RUTCMP \
DQTTEST DQTCMP
do
if [ -e "$SYSROOT/$rel" ]; then
find "$SYSROOT/$rel" -xdev \( -type f -o -type d \) -print
fi
done | sort | xargs -r "$DUMPER"