forked from gugod/App-perlbrew
-
Notifications
You must be signed in to change notification settings - Fork 0
/
perlbrew-install
executable file
·48 lines (37 loc) · 1.02 KB
/
perlbrew-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
#!/bin/sh
PERLBREWURL=https://raw.github.com/gugod/App-perlbrew/master/perlbrew
if [ -z "$TMPDIR" ]; then
if [ -d "/tmp" ]; then
TMPDIR="/tmp"
else
TMPDIR="."
fi
fi
cd $TMPDIR || exit 1
LOCALINSTALLER="perlbrew-$$"
echo
if type curl >/dev/null 2>&1; then
PERLBREWDOWNLOAD="curl -k -f -sS -Lo $LOCALINSTALLER $PERLBREWURL"
elif type fetch >/dev/null 2>&1; then
PERLBREWDOWNLOAD="fetch -o $LOCALINSTALLER $PERLBREWURL"
elif type wget >/dev/null 2>&1; then
PERLBREWDOWNLOAD="wget --no-check-certificate -nv -O $LOCALINSTALLER $PERLBREWURL"
else
echo "Need wget or curl to use $0"
exit 1
fi
clean_exit () {
[ -f $LOCALINSTALLER ] && rm $LOCALINSTALLER
exit $1
}
echo "## Download the latest perlbrew"
$PERLBREWDOWNLOAD || clean_exit 1
echo
echo "## Installing perlbrew"
chmod +x $LOCALINSTALLER
/usr/bin/perl $LOCALINSTALLER self-install || clean_exit 1
echo "## Installing patchperl"
/usr/bin/perl $LOCALINSTALLER -f -q install-patchperl || clean_exit 1
echo
echo "## Done."
rm ./$LOCALINSTALLER