From 490cd3fa5aeadd63180fab5379f49d78748ec8ef Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Tue, 28 Sep 2021 22:51:41 +0100 Subject: [PATCH] fix(install): resolve steamcmd dependency issues (#3583) * fix(install): improve steamcmd detection --- lgsm/data/almalinux-8.csv | 4 ++- lgsm/data/centos-7.csv | 4 ++- lgsm/data/centos-8.csv | 3 +- lgsm/data/debian-10.csv | 8 +++-- lgsm/data/debian-11.csv | 8 +++-- lgsm/data/debian-9.csv | 8 +++-- lgsm/data/rhel-7.csv | 4 ++- lgsm/data/rhel-8.csv | 4 ++- lgsm/data/rocky-8.csv | 4 ++- lgsm/data/ubuntu-16.04.csv | 8 +++-- lgsm/data/ubuntu-18.04.csv | 8 +++-- lgsm/data/ubuntu-20.04.csv | 9 +++--- lgsm/data/ubuntu-21.04.csv | 8 +++-- lgsm/functions/check_deps.sh | 36 ++++++++++++++--------- lgsm/functions/command_update_linuxgsm.sh | 33 +++++++++++++++++++++ lgsm/functions/info_distro.sh | 7 +++++ 16 files changed, 114 insertions(+), 42 deletions(-) diff --git a/lgsm/data/almalinux-8.csv b/lgsm/data/almalinux-8.csv index f72d74b7b7..270ede409c 100644 --- a/lgsm/data/almalinux-8.csv +++ b/lgsm/data/almalinux-8.csv @@ -1,4 +1,5 @@ -all,epel-release,curl,wget,util-linux,python36,file,tar,gzip,bzip2,unzip,xz,binutils,bc,jq,tmux,nmap-ncat,cpio,hostname +all,bc,binutils,bzip2,bzip2,cpio,curl,epel-release,file,glibc.i686,gzip,hostname,jq,libstdc++.i686,nmap-ncat,python36,tar,tmux,unzip,util-linux,wget,xz +steamcmd,glibc.i686,libstdc++.i686 ac ahl ahl2 @@ -96,6 +97,7 @@ sof2 sol squad st +stn sven terraria tf2,libcurl.i686 diff --git a/lgsm/data/centos-7.csv b/lgsm/data/centos-7.csv index f72d74b7b7..270ede409c 100644 --- a/lgsm/data/centos-7.csv +++ b/lgsm/data/centos-7.csv @@ -1,4 +1,5 @@ -all,epel-release,curl,wget,util-linux,python36,file,tar,gzip,bzip2,unzip,xz,binutils,bc,jq,tmux,nmap-ncat,cpio,hostname +all,bc,binutils,bzip2,bzip2,cpio,curl,epel-release,file,glibc.i686,gzip,hostname,jq,libstdc++.i686,nmap-ncat,python36,tar,tmux,unzip,util-linux,wget,xz +steamcmd,glibc.i686,libstdc++.i686 ac ahl ahl2 @@ -96,6 +97,7 @@ sof2 sol squad st +stn sven terraria tf2,libcurl.i686 diff --git a/lgsm/data/centos-8.csv b/lgsm/data/centos-8.csv index f72d74b7b7..f9805f8b0a 100644 --- a/lgsm/data/centos-8.csv +++ b/lgsm/data/centos-8.csv @@ -1,4 +1,5 @@ -all,epel-release,curl,wget,util-linux,python36,file,tar,gzip,bzip2,unzip,xz,binutils,bc,jq,tmux,nmap-ncat,cpio,hostname +all,bc,binutils,bzip2,bzip2,cpio,curl,epel-release,file,glibc.i686,gzip,hostname,jq,libstdc++,libstdc++.i686,nmap-ncat,python36,tar,tmux,unzip,util-linux,wget,xz +steamcmd,glibc.i686,libstdc++.i686 ac ahl ahl2 diff --git a/lgsm/data/debian-10.csv b/lgsm/data/debian-10.csv index f352a05a26..746e0d5cc3 100644 --- a/lgsm/data/debian-10.csv +++ b/lgsm/data/debian-10.csv @@ -1,4 +1,5 @@ -all,bc,binutils,bsdmainutils,bzip2,ca-certificates,cpio,curl,file,gzip,jq,python3,tar,tmux,util-linux,netcat,unzip,xz-utils,lib32gcc1,lib32stdc++6,hostname +all,bc,binutils,bsdmainutils,bzip2,ca-certificates,cpio,curl,file,gzip,hostname,jq,lib32gcc1,lib32stdc++6,netcat,netcat,python3,tar,tmux,unzip,util-linux,wget,xz-utils +steamcmd,lib32gcc1,lib32stdc++6,libsdl2-2.0-0:i386,steamcmd ac ahl ahl2 @@ -68,14 +69,14 @@ nmrih,libtinfo5:i386 ns ns2,speex,libtbb2 ns2c,speex:i386,libtbb2 -onset +onset,libmariadbclient-dev opfor pc pmc,openjdk-11-jre pstbs,libgconf-2-4 pvkii pvr,libc++1 -pz +pz,openjdk-11-jre,rng-tools q2 q3 ql @@ -96,6 +97,7 @@ sof2 sol squad st +stn sven,libssl1.1:i386,zlib1g:i386 terraria tf2,libcurl4-gnutls-dev:i386 diff --git a/lgsm/data/debian-11.csv b/lgsm/data/debian-11.csv index 146e9fc2c2..35bf76936f 100644 --- a/lgsm/data/debian-11.csv +++ b/lgsm/data/debian-11.csv @@ -1,4 +1,5 @@ -all,bc,binutils,bsdmainutils,bzip2,ca-certificates,cpio,curl,file,gzip,jq,python3,tar,tmux,util-linux,netcat,unzip,xz-utils,lib32gcc-s1,lib32stdc++6,hostname +all,bc,binutils,bsdmainutils,bzip2,ca-certificates,cpio,curl,file,gzip,hostname,jq,lib32gcc-s1,lib32stdc++6,netcat,netcat,python3,tar,tmux,unzip,util-linux,wget,xz-utils +steamcmd,lib32gcc-s1,lib32stdc++6,libsdl2-2.0-0:i386,steamcmd ac ahl ahl2 @@ -68,14 +69,14 @@ nmrih,libtinfo5:i386 ns ns2,speex,libtbb2 ns2c,speex:i386,libtbb2 -onset +onset,libmariadbclient-dev opfor pc pmc,openjdk-16-jre pstbs,libgconf-2-4 pvkii pvr,libc++1 -pz +pz,openjdk-16-jre,rng-tools q2 q3 ql @@ -96,6 +97,7 @@ sof2 sol squad st +stn sven,libssl1.1:i386,zlib1g:i386 terraria tf2,libcurl4-gnutls-dev:i386 diff --git a/lgsm/data/debian-9.csv b/lgsm/data/debian-9.csv index 0b40d23404..4a8790286d 100644 --- a/lgsm/data/debian-9.csv +++ b/lgsm/data/debian-9.csv @@ -1,4 +1,5 @@ -all,bc,binutils,bsdmainutils,bzip2,ca-certificates,cpio,curl,file,gzip,jq,python3,tar,tmux,util-linux,netcat,unzip,xz-utils,lib32gcc1,lib32stdc++6,hostname +all,bc,binutils,bsdmainutils,bzip2,ca-certificates,cpio,curl,file,gzip,hostname,jq,lib32gcc1,lib32stdc++6,netcat,netcat,python3,tar,tmux,unzip,util-linux,wget,xz-utils +steamcmd,lib32gcc1,lib32stdc++6,libsdl2-2.0-0:i386,steamcmd ac ahl ahl2 @@ -68,14 +69,14 @@ nmrih,libtinfo5:i386 ns ns2,speex,libtbb2 ns2c,speex:i386,libtbb2 -onset +onset,libmariadbclient-dev opfor pc pmc,openjdk-8-jre pstbs,libgconf-2-4 pvkii pvr,libc++1 -pz +pz,openjdk-8-jre,rng-tools q2 q3 ql @@ -96,6 +97,7 @@ sof2 sol squad st +stn sven,libssl1.1:i386,zlib1g:i386 terraria tf2,libcurl4-gnutls-dev:i386 diff --git a/lgsm/data/rhel-7.csv b/lgsm/data/rhel-7.csv index f72d74b7b7..270ede409c 100644 --- a/lgsm/data/rhel-7.csv +++ b/lgsm/data/rhel-7.csv @@ -1,4 +1,5 @@ -all,epel-release,curl,wget,util-linux,python36,file,tar,gzip,bzip2,unzip,xz,binutils,bc,jq,tmux,nmap-ncat,cpio,hostname +all,bc,binutils,bzip2,bzip2,cpio,curl,epel-release,file,glibc.i686,gzip,hostname,jq,libstdc++.i686,nmap-ncat,python36,tar,tmux,unzip,util-linux,wget,xz +steamcmd,glibc.i686,libstdc++.i686 ac ahl ahl2 @@ -96,6 +97,7 @@ sof2 sol squad st +stn sven terraria tf2,libcurl.i686 diff --git a/lgsm/data/rhel-8.csv b/lgsm/data/rhel-8.csv index f72d74b7b7..270ede409c 100644 --- a/lgsm/data/rhel-8.csv +++ b/lgsm/data/rhel-8.csv @@ -1,4 +1,5 @@ -all,epel-release,curl,wget,util-linux,python36,file,tar,gzip,bzip2,unzip,xz,binutils,bc,jq,tmux,nmap-ncat,cpio,hostname +all,bc,binutils,bzip2,bzip2,cpio,curl,epel-release,file,glibc.i686,gzip,hostname,jq,libstdc++.i686,nmap-ncat,python36,tar,tmux,unzip,util-linux,wget,xz +steamcmd,glibc.i686,libstdc++.i686 ac ahl ahl2 @@ -96,6 +97,7 @@ sof2 sol squad st +stn sven terraria tf2,libcurl.i686 diff --git a/lgsm/data/rocky-8.csv b/lgsm/data/rocky-8.csv index f72d74b7b7..270ede409c 100644 --- a/lgsm/data/rocky-8.csv +++ b/lgsm/data/rocky-8.csv @@ -1,4 +1,5 @@ -all,epel-release,curl,wget,util-linux,python36,file,tar,gzip,bzip2,unzip,xz,binutils,bc,jq,tmux,nmap-ncat,cpio,hostname +all,bc,binutils,bzip2,bzip2,cpio,curl,epel-release,file,glibc.i686,gzip,hostname,jq,libstdc++.i686,nmap-ncat,python36,tar,tmux,unzip,util-linux,wget,xz +steamcmd,glibc.i686,libstdc++.i686 ac ahl ahl2 @@ -96,6 +97,7 @@ sof2 sol squad st +stn sven terraria tf2,libcurl.i686 diff --git a/lgsm/data/ubuntu-16.04.csv b/lgsm/data/ubuntu-16.04.csv index 0b40d23404..4a8790286d 100644 --- a/lgsm/data/ubuntu-16.04.csv +++ b/lgsm/data/ubuntu-16.04.csv @@ -1,4 +1,5 @@ -all,bc,binutils,bsdmainutils,bzip2,ca-certificates,cpio,curl,file,gzip,jq,python3,tar,tmux,util-linux,netcat,unzip,xz-utils,lib32gcc1,lib32stdc++6,hostname +all,bc,binutils,bsdmainutils,bzip2,ca-certificates,cpio,curl,file,gzip,hostname,jq,lib32gcc1,lib32stdc++6,netcat,netcat,python3,tar,tmux,unzip,util-linux,wget,xz-utils +steamcmd,lib32gcc1,lib32stdc++6,libsdl2-2.0-0:i386,steamcmd ac ahl ahl2 @@ -68,14 +69,14 @@ nmrih,libtinfo5:i386 ns ns2,speex,libtbb2 ns2c,speex:i386,libtbb2 -onset +onset,libmariadbclient-dev opfor pc pmc,openjdk-8-jre pstbs,libgconf-2-4 pvkii pvr,libc++1 -pz +pz,openjdk-8-jre,rng-tools q2 q3 ql @@ -96,6 +97,7 @@ sof2 sol squad st +stn sven,libssl1.1:i386,zlib1g:i386 terraria tf2,libcurl4-gnutls-dev:i386 diff --git a/lgsm/data/ubuntu-18.04.csv b/lgsm/data/ubuntu-18.04.csv index f352a05a26..746e0d5cc3 100644 --- a/lgsm/data/ubuntu-18.04.csv +++ b/lgsm/data/ubuntu-18.04.csv @@ -1,4 +1,5 @@ -all,bc,binutils,bsdmainutils,bzip2,ca-certificates,cpio,curl,file,gzip,jq,python3,tar,tmux,util-linux,netcat,unzip,xz-utils,lib32gcc1,lib32stdc++6,hostname +all,bc,binutils,bsdmainutils,bzip2,ca-certificates,cpio,curl,file,gzip,hostname,jq,lib32gcc1,lib32stdc++6,netcat,netcat,python3,tar,tmux,unzip,util-linux,wget,xz-utils +steamcmd,lib32gcc1,lib32stdc++6,libsdl2-2.0-0:i386,steamcmd ac ahl ahl2 @@ -68,14 +69,14 @@ nmrih,libtinfo5:i386 ns ns2,speex,libtbb2 ns2c,speex:i386,libtbb2 -onset +onset,libmariadbclient-dev opfor pc pmc,openjdk-11-jre pstbs,libgconf-2-4 pvkii pvr,libc++1 -pz +pz,openjdk-11-jre,rng-tools q2 q3 ql @@ -96,6 +97,7 @@ sof2 sol squad st +stn sven,libssl1.1:i386,zlib1g:i386 terraria tf2,libcurl4-gnutls-dev:i386 diff --git a/lgsm/data/ubuntu-20.04.csv b/lgsm/data/ubuntu-20.04.csv index 942915cbe2..90f4a67e0e 100644 --- a/lgsm/data/ubuntu-20.04.csv +++ b/lgsm/data/ubuntu-20.04.csv @@ -1,5 +1,5 @@ -all,bc,binutils,bsdmainutils,bzip2,ca-certificates,cpio,curl,file,gzip,jq,python3,tar,tmux,util-linux,netcat,unzip,xz-utils,lib32gcc1,lib32stdc++6,hostname -steamcmd,lib32gcc1,lib32stdc++6,libsdl2-2.0-0:i386 +all,bc,binutils,bsdmainutils,bzip2,ca-certificates,cpio,curl,file,gzip,hostname,jq,lib32gcc1,lib32stdc++6,netcat,netcat,python3,tar,tmux,unzip,util-linux,wget,xz-utils +steamcmd,lib32gcc1,lib32stdc++6,libsdl2-2.0-0:i386,steamcmd ac ahl ahl2 @@ -69,14 +69,14 @@ nmrih,libtinfo5:i386 ns ns2,speex,libtbb2 ns2c,speex:i386,libtbb2 -onset +onset,libmariadbclient-dev opfor pc pmc,openjdk-16-jre pstbs,libgconf-2-4 pvkii pvr,libc++1 -pz +pz,openjdk-16-jre,rng-tools q2 q3 ql @@ -97,6 +97,7 @@ sof2 sol squad st +stn sven,libssl1.1:i386,zlib1g:i386 terraria tf2,libcurl4-gnutls-dev:i386 diff --git a/lgsm/data/ubuntu-21.04.csv b/lgsm/data/ubuntu-21.04.csv index 146e9fc2c2..35bf76936f 100644 --- a/lgsm/data/ubuntu-21.04.csv +++ b/lgsm/data/ubuntu-21.04.csv @@ -1,4 +1,5 @@ -all,bc,binutils,bsdmainutils,bzip2,ca-certificates,cpio,curl,file,gzip,jq,python3,tar,tmux,util-linux,netcat,unzip,xz-utils,lib32gcc-s1,lib32stdc++6,hostname +all,bc,binutils,bsdmainutils,bzip2,ca-certificates,cpio,curl,file,gzip,hostname,jq,lib32gcc-s1,lib32stdc++6,netcat,netcat,python3,tar,tmux,unzip,util-linux,wget,xz-utils +steamcmd,lib32gcc-s1,lib32stdc++6,libsdl2-2.0-0:i386,steamcmd ac ahl ahl2 @@ -68,14 +69,14 @@ nmrih,libtinfo5:i386 ns ns2,speex,libtbb2 ns2c,speex:i386,libtbb2 -onset +onset,libmariadbclient-dev opfor pc pmc,openjdk-16-jre pstbs,libgconf-2-4 pvkii pvr,libc++1 -pz +pz,openjdk-16-jre,rng-tools q2 q3 ql @@ -96,6 +97,7 @@ sof2 sol squad st +stn sven,libssl1.1:i386,zlib1g:i386 terraria tf2,libcurl4-gnutls-dev:i386 diff --git a/lgsm/functions/check_deps.sh b/lgsm/functions/check_deps.sh index e5f5aead2c..f961d076ad 100755 --- a/lgsm/functions/check_deps.sh +++ b/lgsm/functions/check_deps.sh @@ -173,6 +173,11 @@ fn_install_missing_deps(){ eval "${cmd}" fi autodepinstall="$?" + + # If auto install passes remove steamcmd install failure. + if [ "${autodepinstall}" == "0" ]; then + unset steamcmdfail + fi fi # If automatic dependency install is unavailable. @@ -217,8 +222,14 @@ fn_check_loop(){ # Checks if dependency is installed or not. fn_deps_detector(){ + ## Check. + # SteamCMD: Will be removed from required array if non-free repo is not available. + # This will cause SteamCMD to be installed using tar. + if [ "${deptocheck}" == "steamcmd" ]&&[ "${distroid}" == "debian" ]&& ! grep -qE "^deb .*non-free" /etc/apt/sources.list; then + array_deps_required=( "${array_deps_required[@]/steamcmd}" ) + steamcmdstatus=1 # Java: Added for users using Oracle JRE to bypass check. - if [[ ${deptocheck} == "openjdk"* ]]||[[ ${deptocheck} == "java"* ]]; then + elif [[ ${deptocheck} == "openjdk"* ]]||[[ ${deptocheck} == "java"* ]]; then # Is java already installed? if [ -n "${javaversion}" ]; then # Added for users using Oracle JRE to bypass check. @@ -249,25 +260,28 @@ fn_deps_detector(){ depstatus=$? fi - if [ "${depstatus}" == "0" ]; then + # Outcome of Check. + if [ "${steamcmdstatus}" == "1" ]; then + # If SteamCMD is not available in repo dont check for it. + unset steamcmdstatus + elif [ "${depstatus}" == "0" ]; then # If dependency is found. missingdep=0 if [ "${commandname}" == "INSTALL" ]; then echo -e "${green}${deptocheck}${default}" sleep 0.1 fi - else + elif [ "${depstatus}" != "0" ]; then # If dependency is not found. missingdep=1 if [ "${commandname}" == "INSTALL" ]; then echo -e "${red}${deptocheck}${default}" sleep 0.1 fi - # Define required dependencies for SteamCMD. + # If SteamCMD requirements are not met install will fail. if [ -n "${appid}" ]; then - array_steamcmd_deps_required=("${depsteamcmd}") - for steamcmddeptocheck in ${array_steamcmd_deps_required[*]}; do - if [ "${deptocheck}" == "${steamcmddeptocheck}" ]; then + for steamcmddeptocheck in ${array_deps_required_steamcmd[*]}; do + if [ "${deptocheck}" != "steamcmd" ]&&[ "${deptocheck}" == "${steamcmddeptocheck}" ]; then steamcmdfail=1 fi done @@ -298,13 +312,6 @@ fi info_distro.sh -# some RHEL based distros use 8.4 instead of just 8. -if [[ "${distroidlike}" == *"rhel"* ]]||[ "${distroid}" == "rhel" ]; then - distroversioncsv="${distroversionrh}" -else - distroversioncsv="${distroversion}" -fi - if [ ! -f "${tmpdir}/dependency-no-check.tmp" ]&&[ ! -f "${datadir}/${distroid}-${distroversioncsv}.csv" ]; then # Check that the disto dependency csv file exists. fn_check_file_github "lgsm/data" "${distroid}-${distroversioncsv}.csv" @@ -323,6 +330,7 @@ if [ -f "${datadir}/${distroid}-${distroversioncsv}.csv" ]; then array_deps_missing=() array_deps_required=("${depall} ${depsteamcmd} ${depshortname}") + array_deps_required_steamcmd=("${depsteamcmd}") fn_deps_email # Unique sort dependency array. IFS=" " read -r -a array_deps_required <<< "$(echo "${array_deps_required[@]}" | tr ' ' '\n' | sort -u | tr '\n' ' ')" diff --git a/lgsm/functions/command_update_linuxgsm.sh b/lgsm/functions/command_update_linuxgsm.sh index 4027c1e6d8..e7b70f3274 100755 --- a/lgsm/functions/command_update_linuxgsm.sh +++ b/lgsm/functions/command_update_linuxgsm.sh @@ -11,6 +11,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_firstcommand_set check.sh +info_distro.sh fn_print_dots "" fn_script_log_info "Updating LinuxGSM" @@ -146,6 +147,38 @@ else fn_script_log_pass "Checking ${remotereponame} config _default.cfg" fi +# Check distro csv. ${datadir}/${distroid}-${distroversioncsv}.csv +if [ -f "${datadir}/${distroid}-${distroversioncsv}.csv" ]; then + echo -en "checking ${remotereponame} config ${distroid}-${distroversioncsv}.csv...\c" + fn_script_log_info "Checking ${remotereponame} ${distroid}-${distroversioncsv}.csv" + if [ "${remotereponame}" == "GitHub" ]; then + curl --connect-timeout 10 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/${distroid}-${distroversioncsv}.csv" 1>/dev/null + else + curl --connect-timeout 10 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/lgsm/data/${distroid}-${distroversioncsv}.csv" 1>/dev/null + fi + if [ $? != "0" ]; then + fn_print_fail_eol_nl + fn_script_log_fatal "Checking ${remotereponame} ${distroid}-${distroversioncsv}.csv" + fn_script_log_fatal "Curl returned error: $?" + core_exit.sh + fi + + if [ "${remotereponame}" == "GitHub" ]; then + config_file_diff=$(diff "${datadir}/${distroid}-${distroversioncsv}.csv" <(curl --connect-timeout 10 -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/${distroid}-${distroversioncsv}.csv")) + else + config_file_diff=$(diff "${datadir}/${distroid}-${distroversioncsv}.csv" <(curl --connect-timeout 10 -s "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/lgsm/data/${distroid}-${distroversioncsv}.csv")) + fi + + if [ "${config_file_diff}" != "" ]; then + fn_print_update_eol_nl + fn_script_log_update "Checking ${remotereponame} ${distroid}-${distroversioncsv}.csv" + rm -f "${datadir:?}/${distroid}-${distroversioncsv}.csv" + fn_fetch_file_github "lgsm/data" "${distroid}-${distroversioncsv}.csv" "${datadir}" "nochmodx" "norun" "noforce" "nohash" + else + fn_print_ok_eol_nl + fn_script_log_pass "Checking ${remotereponame} ${distroid}-${distroversioncsv}.csv" + fi +fi # Check and update modules. if [ -n "${functionsdir}" ]; then if [ -d "${functionsdir}" ]; then diff --git a/lgsm/functions/info_distro.sh b/lgsm/functions/info_distro.sh index dcde3ba7e4..d8f5dfaca3 100755 --- a/lgsm/functions/info_distro.sh +++ b/lgsm/functions/info_distro.sh @@ -73,6 +73,13 @@ for distro_info in "${distro_info_array[@]}"; do fi done +# some RHEL based distros use 8.4 instead of just 8. +if [[ "${distroidlike}" == *"rhel"* ]]||[ "${distroid}" == "rhel" ]; then + distroversioncsv="${distroversionrh}" +else + distroversioncsv="${distroversion}" +fi + ## Glibc version # e.g: 1.17 glibcversion="$(ldd --version | sed -n '1s/.* //p')"