-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstallpackagemono.sh
More file actions
111 lines (96 loc) · 2.88 KB
/
installpackagemono.sh
File metadata and controls
111 lines (96 loc) · 2.88 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/bin/bash
# Run:
# chmod +x installpackagemono.sh
# ./installpackagemono.sh
#Page - https://www.mono-project.com/download/stable/#download-lin
set -e #Exit immediately if a comman returns a non-zero status
echo "Run: installpackagemono.sh"
export DEBIAN_FRONTEND="noninteractive"
#Add the Mono repository to your system
#--------------------------------------
#file exist $filename
declare filename="/etc/apt/sources.list.d/mono-official-stable.list"
#removal
if [ -f $filename ]; then
#rm
sudo rm $filename
fi
#get OS name: Ubuntu Debian Raspbian
declare osName=$(lsb_release -i | sed 's/.*:\s*//')
echo "osName: $osName"
#get OS codename: focal bionic buster stretch
declare osCodename=("$(lsb_release -c | sed 's/.*:\s*//')")
echo "osCodename: $osCodename"
#select repository
if [[ "$osName" == "Ubuntu" || "$osName" == "Debian" || "$osName" == "Raspbian" ]]; then
#Update
sudo apt-get update
sudo apt-get install -y apt-transport-https dirmngr gnupg ca-certificates
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
#
if [[ "$osName" == "Raspbian" ]]; then
#Raspbian
echo "Raspbian"
case $osCodename in
buster)
echo "buster"
echo "deb https://download.mono-project.com/repo/debian stable-raspbianbuster main" | sudo tee $filename
;;
stretch)
echo "stretch"
echo "deb https://download.mono-project.com/repo/debian stable-raspbianstretch main" | sudo tee $filename
;;
*)
echo "Error: your operating system is not supported to install the Mono package."
exit 1
;;
esac
else
#Ubuntu Debian
echo "Ubuntu or Debian"
case $osCodename in
#Ubuntu
jammy)
echo "focal"
echo "deb https://download.mono-project.com/repo/ubuntu stable-focal main" | sudo tee $filename
;;
focal)
echo "focal"
echo "deb https://download.mono-project.com/repo/ubuntu stable-focal main" | sudo tee $filename
;;
bionic)
echo "bionic"
echo "deb https://download.mono-project.com/repo/ubuntu stable-bionic main" | sudo tee $filename
;;
xenial)
echo "xenial"
echo "deb https://download.mono-project.com/repo/ubuntu stable-xenial main" | sudo tee $filename
;;
#Debian
buster)
echo "buster"
echo "deb https://download.mono-project.com/repo/debian stable-buster main" | sudo tee $filename
;;
stretch)
echo "stretch"
echo "deb https://download.mono-project.com/repo/debian stable-stretch main" | sudo tee $filename
;;
*)
echo "Error: your operating system is not supported to install the Mono package."
exit 1
;;
esac
fi
else
echo "Error: your operating system is not supported to install the Mono package."
exit 1
fi
#Update
sudo apt-get update
#Install Mono
#------------
sudo apt-get install -y mono-complete
#Check Mono
#------------
mono --version
echo "Successfully"