|
8 | 8 | moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" |
9 | 9 |
|
10 | 10 | fn_install_dotnet_repo() { |
| 11 | + local dotnetpackage |
| 12 | + dotnetpackage="dotnet-runtime-7.0" |
| 13 | + |
| 14 | + for dep in "${array_deps_missing[@]}"; do |
| 15 | + if [[ "${dep}" == dotnet-runtime-* ]]; then |
| 16 | + dotnetpackage="${dep}" |
| 17 | + break |
| 18 | + fi |
| 19 | + done |
| 20 | + |
11 | 21 | if [ "${distroid}" == "ubuntu" ]; then |
12 | | - # if package dotnet-runtime-7.0 is unavailable in ubuntu repos, add the microsoft repo. |
13 | | - if ! apt-cache show dotnet-runtime-7.0 > /dev/null 2>&1; then |
| 22 | + # If the required .NET package is unavailable in Ubuntu repos, add the Microsoft repo. |
| 23 | + if ! apt-cache show "${dotnetpackage}" > /dev/null 2>&1; then |
14 | 24 | fn_fetch_file "https://packages.microsoft.com/config/ubuntu/${distroversion}/packages-microsoft-prod.deb" "" "" "" "/tmp" "packages-microsoft-prod.deb" "" "" "" "" |
15 | 25 | sudo dpkg -i /tmp/packages-microsoft-prod.deb |
16 | 26 | fi |
17 | 27 | elif [ "${distroid}" == "debian" ]; then |
18 | | - fn_fetch_file "https://packages.microsoft.com/config/debian/${distroversion}/packages-microsoft-prod.deb" "" "" "" "/tmp" "packages-microsoft-prod.deb" "" "" "" "" |
19 | | - sudo dpkg -i /tmp/packages-microsoft-prod.deb |
| 28 | + # If the required .NET package is unavailable in Debian repos, add the Microsoft repo. |
| 29 | + if ! apt-cache show "${dotnetpackage}" > /dev/null 2>&1; then |
| 30 | + fn_fetch_file "https://packages.microsoft.com/config/debian/${distroversion}/packages-microsoft-prod.deb" "" "" "" "/tmp" "packages-microsoft-prod.deb" "" "" "" "" |
| 31 | + sudo dpkg -i /tmp/packages-microsoft-prod.deb |
| 32 | + fi |
20 | 33 | fi |
21 | 34 | } |
22 | 35 |
|
@@ -281,10 +294,10 @@ fn_deps_detector() { |
281 | 294 | depstatus=1 |
282 | 295 | monoinstalled=false |
283 | 296 | fi |
284 | | - # .NET Core: A .NET Core repo needs to be installed. |
285 | | - elif [ "${deptocheck}" == "dotnet-runtime-7.0" ]; then |
286 | | - # .NET is not installed. |
287 | | - if dotnet --list-runtimes | grep -q "Microsoft.NETCore.App 7.0"; then |
| 297 | + # .NET runtime: check installed runtime version for any dotnet-runtime-X.Y package. |
| 298 | + elif [[ "${deptocheck}" =~ ^dotnet-runtime-([0-9]+\.[0-9]+)$ ]]; then |
| 299 | + dotnetrequired="${BASH_REMATCH[1]}" |
| 300 | + if [ "$(command -v dotnet 2> /dev/null)" ] && dotnet --list-runtimes | grep -q "Microsoft.NETCore.App ${dotnetrequired}"; then |
288 | 301 | depstatus=0 |
289 | 302 | dotnetinstalled=true |
290 | 303 | else |
@@ -379,6 +392,15 @@ if { [ "${distroid}" == "ubuntu" ] && dpkg --compare-versions "${distroversion}" |
379 | 392 | fi |
380 | 393 | fi |
381 | 394 |
|
| 395 | +# Vintage Story tracks newer .NET runtimes; older distro releases may not ship required packages. |
| 396 | +if [ "${shortname}" == "vints" ]; then |
| 397 | + if { [ "${distroid}" == "ubuntu" ] && dpkg --compare-versions "${distroversion}" "lt" "24.04"; } || { [ "${distroid}" == "debian" ] && dpkg --compare-versions "${distroversion}" "lt" "12"; } || [ "${distroid}" == "centos" ] || [ "${distroid}" == "rhel" ] || [ "${distroid}" == "rocky" ] || [ "${distroid}" == "almalinux" ]; then |
| 398 | + fn_print_warning_nl "${gamename} may require newer .NET runtimes than ${distroname} provides." |
| 399 | + echo -e "If startup fails due to missing .NET runtime, upgrading to Ubuntu 24.04+ or Debian 12+ is recommended." |
| 400 | + fn_script_log_warn "${gamename} may require newer .NET runtimes than ${distroname} provides." |
| 401 | + fi |
| 402 | +fi |
| 403 | + |
382 | 404 | if [ ! -f "${tmpdir}/dependency-no-check.tmp" ] && [ ! -f "${datadir}/${distroid}-${distroversioncsv}.csv" ]; then |
383 | 405 | # Check that the distro dependency csv file exists. |
384 | 406 | fn_check_file_github "lgsm/data" "${distroid}-${distroversioncsv}.csv" |
|
0 commit comments