mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-22 01:13:00 +02:00
56 lines
1.0 KiB
Bash
Executable File
56 lines
1.0 KiB
Bash
Executable File
#!/bin/sh
|
|
# Verify all config/*_defconfig files, skipping any subdirectories,
|
|
# e.g., developer snippets not used in official builds.
|
|
|
|
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
|
|
}
|
|
|
|
# shellcheck disable=SC2046
|
|
check $(find "$CONFIGS" -maxdepth 1 -type f | LC_ALL=C sort) || exit 1
|
|
|
|
exit 0
|