This repository has been archived by the owner on Sep 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
2_install_rvm.sh
82 lines (65 loc) · 1.44 KB
/
2_install_rvm.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#! /bin/bash
SCRIPT=`basename $0`
ERROR=1
SUCCESS=0
SEPERATOR="~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
CURL="/usr/bin/curl"
RVMHTTP="https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer"
CURLARGS="-s"
usage()
{
echo "$SCRIPT: usage: "
}
if [ `id -u` -eq 0 ]
then
echo "$SCRIPT: ERROR: Script cannot be run as root or with sudo."
exit $ERROR
fi
while getopts ":h:" opt; do
case $opt in
h)
usage
exit $SUCCESS
;;
\?)
echo "$SCRIPT: Invalid option: -$OPTARG" >&2
usage
exit $ERROR
;;
:)
echo "$SCRIPT: Option -$OPTARG requires an argument." >&2
usage
exit $ERROR
;;
esac
done
echo "$SEPARATOR"
echo "$SCRIPT: Downloading and installing RVM ..."
$CURL $CURLARGS $RVMHTTP > ./install_rvm.sh
RETURN=$?
if [ $RETURN -eq 0 ]
then
echo "$SCRIPT: RVM downloaded successfully"
else
echo "$SCRIPT: ERROR: RVM failed to download." $>2
exit $ERROR
fi
echo "$SEPARATOR"
echo "$SCRIPT: Installing RVM"
bash install_rvm.sh
if [ $? -eq 0 ]
then
echo "$SCRIPT: RVM installed"
else
echo "$SCRIPT: ERROR: System failed to install RVM" >&2
exit $ERROR
fi
rm install_rvm.sh
##Already done by RVM install
#echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bashrc
echo "$SEPARATOR"
echo "$SEPARATOR"
echo "$SCRIPT: ATTETION! Please close this terminal and open a new one in order to proceed"
echo "$SEPARATOR"
echo "$SEPARATOR"
exit $SUCCESS