Files
infix/test/case/repo/defconfig.sh
T
Joachim Wiberg c61b4361ab test: simplify and skip UNIX backup files
- Drop 'local', not available in POSIX shell scripts
 - Check for an assortment of backup file combos
 - Simplify nested if-statements, skip whitelist first

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2025-09-28 07:26:45 +02:00

53 lines
864 B
Bash
Executable File

#!/bin/sh
SCRIPT_PATH="$(dirname "$(readlink -f "$0")")"
CONFIGS="$SCRIPT_PATH/../../../configs"
whitelist()
{
case "$1" in
*_boot_defconfig)
return 0
;;
esac
return 1
}
# Check for disabled root login
disabled_root_login()
{
grep -q "# BR2_TARGET_ENABLE_ROOT_LOGIN is not set" "$1"
}
# For all defconfigs
check()
{
total=$#
num=1
base=
echo "1..$total"
for defconfig in "$@"; do
# Skip UNIX backup files
case "$defconfig" in
*~|*.bak|'#'*'#'|.#*)
continue
;;
esac
base=$(basename "$defconfig")
if whitelist "$base"; then
echo "ok $num - $base is exempted # skip"
elif disabled_root_login "$defconfig"; then
echo "ok $num - $base disables root logins"
else
echo "not ok $num - $base has not disabled root login"
fi
num=$((num + 1))
done
}
check "$CONFIGS"/* || exit 1
exit 0