This repository has been 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
/
Copy pathinstaller_prep.sh
executable file
·128 lines (103 loc) · 3.84 KB
/
installer_prep.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
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#!/bin/bash
#
# Acts as a transition script from linuxAIO revision 2 to 4. During these changes, many
# of the files were renamed and had their file extension ('.sh') removed.
#
########################################################################################
#### [ Variables ]
## Modify output text color.
yellow="$(printf '\033[1;33m')"
cyan="$(printf '\033[0;36m')"
red="$(printf '\033[1;31m')"
nc="$(printf '\033[0m')"
### Identify distro and distro version.
if [[ -f /etc/os-release ]]; then
# shellcheck disable=SC1091
. /etc/os-release
distro="$ID"
ver="$VERSION_ID" # Version: x.x.x...
sver=${ver//.*/} # Version: x
else
distro=$(uname -s)
ver=$(uname -r)
fi
## Identify bit and architecture type.
case $(uname -m) in
x86_64) bits="64"; _ARCH="x64" ;;
i*86) bits="32"; _ARCH="x86" ;;
armv*) bits="32"; _ARCH="?" ;;
*) bits="?"; _ARCH="?" ;;
esac
#### End of [ Variables ]
########################################################################################
#### [ Functions ]
########
# Ensure that .NET is set up to work with 'packages.microsoft.com'. For more
# information, please visit https://github.com/dotnet/core/issues/7699.
#
# Arguments:
# None
########
custom_dotnet() {
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 6.0 installation..."
sudo apt remove dotnet-sdk-6.0 -y
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
} || {
echo "${red}Failed to create" \
"'/etc/apt/preferences.d/custom-dotnet.pref'${nc}" >&2
exit 1
}
fi
}
#### End of [ Functions ]
########################################################################################
#### [ Main ]
echo -n "${cyan}There has been some changes that require special intervention. When" \
"the installer has exited, re-execute the installer, and re-run MewdekoBot in" \
"your chosen run mode. "
read -rp "Press [Enter] to continue.${nc}"
########################################################################################
#### [[ Set .NET Preferences ]]
if [[ $bits = 64 ]]; then
if [[ $distro = "ubuntu" ]]; then
case "$ver" in
22.04) custom_dotnet ;;
esac
elif [[ $distro = "linuxmint" ]]; then
case "$sver" in
21) custom_dotnet ;;
esac
fi
fi
#### End of [[ Set .NET Preferences ]]
########################################################################################
#### [[ Update Files ]]
if [[ -f linuxAIO.sh ]]; then
echo "Backing up 'linuxAIO.sh' as 'linuxAIO.sh.old'..."
mv linuxAIO.sh linuxAIO.sh.old
elif [[ -f linuxAIO ]]; then
echo "Backing up 'linuxAIO' as 'linuxAIO.old'..."
mv linuxAIO linuxAIO.old
fi
echo "Downloading latest version of 'linuxAIO'..."
curl -O "$_RAW_URL"/linuxAIO && sudo chmod +x linuxAIO
echo "${cyan}NOT applying existing configurations to the new 'linuxAIO'${nc}"
echo "Cleaning up..."
[[ -f MewdekoRun.sh ]] && mv MewdekoRun.sh MewdekoRun
[[ -f installer-prep ]] && rm installer-prep
[[ -f installer_prep.sh ]] && rm installer_prep.sh
echo "Exiting..."
#### End of [[ Update Files ]]
########################################################################################
#### End of [ Main ]
########################################################################################