-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_software.bash
More file actions
executable file
·101 lines (78 loc) · 1.76 KB
/
Copy pathcheck_software.bash
File metadata and controls
executable file
·101 lines (78 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/bin/bash
APP_NAME="$(basename "$0")"
WORK_DIR="$(dirname "$0")"
cd "${WORK_DIR}" || exit 1
function display_help() {
cat <<HELP
% ${APP_NAME}(1) user manual
% R. S. Doiel
% 2025-05-09
# NAME
${APP_NAME}
# SYNOPIS
${APP_NAME}
# DESCRIPTION
${APP_NAME} checks to see if the required software is available to run the reports.
# OPTIONS
-h, --help
: display this help page.
# EXAMPLE
~~~shell
${APP_NAME}
~~~
HELP
}
case "$1" in
-h|--help|help)
display_help
exit 0;
;;
esac
# Make sure we have the legacy apps in the bin directory included.
export PATH="./bin:$PATH"
#
# Check software needed and their versions
#
function check_version() {
OPT="$1"
VERSION="$2"
CMD="$3"
if command -v "${CMD}" >/dev/null; then
HAS_VERSION=$("${CMD}" "${OPT}" | grep "${VERSION}")
if [ "$HAS_VERSION" = "" ]; then
echo "${CMD} version check: expected ${VERSION}, got $("${CMD}" "${OPT}")"
fi
else
echo "${CMD} is missing, aborting"
exit 1
fi
}
#
# Check all of dataset and CMTools are installed
#
## dataset >= 2.5 (use the latest release)
VERSION='2.5.1'
for CMD in dataset datasetd; do
check_version "-version" "${VERSION}" "${CMD}"
done
echo "Found dataset, review any displayed version information"
echo ""
## dataset >= 2.5 (use the latest release)
VERSION='0.0.45'
for CMD in cme cmt; do
check_version "-version" "${VERSION}" "${CMD}"
done
echo "Found CMTools, review any displayed version information"
echo ""
#
# Now check the OS distribution supplied tools
#
echo "Checking for bash, sqlite3"
echo "Review any displayed version information"
echo ""
## - Bash >= 3.2 (or equivalent POSIX shell)
check_version "--version" "3.2" "bash"
## - SQlite3 >= 3.50
check_version "--version" "3.50" "sqlite3"
## - Deno >= 2.4
check_version "--version" "2.8" "deno"