-
Notifications
You must be signed in to change notification settings - Fork 0
/
checkenv.sh
65 lines (57 loc) · 1.99 KB
/
checkenv.sh
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
#!/bin/bash
# DO NOT EDIT THIS FILE
environment=good
OPAM_LOCATION="$(command -v opam)"
if [[ "$OPAM_LOCATION" == "" ]]; then
echo "OPAM is NOT available. This is bad."
environment=bad
else
echo "OPAM is available. Good."
fi
OCAMLC_VERSION="$(ocamlc --version 2>&1)"
if [[ "$OCAMLC_VERSION" == "4.06.0" ]]; then
echo "OCaml compiler version 4.06.0 is active. Good."
else
echo "OCaml compiler version 4.06.0 is NOT active. This is bad."
environment=bad
fi
OUNIT_VERSION="$(opam info ounit -f installed-version 2>&1)"
if [[ "$OUNIT_VERSION" =~ "2.0.7" && "$OUNIT_VERSION" =~ "4.06.0" ]]; then
echo "OUnit version 2.0.7 is active. Good."
else
echo "OUnit version 2.0.7 is NOT active. This is bad."
environment=bad
fi
YOJSON_VERSION="$(opam info yojson -f installed-version 2>&1)"
if [[ "$YOJSON_VERSION" =~ "1.4.0" && "$YOJSON_VERSION" =~ "4.06.0" ]]; then
echo "Yojson version 1.4.0 is active. Good."
else
echo "Yojson version 1.4.0 is NOT active. This is bad."
environment=bad
fi
ANSITERMINAL_VERSION="$(opam info ansiterminal -f installed-version 2>&1)"
if [[ "$ANSITERMINAL_VERSION" =~ "0.8" && "$ANSITERMINAL_VERSION" =~ "4.06.0" ]]; then
echo "ANSITerminal version 0.8 is active. Good."
else
echo "ANSITerminal version 0.8 is NOT active. This is bad."
environment=bad
fi
if [[ "$environment" == good ]]; then
cat <<EOF
===========================================================
Your OCaml environment looks good to me. Congratulations!
===========================================================
EOF
else
cat <<EOF
===========================================================
WARNING
Your OCaml environment looks broken to me. The code that
you submit might not compile on the grader's machine,
leading to heavy penalties. Please fix your OCaml
environment. Check the error messages above carefully to
determine what is wrong with your environment. See a
consultant for help if you cannot determine what is wrong.
===========================================================
EOF
fi