-
Notifications
You must be signed in to change notification settings - Fork 12
/
ocamlbrew-install
executable file
·49 lines (37 loc) · 970 Bytes
/
ocamlbrew-install
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
#!/bin/sh
# Derived from perlbrew-install
OCAMLBREWURL=https://raw.github.com/hcarty/ocamlbrew/master/ocamlbrew
: ${OCAMLBREW_BASE=$HOME/ocamlbrew}
# Default command line flags
: ${OCAMLBREW_FLAGS="-a"}
if [ -z "$TMPDIR" ]; then
if [ -d "/tmp" ]; then
TMPDIR="/tmp"
else
TMPDIR="."
fi
fi
cd $TMPDIR || exit 1
LOCALINSTALLER="ocamlbrew-$$"
echo
if type curl >/dev/null 2>&1; then
OCAMLBREWDOWNLOAD="curl -k -f -sS -Lo $LOCALINSTALLER $OCAMLBREWURL"
elif type wget >/dev/null 2>&1; then
OCAMLBREWDOWNLOAD="wget --no-check-certificate -nv -O $LOCALINSTALLER $OCAMLBREWURL"
else
echo "Need wget or curl to use $0"
exit 1
fi
clean_exit () {
[ -f $LOCALINSTALLER ] && rm $LOCALINSTALLER
exit $1
}
echo "## Download the latest ocamlbrew"
$OCAMLBREWDOWNLOAD || clean_exit 1
echo
echo "## Starting ocamlbrew"
chmod +x $LOCALINSTALLER
./$LOCALINSTALLER $OCAMLBREW_FLAGS || clean_exit 1
echo
echo "## Done."
rm ./$LOCALINSTALLER