From 5f0f12a9b20e3f0fc8df86faac5318be7bacb19a Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Mon, 4 Sep 2023 21:24:27 +0100 Subject: [PATCH] feat(vint): migrate to dotnet from mono (#4304) * adde dotnet repo * feat: update package dependencies for Ubuntu 16.04, 18.04, and 20.04 - Updated the package dependency for "vints" from "mono-complete" to "aspnetcore-runtime-7.0" in the Ubuntu 16.04, 18.04, and 20.04 CSV files. - Also updated the package dependency for "vpmc" from "openjdk-8-jre" to "openjdk-11-jre" in the Ubuntu 18.04 and 20.04 CSV files. This commit ensures that the correct package dependencies are specified for these Ubuntu versions, improving compatibility and functionality of the codebase. * refactor: update dependency check for ASP.NET Core runtime The code has been refactored to update the dependency check for the ASP.NET Core runtime. The condition that checks for the presence of "dotnet-runtime-7.0" has been changed to "aspnetcore-runtime-7.0". This ensures that the correct dependency is being checked and improves accuracy in determining if the required runtime is installed. * fix: fix conditional statement in check_deps.sh The commit fixes a bug in the conditional statement of the check_deps.sh script. Previously, it incorrectly checked if dotnetversion was empty instead of checking if it was not empty. This caused an incorrect value to be assigned to depstatus and dotnetinstalled variables. The bug has been fixed by correcting the conditional statement. * refactor: simplify install_config.sh This commit simplifies the `install_config.sh` file by removing unnecessary code for the "vints" configuration. The configuration is now generated on first run, and the list of config locations is still provided. * refactor: improve error handling and display in core_exit.sh and install_config.sh - In core_exit.sh, added a check to set exit code to 4 if it is not already set. - In install_config.sh, improved the display of missing config file by highlighting the file path. These changes aim to enhance the error handling and provide clearer information to users. * feat: add exitcode handling to command_install.sh The commit adds a check for the exitcode variable in command_install.sh. If it is empty, it sets it to 0. This change ensures proper handling of the exitcode in the script. * refactor: improve installation process The code changes in this commit refactor the installation process. The `command_install.sh` file has been modified to remove unnecessary code. Additionally, the `install_complete.sh` file has been updated to provide more informative messages based on the exit code. This improves the overall clarity and user experience during installation. Co-authored-by: AI Assistant * refactor: remove redundant code in install_config.sh The commit removes a redundant function call in the install_config.sh file. The "fn_list_config_locations" function is no longer needed for the "vints" configuration. * a * refactor: improve logging in command_stop.sh - Changed `fn_script_log_error` to `fn_script_log_info` for consistency - Removed unnecessary empty line * refactor: dont try to stop a server that is already stopped * refactor: remove redundant code and improve socket name generation The commit refactors the code in `command_start.sh` and `linuxgsm.sh` to remove redundant code related to generating a unique tmux socket name. The code now creates a uid file if it doesn't exist, stops the running server, generates a uid using the current timestamp, and updates the socketname accordingly. This change improves the efficiency and reliability of socket name generation. * refactor: remove unnecessary command_stop.sh call The code change removes the unnecessary call to `command_stop.sh` in the `linuxgsm.sh` file. This improves efficiency and prevents lingering tmux sessions. * refactor: remove duplicate code for creating unique tmux socket name The code changes in `command_start.sh` and `linuxgsm.sh` refactor the creation of a unique tmux socket name. The duplicate code in `linuxgsm.sh` has been removed, resulting in cleaner and more efficient code. * refactor: improve socketname assignment The code change refactors the socketname assignment in the linuxgsm.sh script. Instead of directly assigning it to "${sessionname}-$(cat "${datadir}/${selfname}.uid")", it now checks if the file "${datadir}/${selfname}.uid" exists before assigning the value. This improves error handling and prevents potential issues when the file doesn't exist. --- lgsm/data/almalinux-8.csv | 2 +- lgsm/data/almalinux-9.csv | 2 +- lgsm/data/centos-7.csv | 2 +- lgsm/data/centos-8.csv | 2 +- lgsm/data/centos-9.csv | 2 +- lgsm/data/debian-10.csv | 2 +- lgsm/data/debian-11.csv | 2 +- lgsm/data/debian-12.csv | 2 +- lgsm/data/debian-9.csv | 2 +- lgsm/data/rhel-7.csv | 2 +- lgsm/data/rhel-8.csv | 2 +- lgsm/data/rhel-9.csv | 2 +- lgsm/data/rocky-8.csv | 2 +- lgsm/data/rocky-9.csv | 2 +- lgsm/data/ubuntu-16.04.csv | 2 +- lgsm/data/ubuntu-18.04.csv | 2 +- lgsm/data/ubuntu-20.04.csv | 2 +- lgsm/data/ubuntu-21.04.csv | 135 ----------------------- lgsm/data/ubuntu-21.10.csv | 135 ----------------------- lgsm/data/ubuntu-22.04.csv | 2 +- lgsm/data/ubuntu-23.04.csv | 2 +- lgsm/modules/check_deps.sh | 47 ++++++-- lgsm/modules/command_dev_detect_glibc.sh | 2 +- lgsm/modules/command_install.sh | 1 + lgsm/modules/command_start.sh | 11 +- lgsm/modules/command_stop.sh | 15 ++- lgsm/modules/core_dl.sh | 2 +- lgsm/modules/core_exit.sh | 2 + lgsm/modules/info_distro.sh | 4 + lgsm/modules/install_complete.sh | 16 ++- lgsm/modules/install_config.sh | 9 +- linuxgsm.sh | 3 +- 32 files changed, 99 insertions(+), 321 deletions(-) delete mode 100644 lgsm/data/ubuntu-21.04.csv delete mode 100644 lgsm/data/ubuntu-21.10.csv diff --git a/lgsm/data/almalinux-8.csv b/lgsm/data/almalinux-8.csv index ee8301e53..78ee5945d 100644 --- a/lgsm/data/almalinux-8.csv +++ b/lgsm/data/almalinux-8.csv @@ -124,7 +124,7 @@ ut2k4 ut3 ut99 vh,glibc-devel -vints,mono-complete +vints,aspnetcore-runtime-7.0 vpmc,java-17-openjdk vs wet diff --git a/lgsm/data/almalinux-9.csv b/lgsm/data/almalinux-9.csv index c7d86c6e3..b341b7282 100644 --- a/lgsm/data/almalinux-9.csv +++ b/lgsm/data/almalinux-9.csv @@ -124,7 +124,7 @@ ut2k4 ut3 ut99 vh,glibc-devel -vints,mono-complete +vints,aspnetcore-runtime-7.0 vpmc,java-17-openjdk vs wet diff --git a/lgsm/data/centos-7.csv b/lgsm/data/centos-7.csv index 2bd1ea57a..616e61c32 100644 --- a/lgsm/data/centos-7.csv +++ b/lgsm/data/centos-7.csv @@ -124,7 +124,7 @@ ut2k4 ut3 ut99 vh,glibc-devel -vints,mono-complete +vints,aspnetcore-runtime-7.0 vpmc,java-11-openjdk vs wet diff --git a/lgsm/data/centos-8.csv b/lgsm/data/centos-8.csv index ee8301e53..78ee5945d 100644 --- a/lgsm/data/centos-8.csv +++ b/lgsm/data/centos-8.csv @@ -124,7 +124,7 @@ ut2k4 ut3 ut99 vh,glibc-devel -vints,mono-complete +vints,aspnetcore-runtime-7.0 vpmc,java-17-openjdk vs wet diff --git a/lgsm/data/centos-9.csv b/lgsm/data/centos-9.csv index c7d86c6e3..b341b7282 100644 --- a/lgsm/data/centos-9.csv +++ b/lgsm/data/centos-9.csv @@ -124,7 +124,7 @@ ut2k4 ut3 ut99 vh,glibc-devel -vints,mono-complete +vints,aspnetcore-runtime-7.0 vpmc,java-17-openjdk vs wet diff --git a/lgsm/data/debian-10.csv b/lgsm/data/debian-10.csv index 646df8b2b..fd29e6da3 100644 --- a/lgsm/data/debian-10.csv +++ b/lgsm/data/debian-10.csv @@ -124,7 +124,7 @@ ut2k4 ut3 ut99 vh,libc6-dev -vints,mono-complete +vints,aspnetcore-runtime-7.0 vpmc,openjdk-11-jre vs wet diff --git a/lgsm/data/debian-11.csv b/lgsm/data/debian-11.csv index 8f31ec9c4..6f34e2832 100644 --- a/lgsm/data/debian-11.csv +++ b/lgsm/data/debian-11.csv @@ -124,7 +124,7 @@ ut2k4 ut3 ut99 vh,libc6-dev -vints,mono-complete +vints,aspnetcore-runtime-7.0 vpmc,openjdk-11-jre vs wet diff --git a/lgsm/data/debian-12.csv b/lgsm/data/debian-12.csv index 51b565a00..3738c4749 100644 --- a/lgsm/data/debian-12.csv +++ b/lgsm/data/debian-12.csv @@ -124,7 +124,7 @@ ut2k4 ut3 ut99 vh,libc6-dev -vints,mono-complete +vints,aspnetcore-runtime-7.0 vpmc,openjdk-17-jre vs wet diff --git a/lgsm/data/debian-9.csv b/lgsm/data/debian-9.csv index 8ff958ddd..794a54afe 100644 --- a/lgsm/data/debian-9.csv +++ b/lgsm/data/debian-9.csv @@ -124,7 +124,7 @@ ut2k4 ut3 ut99 vh,libc6-dev -vints,mono-complete +vints,aspnetcore-runtime-7.0 vpmc,openjdk-8-jre vs wet diff --git a/lgsm/data/rhel-7.csv b/lgsm/data/rhel-7.csv index 196651a2f..1b0b8c1bd 100644 --- a/lgsm/data/rhel-7.csv +++ b/lgsm/data/rhel-7.csv @@ -124,7 +124,7 @@ ut2k4 ut3 ut99 vh,glibc-devel -vints,mono-complete +vints,aspnetcore-runtime-7.0 vpmc,java-11-openjdk vs wet diff --git a/lgsm/data/rhel-8.csv b/lgsm/data/rhel-8.csv index ee8301e53..78ee5945d 100644 --- a/lgsm/data/rhel-8.csv +++ b/lgsm/data/rhel-8.csv @@ -124,7 +124,7 @@ ut2k4 ut3 ut99 vh,glibc-devel -vints,mono-complete +vints,aspnetcore-runtime-7.0 vpmc,java-17-openjdk vs wet diff --git a/lgsm/data/rhel-9.csv b/lgsm/data/rhel-9.csv index c7d86c6e3..b341b7282 100644 --- a/lgsm/data/rhel-9.csv +++ b/lgsm/data/rhel-9.csv @@ -124,7 +124,7 @@ ut2k4 ut3 ut99 vh,glibc-devel -vints,mono-complete +vints,aspnetcore-runtime-7.0 vpmc,java-17-openjdk vs wet diff --git a/lgsm/data/rocky-8.csv b/lgsm/data/rocky-8.csv index ee8301e53..78ee5945d 100644 --- a/lgsm/data/rocky-8.csv +++ b/lgsm/data/rocky-8.csv @@ -124,7 +124,7 @@ ut2k4 ut3 ut99 vh,glibc-devel -vints,mono-complete +vints,aspnetcore-runtime-7.0 vpmc,java-17-openjdk vs wet diff --git a/lgsm/data/rocky-9.csv b/lgsm/data/rocky-9.csv index c7d86c6e3..b341b7282 100644 --- a/lgsm/data/rocky-9.csv +++ b/lgsm/data/rocky-9.csv @@ -124,7 +124,7 @@ ut2k4 ut3 ut99 vh,glibc-devel -vints,mono-complete +vints,aspnetcore-runtime-7.0 vpmc,java-17-openjdk vs wet diff --git a/lgsm/data/ubuntu-16.04.csv b/lgsm/data/ubuntu-16.04.csv index 3e860cd1f..0fac4905f 100644 --- a/lgsm/data/ubuntu-16.04.csv +++ b/lgsm/data/ubuntu-16.04.csv @@ -124,7 +124,7 @@ ut2k4 ut3 ut99 vh,libc6-dev -vints,mono-complete +vints,aspnetcore-runtime-7.0 vpmc,openjdk-8-jre vs wet diff --git a/lgsm/data/ubuntu-18.04.csv b/lgsm/data/ubuntu-18.04.csv index 646df8b2b..fd29e6da3 100644 --- a/lgsm/data/ubuntu-18.04.csv +++ b/lgsm/data/ubuntu-18.04.csv @@ -124,7 +124,7 @@ ut2k4 ut3 ut99 vh,libc6-dev -vints,mono-complete +vints,aspnetcore-runtime-7.0 vpmc,openjdk-11-jre vs wet diff --git a/lgsm/data/ubuntu-20.04.csv b/lgsm/data/ubuntu-20.04.csv index bb026e94a..a51acccd0 100644 --- a/lgsm/data/ubuntu-20.04.csv +++ b/lgsm/data/ubuntu-20.04.csv @@ -124,7 +124,7 @@ ut2k4 ut3 ut99 vh,libc6-dev -vints,mono-complete +vints,aspnetcore-runtime-7.0 vpmc,openjdk-11-jre vs wet diff --git a/lgsm/data/ubuntu-21.04.csv b/lgsm/data/ubuntu-21.04.csv deleted file mode 100644 index 8f31ec9c4..000000000 --- a/lgsm/data/ubuntu-21.04.csv +++ /dev/null @@ -1,135 +0,0 @@ -all,bc,binutils,bsdmainutils,bzip2,ca-certificates,cpio,curl,distro-info,file,gzip,hostname,jq,lib32gcc-s1,lib32stdc++6,netcat,python3,tar,tmux,unzip,util-linux,wget,xz-utils -steamcmd,lib32gcc-s1,lib32stdc++6,libsdl2-2.0-0:i386,steamcmd -ac -ahl -ahl2 -ark -arma3 -armar,libcurl4 -ats -av -bb -bb2,libcurl4-gnutls-dev:i386 -bd -bf1942,libncurses5:i386,libtinfo5:i386 -bfv,libncurses5:i386,libstdc++5:i386 -bmdm,libncurses5:i386 -bo -bs -bt,libicu-dev,dos2unix,libxml2-utils -btl -cc -cd -ck,xvfb,libxi6 -cmw -cod,libstdc++5:i386 -cod2,libstdc++5:i386 -cod4 -coduo,libstdc++5:i386 -codwaw -col -cs -cscz -csgo -css,libtinfo5:i386 -ct -dab -dayz -dmc -dod -dodr -dods -doi -dst,libcurl4-gnutls-dev:i386 -dys -eco,libgdiplus -em -etl -ets2 -fctr -fof -gmod,libtinfo5:i386 -hcu -hl2dm -hldm -hldms -hw,lib32z1 -ins -inss -ios -jc2 -jc3 -jk2 -kf -kf2 -l4d -l4d2 -lo -mc,openjdk-17-jre -mcb -mh -mohaa,libstdc++5:i386 -mom -mta,libncursesw5,libxml2-utils -nd -nec -nmrih,libtinfo5:i386 -ns -ns2,speex,libtbb2 -ns2c,speex:i386,libtbb2 -ohd -onset,libmariadb-dev -opfor -pc -pc2 -pmc,openjdk-17-jre -pstbs,libgconf-2-4 -pvkii -pvr,libc++1 -pz,openjdk-17-jre,rng-tools -q2 -q3 -ql -qw -ricochet -ro -rtcw -rust,lib32z1 -rw,openjdk-17-jre -samp -sb -sbots -scpsl,mono-complete -scpslsm,mono-complete -sdtd,telnet,expect,libxml2-utils -sf -sfc,libtinfo5:i386 -sof2 -sol -squad -st,libxml2-utils -stn -sven,libssl1.1:i386,zlib1g:i386 -terraria -tf2,libcurl4-gnutls-dev:i386 -tfc -ti -ts -ts3 -tu -tw -unt -ut -ut2k4 -ut3 -ut99 -vh,libc6-dev -vints,mono-complete -vpmc,openjdk-11-jre -vs -wet -wf -wmc,openjdk-17-jre -wurm,xvfb -zmr,libtinfo5:i386 -zps,libtinfo5:i386 diff --git a/lgsm/data/ubuntu-21.10.csv b/lgsm/data/ubuntu-21.10.csv deleted file mode 100644 index 8f31ec9c4..000000000 --- a/lgsm/data/ubuntu-21.10.csv +++ /dev/null @@ -1,135 +0,0 @@ -all,bc,binutils,bsdmainutils,bzip2,ca-certificates,cpio,curl,distro-info,file,gzip,hostname,jq,lib32gcc-s1,lib32stdc++6,netcat,python3,tar,tmux,unzip,util-linux,wget,xz-utils -steamcmd,lib32gcc-s1,lib32stdc++6,libsdl2-2.0-0:i386,steamcmd -ac -ahl -ahl2 -ark -arma3 -armar,libcurl4 -ats -av -bb -bb2,libcurl4-gnutls-dev:i386 -bd -bf1942,libncurses5:i386,libtinfo5:i386 -bfv,libncurses5:i386,libstdc++5:i386 -bmdm,libncurses5:i386 -bo -bs -bt,libicu-dev,dos2unix,libxml2-utils -btl -cc -cd -ck,xvfb,libxi6 -cmw -cod,libstdc++5:i386 -cod2,libstdc++5:i386 -cod4 -coduo,libstdc++5:i386 -codwaw -col -cs -cscz -csgo -css,libtinfo5:i386 -ct -dab -dayz -dmc -dod -dodr -dods -doi -dst,libcurl4-gnutls-dev:i386 -dys -eco,libgdiplus -em -etl -ets2 -fctr -fof -gmod,libtinfo5:i386 -hcu -hl2dm -hldm -hldms -hw,lib32z1 -ins -inss -ios -jc2 -jc3 -jk2 -kf -kf2 -l4d -l4d2 -lo -mc,openjdk-17-jre -mcb -mh -mohaa,libstdc++5:i386 -mom -mta,libncursesw5,libxml2-utils -nd -nec -nmrih,libtinfo5:i386 -ns -ns2,speex,libtbb2 -ns2c,speex:i386,libtbb2 -ohd -onset,libmariadb-dev -opfor -pc -pc2 -pmc,openjdk-17-jre -pstbs,libgconf-2-4 -pvkii -pvr,libc++1 -pz,openjdk-17-jre,rng-tools -q2 -q3 -ql -qw -ricochet -ro -rtcw -rust,lib32z1 -rw,openjdk-17-jre -samp -sb -sbots -scpsl,mono-complete -scpslsm,mono-complete -sdtd,telnet,expect,libxml2-utils -sf -sfc,libtinfo5:i386 -sof2 -sol -squad -st,libxml2-utils -stn -sven,libssl1.1:i386,zlib1g:i386 -terraria -tf2,libcurl4-gnutls-dev:i386 -tfc -ti -ts -ts3 -tu -tw -unt -ut -ut2k4 -ut3 -ut99 -vh,libc6-dev -vints,mono-complete -vpmc,openjdk-11-jre -vs -wet -wf -wmc,openjdk-17-jre -wurm,xvfb -zmr,libtinfo5:i386 -zps,libtinfo5:i386 diff --git a/lgsm/data/ubuntu-22.04.csv b/lgsm/data/ubuntu-22.04.csv index ba801e507..7f417b463 100644 --- a/lgsm/data/ubuntu-22.04.csv +++ b/lgsm/data/ubuntu-22.04.csv @@ -124,7 +124,7 @@ ut2k4 ut3 ut99 vh,libc6-dev -vints,mono-complete +vints,aspnetcore-runtime-7.0 vpmc,openjdk-17-jre vs wet diff --git a/lgsm/data/ubuntu-23.04.csv b/lgsm/data/ubuntu-23.04.csv index ba801e507..7f417b463 100644 --- a/lgsm/data/ubuntu-23.04.csv +++ b/lgsm/data/ubuntu-23.04.csv @@ -124,7 +124,7 @@ ut2k4 ut3 ut99 vh,libc6-dev -vints,mono-complete +vints,aspnetcore-runtime-7.0 vpmc,openjdk-17-jre vs wet diff --git a/lgsm/modules/check_deps.sh b/lgsm/modules/check_deps.sh index 41334205e..2818ffc11 100644 --- a/lgsm/modules/check_deps.sh +++ b/lgsm/modules/check_deps.sh @@ -7,6 +7,19 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +fn_install_dotnet_repo() { + if [ "${distroid}" == "ubuntu" ]; then + # if package aspnetcore-runtime-7.0 is unavailable in ubuntu repos, add the microsoft repo. + if ! apt-cache show aspnetcore-runtime-7.0 > /dev/null 2>&1; then + fn_fetch_file "https://packages.microsoft.com/config/ubuntu/${distroversion}/packages-microsoft-prod.deb" "" "" "" "/tmp" "packages-microsoft-prod.deb" "" "" "" "" + sudo dpkg -i /tmp/packages-microsoft-prod.deb + fi + elif [ "${distroid}" == "debian" ]; then + fn_fetch_file "https://packages.microsoft.com/config/debian/${distroversion}/packages-microsoft-prod.deb" "" "" "" "/tmp" "packages-microsoft-prod.deb" "" "" "" "" + sudo dpkg -i /tmp/packages-microsoft-prod.deb + fi +} + fn_install_mono_repo() { if [ "${autodepinstall}" == "0" ]; then fn_print_information_nl "Automatically adding Mono repository." @@ -20,11 +33,11 @@ fn_install_mono_repo() { echo -en " \r" if [ "${distroid}" == "ubuntu" ]; then if [ "${distroversion}" == "22.04" ]; then - cmd="sudo apt install gnupg ca-certificates;sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF;echo 'deb https://download.mono-project.com/repo/ubuntu stable-jammy main' | sudo tee /etc/apt/sources.list.d/mono-official-stable.list;sudo apt update" + cmd="sudo apt-get install gnupg ca-certificates;sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF;echo 'deb https://download.mono-project.com/repo/ubuntu stable-jammy main' | sudo tee /etc/apt/sources.list.d/mono-official-stable.list;sudo apt update" elif [ "${distroversion}" == "20.04" ]; then - cmd="sudo apt install gnupg ca-certificates;sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF;echo 'deb https://download.mono-project.com/repo/ubuntu stable-focal main' | sudo tee /etc/apt/sources.list.d/mono-official-stable.list;sudo apt update" + cmd="sudo apt-get install gnupg ca-certificates;sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF;echo 'deb https://download.mono-project.com/repo/ubuntu stable-focal main' | sudo tee /etc/apt/sources.list.d/mono-official-stable.list;sudo apt update" elif [ "${distroversion}" == "18.04" ]; then - cmd="sudo apt install gnupg ca-certificates;sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF;echo 'deb https://download.mono-project.com/repo/ubuntu stable-bionic main' | sudo tee /etc/apt/sources.list.d/mono-official-stable.list;sudo apt update" + cmd="sudo apt-get install gnupg ca-certificates;sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF;echo 'deb https://download.mono-project.com/repo/ubuntu stable-bionic main' | sudo tee /etc/apt/sources.list.d/mono-official-stable.list;sudo apt update" elif [ "${distroversion}" == "16.04" ]; then cmd="sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF;sudo apt install apt-transport-https ca-certificates;echo 'deb https://download.mono-project.com/repo/ubuntu stable-xenial main' | sudo tee /etc/apt/sources.list.d/mono-official-stable.list;sudo apt update" else @@ -32,13 +45,13 @@ fn_install_mono_repo() { fi elif [ "${distroid}" == "debian" ]; then if [ "${distroversion}" == "12" ]; then - cmd="sudo apt install apt-transport-https dirmngr gnupg ca-certificates;sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF;echo 'deb https://download.mono-project.com/repo/debian stable-bookworm main' | sudo tee /etc/apt/sources.list.d/mono-official-stable.list;sudo apt update" + cmd="sudo apt-get install apt-transport-https dirmngr gnupg ca-certificates;sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF;echo 'deb https://download.mono-project.com/repo/debian stable-bookworm main' | sudo tee /etc/apt/sources.list.d/mono-official-stable.list;sudo apt update" elif [ "${distroversion}" == "11" ]; then - cmd="sudo apt install apt-transport-https dirmngr gnupg ca-certificates;sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF;echo 'deb https://download.mono-project.com/repo/debian stable-bullseye main' | sudo tee /etc/apt/sources.list.d/mono-official-stable.list;sudo apt update" + cmd="sudo apt-get install apt-transport-https dirmngr gnupg ca-certificates;sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF;echo 'deb https://download.mono-project.com/repo/debian stable-bullseye main' | sudo tee /etc/apt/sources.list.d/mono-official-stable.list;sudo apt update" elif [ "${distroversion}" == "10" ]; then - cmd="sudo apt install apt-transport-https dirmngr gnupg ca-certificates;sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF;echo 'deb https://download.mono-project.com/repo/debian stable-buster main' | sudo tee /etc/apt/sources.list.d/mono-official-stable.list;sudo apt update" + cmd="sudo apt-get install apt-transport-https dirmngr gnupg ca-certificates;sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF;echo 'deb https://download.mono-project.com/repo/debian stable-buster main' | sudo tee /etc/apt/sources.list.d/mono-official-stable.list;sudo apt update" elif [ "${distroversion}" == "9" ]; then - cmd="sudo apt install apt-transport-https dirmngr gnupg ca-certificates;sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF;echo 'deb https://download.mono-project.com/repo/debian stable-stretch main' | sudo tee /etc/apt/sources.list.d/mono-official-stable.list;sudo apt update" + cmd="sudo apt-get install apt-transport-https dirmngr gnupg ca-certificates;sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF;echo 'deb https://download.mono-project.com/repo/debian stable-stretch main' | sudo tee /etc/apt/sources.list.d/mono-official-stable.list;sudo apt update" else monoautoinstall="1" fi @@ -135,10 +148,14 @@ fn_install_missing_deps() { fi autodepinstall="$?" - if [ "${monostatus}" == "1" ]; then + if [ "${monoinstalled}" == "false" ]; then fn_install_mono_repo fi + if [ "${dotnetinstalled}" == "false" ]; then + fn_install_dotnet_repo + fi + if [ "${commandname}" == "INSTALL" ]; then if [ "${autodepinstall}" == "0" ]; then fn_print_information_nl "$(whoami) has sudo access." @@ -254,11 +271,21 @@ fn_deps_detector() { if [ -n "${monoversion}" ] && [ "${monoversion}" -ge "5" ]; then # Mono >= 5.0.0 already installed. depstatus=0 - monostatus=0 + monoinstalled=true else # Mono not installed or installed Mono < 5.0.0. depstatus=1 - monostatus=1 + monoinstalled=false + fi + # .NET Core: A .NET Core repo needs to be installed. + elif [ "${deptocheck}" == "aspnetcore-runtime-7.0" ]; then + # .NET is not installed. + if [ -n "${dotnetversion}" ]; then + depstatus=0 + dotnetinstalled=true + else + depstatus=1 + dotnetinstalled=false fi elif [ "$(command -v apt 2> /dev/null)" ]; then dpkg-query -W -f='${Status}' "${deptocheck}" 2> /dev/null | grep -q -P '^install ok installed' diff --git a/lgsm/modules/command_dev_detect_glibc.sh b/lgsm/modules/command_dev_detect_glibc.sh index 8ff87d711..ca64ed7cc 100644 --- a/lgsm/modules/command_dev_detect_glibc.sh +++ b/lgsm/modules/command_dev_detect_glibc.sh @@ -15,7 +15,7 @@ echo -e "=================================" echo -e "glibc Requirements Checker" echo -e "=================================" -if [ ! "$(command -v objdump)" ]; then +if [ ! "$(command -v objdump 2> /dev/null)" ]; then fn_print_failure_nl "objdump is missing" fn_script_log_fatal "objdump is missing" core_exit.sh diff --git a/lgsm/modules/command_install.sh b/lgsm/modules/command_install.sh index e8cba7560..b3edd67c8 100644 --- a/lgsm/modules/command_install.sh +++ b/lgsm/modules/command_install.sh @@ -48,5 +48,6 @@ else fix.sh install_stats.sh install_complete.sh + fi core_exit.sh diff --git a/lgsm/modules/command_start.sh b/lgsm/modules/command_start.sh index 1302d0d99..963815b1b 100644 --- a/lgsm/modules/command_start.sh +++ b/lgsm/modules/command_start.sh @@ -50,9 +50,12 @@ fn_start_tmux() { # Create uid to ensure unique tmux socket name. if [ ! -f "${datadir}/${selfname}.uid" ]; then - # stop running server (if running) to prevent lingering tmux sessions. - exitbypass=1 - command_stop.sh + check_status.sh + if [ "${status}" != "0" ]; then + # stop running server (if running) to prevent lingering tmux sessions. + exitbypass=1 + command_stop.sh + fi uid=$(date '+%s' | sha1sum | head -c 8) echo "${uid}" > "${datadir}/${selfname}.uid" socketname="${sessionname}-$(cat "${datadir}/${selfname}.uid")" @@ -181,7 +184,7 @@ fn_start_tmux() { check.sh # If user ran the start command monitor will become enabled. -if [ "${firstcommandname}" == "START" ]||[ "${firstcommandname}" == "RESTART" ]; then +if [ "${firstcommandname}" == "START" ] || [ "${firstcommandname}" == "RESTART" ]; then date '+%s' > "${lockdir:?}/${selfname}-monitoring.lock" fi diff --git a/lgsm/modules/command_stop.sh b/lgsm/modules/command_stop.sh index dc716216f..409e57b14 100644 --- a/lgsm/modules/command_stop.sh +++ b/lgsm/modules/command_stop.sh @@ -256,15 +256,15 @@ fn_stop_tmux() { fn_stop_pre_check() { if [ "${status}" == "0" ]; then fn_print_info_nl "${servername} is already stopped" - fn_script_log_error "${servername} is already stopped" + fn_script_log_info "${servername} is already stopped" else # Select graceful shutdown. fn_stop_graceful_select - fi - # Check status again, a kill tmux session if graceful shutdown failed. - check_status.sh - if [ "${status}" != "0" ]; then - fn_stop_tmux + # Check status again, a kill tmux session if graceful shutdown failed. + check_status.sh + if [ "${status}" != "0" ]; then + fn_stop_tmux + fi fi } @@ -282,11 +282,10 @@ fn_stop_pre_check rm -f "${lockdir:?}/${selfname}-started.lock" # If user ran the stop command monitor will become disabled. -if [ "${firstcommandname}" == "STOP" ];then +if [ "${firstcommandname}" == "STOP" ]; then rm -f "${lockdir:?}/${selfname}-monitoring.lock" fi - # Remove stopping lockfile. rm -f "${lockdir:?}/${selfname}-stopping.lock" diff --git a/lgsm/modules/core_dl.sh b/lgsm/modules/core_dl.sh index f85499890..2a6c7c400 100644 --- a/lgsm/modules/core_dl.sh +++ b/lgsm/modules/core_dl.sh @@ -36,7 +36,7 @@ fn_dl_steamcmd() { # Unbuffer will allow the output of steamcmd not buffer allowing a smooth output. # unbuffer us part of the expect package. - if [ "$(command -v unbuffer)" ]; then + if [ "$(command -v unbuffer 2> /dev/null)" ]; then unbuffer="unbuffer" fi diff --git a/lgsm/modules/core_exit.sh b/lgsm/modules/core_exit.sh index a66744b19..6947a3d4a 100644 --- a/lgsm/modules/core_exit.sh +++ b/lgsm/modules/core_exit.sh @@ -35,7 +35,9 @@ elif [ "${exitcode}" != "0" ]; then elif [ "${exitcode}" == "3" ]; then fn_script_log_warn "${moduleselfname} exiting with code: ${exitcode}" else + # if exit code is not set assume error. fn_script_log_warn "${moduleselfname} exiting with code: ${exitcode}" + exitcode=4 fi fn_exit_dev_debug # remove trap. diff --git a/lgsm/modules/info_distro.sh b/lgsm/modules/info_distro.sh index b375f8c02..aacee2b8f 100644 --- a/lgsm/modules/info_distro.sh +++ b/lgsm/modules/info_distro.sh @@ -127,6 +127,10 @@ if [ "$(command -v mono 2> /dev/null)" ]; then monoversion="$(mono --version 2>&1 | grep -Po '(?<=version )\d')" fi +if [ "$(command -v dotnet 2> /dev/null)" ]; then + dotnetversion="$(dotnet --list-runtimes | grep -E 'Microsoft\.NETCore\.App' | awk '{print $2}')" +fi + ## Uptime uptime="$(< /proc/uptime)" uptime=${uptime/[. ]*/} diff --git a/lgsm/modules/install_complete.sh b/lgsm/modules/install_complete.sh index 58189a4be..013ba7334 100644 --- a/lgsm/modules/install_complete.sh +++ b/lgsm/modules/install_complete.sh @@ -9,7 +9,21 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" echo -e "" echo -e "=================================" -echo -e "Install Complete!" + +if [ "${exitcode}" == "1" ]; then + echo -e "Install Failed!" + fn_script_log_fatal "Install Failed!" +elif [ "${exitcode}" == "2" ]; then + echo -e "Install Completed with Errors!" + fn_script_log_error "Install Completed with Errors!" +elif [ "${exitcode}" == "3" ]; then + echo -e "Install Completed with Warnings!" + fn_script_log_warn "Install Completed with Warnings!" +elif [ -z "${exitcode}" ] || [ "${exitcode}" == "0" ]; then + echo -e "Install Complete!" + fn_script_log_pass "Install Complete!" +fi + fn_script_log_info "Install Complete!" echo -e "" echo -e "To start server type:" diff --git a/lgsm/modules/install_config.sh b/lgsm/modules/install_config.sh index e868e9bf7..9a49b821c 100644 --- a/lgsm/modules/install_config.sh +++ b/lgsm/modules/install_config.sh @@ -154,7 +154,7 @@ fn_list_config_locations() { elif [ -d "${servercfgfullpath}" ]; then echo -e "Game Server Config Dir: ${servercfgfullpath}" else - echo -e "Config file: ${red}${servercfgfullpath} (${red}FILE MISSING${default})" + echo -e "Config file: ${red}${servercfgfullpath}${default} (${red}FILE MISSING${default})" fi fi echo -e "LinuxGSM Config: ${lgsmdir}/config-lgsm/${gameservername}" @@ -787,11 +787,8 @@ elif [ "${shortname}" == "unt" ]; then fn_set_config_vars fn_list_config_locations elif [ "${shortname}" == "vints" ]; then - array_configs+=(serverconfig.json) - fn_fetch_default_config - fn_default_config_remote - fn_set_config_vars - fn_list_config_locations + # Config is generated on first run + : elif [ "${shortname}" == "vs" ]; then array_configs+=(server.cfg) fn_fetch_default_config diff --git a/linuxgsm.sh b/linuxgsm.sh index 331a61822..d6b526e0e 100755 --- a/linuxgsm.sh +++ b/linuxgsm.sh @@ -36,7 +36,7 @@ tmpdir="${lgsmdir}/tmp" datadir="${lgsmdir}/data" lockdir="${lgsmdir}/lock" sessionname="${selfname}" -[ -f "${datadir}/${selfname}.uid" ] && socketname="${sessionname}-$(cat "${datadir}/${selfname}.uid")" || socketname="${sessionname}" +[ -f "${datadir}/${selfname}.uid" ] && socketname="${sessionname}-$(cat "${datadir}/${selfname}.uid")" serverlist="${datadir}/serverlist.csv" serverlistmenu="${datadir}/serverlistmenu.csv" [ -n "${LGSM_CONFIG}" ] && configdir="${LGSM_CONFIG}" || configdir="${lgsmdir}/config-lgsm" @@ -413,6 +413,7 @@ else fi fi fi + # Load the IP details before the first config is loaded. check_ip.sh # Configs have to be loaded twice to allow start startparameters to pick up all vars