This repository was archived by the owner on Dec 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathprereqs-installer
More file actions
executable file
·109 lines (93 loc) · 3.61 KB
/
prereqs-installer
File metadata and controls
executable file
·109 lines (93 loc) · 3.61 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
#!/bin/bash
#
# Install the packages and dependencies required for Mewdeko to run on Linux.
#
########################################################################################
#### [ Functions ]
########
# Install the packages and dependencies required by Mewdeko, on all compatible
# Linux distributions.
#
# Arguments:
# $1 - required
# Distribution name.
# $2 - required
# Distribution version.
# $3 - required
# OpenJDK version.
# $4 - optional
# True if .NET preferences must be set.
########
install_prereqs() {
echo "Installing .NET Core..."
## Microsoft package signing key.
curl -O https://packages.microsoft.com/config/"$1"/"$2"/packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo rm -f packages-microsoft-prod.deb
## Ensure that .NET SDK is correctly installed on specific versions of Linux.
if [[ $4 = true ]]; then
if (hash dotnet &>/dev/null && [[ ! $(dotnet --version) ]]) &>/dev/null; then
echo "${_YELLOW}While the .NET runtime is installed, the .NET SDK is not${_NC}"
echo "Uninstalling existing .NET Core installation..."
sudo apt remove -y dotnet-sdk-6.0
sudo apt autoremove -y
fi
if [[ ! -f /etc/apt/preferences.d/custom-dotnet.pref ]]; then
echo "Upating prefered .NET Core install method..."
echo -e "Explanation: https://github.com/dotnet/core/issues/7699" \
"\nPackage: *" \
"\nPin: origin \"packages.microsoft.com\"" \
"\nPin-Priority: 1001" | sudo tee /etc/apt/preferences.d/custom-dotnet.pref \
|| _STDERR "Failed to create '/etc/apt/preferences.d/custom-dotnet.pref'" "1"
echo "Reinstalling .NET Core..."
fi
fi
## Install the SDK.
sudo apt update && sudo apt install -y dotnet-sdk-6.0
## Install Java.
echo "Installing '$3'..."
sudo apt install -y "$3"
## Other prerequisites.
echo "Installing other prerequisites..."
sudo apt install -y redis-server git ccze apt-transport-https
}
########
# Inform the end-user that their system is not supported by the automatic installation
# of the prerequisites.
#
# Arguments:
# None
########
unsupported() {
echo "${_RED}The installer does not support the automatic installation and setup" \
"of Mewdeko's prerequisites for your OS: $_DISTRO $_VER ${_ARCH}${_NC}"
read -rp "Press [Enter] to return to the installer menu"
exit 3
}
#### End of [ Functions ]
########################################################################################
#### [ Main ]
read -rp "We will now install Mewdeko's prerequisites. Press [Enter] to continue."
if [[ $_DISTRO = "ubuntu" ]]; then
case "$_VER" in
22.04) install_prereqs "ubuntu" "$_VER" "openjdk-17-jdk" "true" ;;
20.04|18.04) install_prereqs "ubuntu" "$_VER" "openjdk-17-jdk" ;;
*) unsupported ;;
esac
elif [[ $_DISTRO = "debian" ]]; then
case "$_SVER" in
11) install_prereqs "debian" "$_SVER" "openjdk-17-jdk" ;;
10) install_prereqs "debian" "$_SVER" "openjdk-11-jdk" ;;
*) unsupported ;;
esac
elif [[ $_DISTRO = "linuxmint" ]]; then
case "$_SVER" in
21) install_prereqs "ubuntu" "22.04" "openjdk-17-jdk" "true" ;;
20) install_prereqs "ubuntu" "20.04" "openjdk-17-jdk" ;;
*) unsupported ;;
esac
fi
echo -e "\n${_GREEN}Finished installing prerequisites${_NC}"
read -rp "Press [Enter] to return to the installer menu"
#### End of [ Main ]
########################################################################################