Skip to content

Commit 3a1aea9

Browse files
committed
Add script to test for fetch installation
1 parent a2905e6 commit 3a1aea9

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

tools/scripts/check_fetch

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Check whether fetch is installed.
4+
#
5+
# Usage: check_fetch
6+
#
7+
8+
# VARIABLES #
9+
10+
# Find fetch:
11+
FETCH=$(command -v fetch 2>/dev/null)
12+
13+
14+
# FUNCTIONS #
15+
16+
# Prints usage information.
17+
usage() {
18+
echo '' >&2
19+
echo 'Usage: check_fetch' >&2
20+
echo '' >&2
21+
}
22+
23+
# MAIN #
24+
25+
if [[ -x "${FETCH}" ]] && "${FETCH}" --version >/dev/null; then
26+
echo 'fetch is installed.' >&2
27+
exit 0
28+
else
29+
echo 'ERROR: missing dependency. Please install fetch (http://www.freebsd.org/cgi/man.cgi?fetch%281%29). Once installed, run the command again.' >&2
30+
exit 1
31+
fi
32+
33+
# TODO: check for minimum version

0 commit comments

Comments
 (0)