Skip to content

Commit a649d1a

Browse files
committed
Improved the check for shunit2 and added a check for Date::Parse
1 parent 2af687c commit a649d1a

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

utils/check_deps.sh

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,18 @@ NC='\033[0m' # No Color
88

99
FAILED=
1010

11+
check_perl_module() {
12+
13+
printf "Checking %35s:" "$1"
14+
15+
if perl -M"$1" -e1 2>/dev/null ; then
16+
printf " [${GREEN}OK${NC}: %-35s]\n" "$1"
17+
else
18+
ERROR="$1 not found"
19+
printf " [${RED}error${NC}: %-35s]\n" "${ERROR}"
20+
fi
21+
}
22+
1123
check_required() {
1224

1325
printf "Checking %35s:" "$1"
@@ -39,6 +51,24 @@ check_optional() {
3951

4052
}
4153

54+
check_shunit2() {
55+
56+
printf "Checking %35s:" shunit2
57+
58+
PROG=$(command -v shunit2 2> /dev/null)
59+
if [ -z "${PROG}" ] ; then
60+
if [ -x /usr/share/shunit2/shunit2 ] ; then
61+
PROG=/usr/share/shuni2/shunit2
62+
fi
63+
fi
64+
if [ -z "${PROG}" ]; then
65+
ERROR="shunit2 not found"
66+
printf " [${YELLOW}error${NC}: %-35s]\n" "${ERROR}"
67+
else
68+
printf " [${GREEN}OK${NC}: %-35s]\n" "${PROG}"
69+
fi
70+
}
71+
4272
printf "\nChecking required dependencies:\n\n"
4373

4474
check_required bc
@@ -69,8 +99,9 @@ printf "\nChecking optional dependencies for development:\n\n"
6999
check_optional dig
70100
check_optional shellcheck
71101
check_optional shfmt
72-
check_optional shunit2
102+
check_shunit2
73103
check_optional tinyproxy
104+
check_perl_module Date::Parse
74105

75106

76107
if [ -n "${FAILED}" ] ; then

0 commit comments

Comments
 (0)