-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathinstall_mono.sh
executable file
·54 lines (46 loc) · 1.5 KB
/
install_mono.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
#!/bin/bash
# Check if mono has already been installed.
[ `which mono` ] && exit 0
# Probe system configuration.
IS_STUDENTS_VM=0
[ -d /home/student/notebooks ] && [ -f /home/student/README ] && IS_STUDENTS_VM=1
HAS_APTGET=0
[ `which apt-get` ] && HAS_APTGET=1
HAS_BREW=0
[ `which brew` ] && HAS_BREW=1
echo System config
echo " . is students VM: $IS_STUDENTS_VM"
echo " . has apt-get: $HAS_APTGET"
echo " . has brew: $HAS_BREW"
# Install mono.
if [ $HAS_APTGET -eq 1 ]; then
# Use apt-get.
if [ $IS_STUDENTS_VM -eq 1 ]; then
# Virtual machine. Do everything automatically.
echo Installing mono via apt-get on the student VM...
SUDO='echo M20zbUNMNGIK | base64 --decode | sudo -S'
eval "$SUDO apt-get -qq update &> /dev/null"
eval "$SUDO apt-get -qq -y install mono-complete &> /dev/null"
else
# Unknown host, user interaction required.
echo Installing mono via apt-get...
eval "sudo apt-get -qq update"
eval "sudo apt-get -qq -y install mono-complete"
fi
elif [ $HAS_BREW -eq 1 ]; then
# Use homebrew.
echo Installing mono via homebrew...
brew install mono
else
# Cannot automatically install mono.
echo Cannot automatically install mono on this system.
if [ $OSTYPE == "darwin"* ]; then
echo ' You can first manually install homebrew for OS X (http://brew.sh/).'
echo ' Then re-run this script, and mono will automatically be installed.'
fi
exit 1
fi
# Check that mono is now available.
[ `which mono` ] && exit 0
echo Mono has been installed.
exit 0