-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathDotNetInstall.sh
64 lines (50 loc) · 1.95 KB
/
DotNetInstall.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
#!/bin/bash
#Authors: covers1624, DarioDaf, Solxanich
# Provided for use in tModLoader deployment.
# UPDATED FOR DOCKER CONTAINER BY JACOBSMILE
#chdir to path of the script and save it
cd "$(dirname "$0")"
. ./BashUtils.sh
echo "You are on platform: \"$_uname\""
LaunchLogs="$root_dir/tModLoader-Logs"
if [ ! -d "$LaunchLogs" ]; then
mkdir -p "$LaunchLogs"
fi
LogFile="$LaunchLogs/Launch.log"
if [ -f "$LogFile" ]; then
rm "$LogFile"
fi
touch "$LogFile"
NativeLog="$LaunchLogs/Natives.log"
if [ -f "$NativeLog" ]; then
rm "$NativeLog"
fi
touch "$NativeLog"
if [[ "$_uname" == *"_NT"* ]]; then
echo "Windows Version $WINDOWS_MAJOR.$WINDOWS_MINOR" 2>&1 | tee -a "$LogFile"
if [[ $WINDOWS_MAJOR -ge 10 ]]; then
./QuickEditDisable.exe 2>&1 | tee -a "$LogFile"
fi
fi
echo "Verifying .NET...." 2>&1 | tee -a "$LogFile"
echo "This may take a few moments."
echo "Logging to $LogFile" 2>&1 | tee -a "$LogFile"
if [[ "$_uname" == *"_NT"* ]]; then
run_script ./Remove13_64Bit.sh 2>&1 | tee -a "$LogFile"
fi
. ./UnixLinkerFix.sh
#Parse version from runtimeconfig, jq would be a better solution here, but its not installed by default on all distros.
echo "Parsing .NET version requirements from runtimeconfig.json" 2>&1 | tee -a "$LogFile"
dotnet_version=$(sed -n 's/^.*"version": "\(.*\)"/\1/p' <../tModLoader.runtimeconfig.json) #sed, go die plskthx
export dotnet_version=${dotnet_version%$'\r'} # remove trailing carriage return that sed may leave in variable, producing a bad folder name
#echo $version
# use this to check the output of sed. Expected output: "00000000 35 2e 30 2e 30 0a |5.0.0.| 00000006"
# echo $(hexdump -C <<< "$version")
export dotnet_dir="$root_dir/dotnet"
if [[ -n "$IS_WSL" || -n "$WSL_DISTRO_NAME" ]]; then
echo "wsl detected. Setting dotnet_dir=dotnet_wsl"
export dotnet_dir="$root_dir/dotnet_wsl"
fi
export install_dir="$dotnet_dir/$dotnet_version"
echo "Success!" 2>&1 | tee -a "$LogFile"
run_script ./InstallNetFramework.sh 2>&1 | tee -a "$LogFile"