Skip to content

Commit 5866910

Browse files
committed
[ more ] check dependencies + debug mode
1 parent 5e9fe26 commit 5866910

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

stdlib-install.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
set -eu
44

5+
isDebugMode() {
6+
! [ -z ${DEBUG-} ]
7+
}
8+
9+
if ! [ -z ${SHELL_DEBUG-} ]; then
10+
set -x
11+
fi
12+
513
throwError() {
614
echo "\033[91m✗\033[0m $1." >&2
715
exit 1
@@ -11,6 +19,22 @@ logHappy() {
1119
echo "\033[32m✔\033[0m $1"
1220
}
1321

22+
checkDependency () {
23+
if ! [ -x "$(command -v $1)" ]; then
24+
throwError "Missing dependency: I could not find the executable '$1'"
25+
elif isDebugMode; then
26+
logHappy "Found '$1'"
27+
fi
28+
}
29+
30+
checkDependency "grep"
31+
checkDependency "head"
32+
checkDependency "mkdir"
33+
checkDependency "sed"
34+
checkDependency "tar"
35+
checkDependency "touch"
36+
checkDependency "wget"
37+
1438
# Pick the Agda executable to analyse
1539
# unless the caller has specified one
1640
if [ -z ${AGDA_EXEC-} ]; then

0 commit comments

Comments
 (0)