Skip to content

Commit

Permalink
Merge branch 'h3o66-refactor/fn-steamclient-so' into develop
Browse files Browse the repository at this point in the history
feat(fix): move steamclient.so fix to a separate function
  • Loading branch information
dgibbs64 committed Sep 20, 2020
2 parents ee515b7 + 6a7ad6d commit 5864379
Show file tree
Hide file tree
Showing 11 changed files with 65 additions and 167 deletions.
15 changes: 0 additions & 15 deletions lgsm/functions/core_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -330,11 +330,6 @@ functionfile="${FUNCNAME[0]}"
fn_fetch_function
}

fix_cs.sh(){
functionfile="${FUNCNAME[0]}"
fn_fetch_function
}

fix_csgo.sh(){
functionfile="${FUNCNAME[0]}"
fn_fetch_function
Expand Down Expand Up @@ -390,11 +385,6 @@ functionfile="${FUNCNAME[0]}"
fn_fetch_function
}

fix_pz.sh(){
functionfile="${FUNCNAME[0]}"
fn_fetch_function
}

fix_ro.sh(){
functionfile="${FUNCNAME[0]}"
fn_fetch_function
Expand Down Expand Up @@ -435,11 +425,6 @@ functionfile="${FUNCNAME[0]}"
fn_fetch_function
}

fix_tu.sh(){
functionfile="${FUNCNAME[0]}"
fn_fetch_function
}

fix_ut3.sh(){
functionfile="${FUNCNAME[0]}"
fn_fetch_function
Expand Down
6 changes: 0 additions & 6 deletions lgsm/functions/fix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ if [ "${commandname}" != "INSTALL" ]&&[ -z "${fixbypass}" ]; then
fix_ark.sh
elif [ "${shortname}" == "bo" ]; then
fix_bo.sh
elif [ "${shortname}" == "cs" ]; then
fix_cs.sh
elif [ "${shortname}" == "csgo" ]; then
fix_csgo.sh
elif [ "${shortname}" == "cmw" ]; then
Expand All @@ -60,8 +58,6 @@ if [ "${commandname}" != "INSTALL" ]&&[ -z "${fixbypass}" ]; then
fix_nmrih.sh
elif [ "${shortname}" == "onset" ]; then
fix_onset.sh
elif [ "${shortname}" == "pz" ]; then
fix_pz.sh
elif [ "${shortname}" == "rust" ]; then
fix_rust.sh
elif [ "${shortname}" == "rw" ]; then
Expand All @@ -84,8 +80,6 @@ if [ "${commandname}" != "INSTALL" ]&&[ -z "${fixbypass}" ]; then
fix_terraria.sh
elif [ "${shortname}" == "ts3" ]; then
fix_ts3.sh
elif [ "${shortname}" == "tu" ]; then
fix_tu.sh
elif [ "${shortname}" == "mcb" ]; then
fix_mcb.sh
elif [ "${shortname}" == "mta" ]; then
Expand Down
26 changes: 0 additions & 26 deletions lgsm/functions/fix_bo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,3 @@
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"

export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${serverfiles}:${serverfiles}/BODS_Data/Plugins/x86_64"

# steamclient.so x86 fix.
if [ ! -f "${serverfiles}/BODS_Data/Plugins/x86/steamclient.so" ]; then
fixname="steamclient.so x86"
fn_fix_msg_start
mkdir -p "${serverfiles}/BODS_Data/Plugins/x86"
if [ -f "${HOME}/.steam/steamcmd/linux32/steamclient.so" ]; then
cp "${HOME}/.steam/steamcmd/linux32/steamclient.so" "${serverfiles}/BODS_Data/Plugins/x86/steamclient.so"
elif [ -f "${steamcmddir}/linux32/steamclient.so" ]; then
cp "${steamcmddir}/linux32/steamclient.so" "${serverfiles}/BODS_Data/Plugins/x86/steamclient.so"
fi
fn_fix_msg_end
fi

# steamclient.so x86_64 fix.
if [ ! -f "${serverfiles}/BODS_Data/Plugins/x86_64/steamclient.so" ]; then
fixname="steamclient.so x86_64"
fn_fix_msg_start
mkdir -p "${serverfiles}/BODS_Data/Plugins/x86_64"
if [ -f "${HOME}/.steam/steamcmd/linux64/steamclient.so" ]; then
cp "${HOME}/.steam/steamcmd/linux64/steamclient.so" "${serverfiles}/BODS_Data/Plugins/x86_64/steamclient.so"
elif [ -f "${steamcmddir}/linux64/steamclient.so" ]; then
cp "${steamcmddir}/linux64/steamclient.so" "${serverfiles}/BODS_Data/Plugins/x86_64/steamclient.so"
fi
fn_fix_msg_end
fi
16 changes: 1 addition & 15 deletions lgsm/functions/fix_cmw.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,13 @@
# Website: https://linuxgsm.com
# Description: Resolves the issue of the not starting server on linux

fixname="steam_appid.txt"

if [ ! -f "${executabledir}/steam_appid.txt" ]; then
fixname="steam_appid.txt"
fn_fix_msg_start
echo 219640 > "${executabledir}/steam_appid.txt"
fn_fix_msg_end
fi

# steamclient.so x86 fix.
if [ ! -f "${executabledir}/lib/steamclient.so" ]; then
fixname="steamclient.so x86"
fn_fix_msg_start
mkdir -p "${executabledir}/lib"
if [ -f "${HOME}/.steam/steamcmd/linux32/steamclient.so" ]; then
cp "${HOME}/.steam/steamcmd/linux32/steamclient.so" "${executabledir}/lib/steamclient.so"
elif [ -f "${steamcmddir}/linux32/steamclient.so" ]; then
cp "${steamcmddir}/linux32/steamclient.so" "${executabledir}/lib/steamclient.so"
fi
fn_fix_msg_end
fi

if [ ! -f "${servercfgfullpath}" ]; then
fn_fix_msg_start
fixname="copy config"
Expand Down
20 changes: 0 additions & 20 deletions lgsm/functions/fix_cs.sh

This file was deleted.

33 changes: 0 additions & 33 deletions lgsm/functions/fix_pz.sh

This file was deleted.

10 changes: 4 additions & 6 deletions lgsm/functions/fix_ss3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"

# Fixes: https://steamcommunity.com/app/41070/discussions/0/353916981477716386/
if [ ! -f "${serverfiles}/Bin/steamclient.so" ]||[ "$(diff "${HOME}/.steam/steamcmd/linux32/steamclient.so" "${serverfiles}/Bin/steamclient.so" 2>/dev/null)" ]; then
fixname="steamclient.so"
fn_fix_msg_start
mkdir -p "${serverfiles}/Bin"
cp -f "${HOME}/.steam/steamcmd/linux32/steamclient.so" "${serverfiles}/Bin/steamclient.so"
fn_fix_msg_end
if [ -f "${serverfiles}/Bin/steamclient.so" ] && [ "$(diff "${HOME}/.steam/steamcmd/linux32/steamclient.so" "${serverfiles}/Bin/steamclient.so" 2>/dev/null)" ]; then
# delete old steamclient.so file
rm -f "${serverfiles}/Bin/steamclient.so"
fn_fix_steamclient_so "32" "${serverfiles}/Bin"
fi

# Fixes: .steam/bin32/libsteam.so: cannot open shared object file: No such file or directory
Expand Down
60 changes: 60 additions & 0 deletions lgsm/functions/fix_steamcmd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,45 @@

functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"

# function to simplify the steamclient.so fix
# example
# fn_fix_steamclient_so 32|64 (bit) "${serverfiles}/linux32/"
fn_fix_steamclient_so(){
# $1 type of fix 32 or 64 as possible values
# $2 as destination where the lib will be copied to
if [ "$1" == "32" ]; then
# steamclient.so x86 fix.
if [ ! -f "${2}/steamclient.so" ]; then
fixname="steamclient.so x86"
fn_fix_msg_start
if [ ! -d "${2}" ]; then
mkdir -p "${2}"
fi
if [ -f "${HOME}/.steam/steamcmd/linux32/steamclient.so" ]; then
cp "${HOME}/.steam/steamcmd/linux32/steamclient.so" "${2}/steamclient.so"
elif [ -f "${steamcmddir}/linux32/steamclient.so" ]; then
cp "${steamcmddir}/linux32/steamclient.so" "${2}/steamclient.so"
fi
fn_fix_msg_end
fi
elif [ "$1" == "64" ]; then
# steamclient.so x86_64 fix.
if [ ! -f "${2}/steamclient.so" ]; then
fixname="steamclient.so x86_64"
fn_fix_msg_start
if [ ! -d "${2}" ]; then
mkdir -p "${2}"
fi
if [ -f "${HOME}/.steam/steamcmd/linux64/steamclient.so" ]; then
cp "${HOME}/.steam/steamcmd/linux64/steamclient.so" "${2}/steamclient.so"
elif [ -f "${steamcmddir}/linux64/steamclient.so" ]; then
cp "${steamcmddir}/linux64/steamclient.so" "${2}/steamclient.so"
fi
fn_fix_msg_end
fi
fi
}

# Helps fix: [S_API FAIL] SteamAPI_Init() failed; unable to locate a running instance of Steam,or a local steamclient.so.
if [ ! -f "${HOME}/.steam/sdk64/steamclient.so" ]; then
fixname="steamclient.so sdk64"
Expand All @@ -31,3 +70,24 @@ if [ ! -f "${HOME}/.steam/sdk32/steamclient.so" ]; then
fi
fn_fix_msg_end
fi

# steamclient.so fixes
if [ "${shortname}" == "bo" ]; then
fn_fix_steamclient_so "32" "${serverfiles}/BODS_Data/Plugins/x86"
fn_fix_steamclient_so "64" "${serverfiles}/BODS_Data/Plugins/x86_64"
elif [ "${shortname}" == "cmw" ]; then
fn_fix_steamclient_so "32" "${executabledir}/lib"
elif [ "${shortname}" == "cs" ]; then
fn_fix_steamclient_so "32" "${serverfiles}"
elif [ "${shortname}" == "pz" ]; then
fn_fix_steamclient_so "32" "${serverfiles}/linux32"
fn_fix_steamclient_so "64" "${serverfiles}/linux64"
elif [ "${shortname}" == "ss3" ]; then
fn_fix_steamclient_so "32" "${serverfiles}/Bin"
elif [ "${shortname}" == "tu" ];then
fn_fix_steamclient_so "64" "${executabledir}"
elif [ "${shortname}" == "unt" ]; then
fn_fix_steamclient_so "64" "${serverfiles}"
elif [ "${shortname}" == "wurm" ]; then
fn_fix_steamclient_so "64" "${serverfiles}/nativelibs"
fi
20 changes: 0 additions & 20 deletions lgsm/functions/fix_tu.sh

This file was deleted.

13 changes: 0 additions & 13 deletions lgsm/functions/fix_unt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,3 @@
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"

export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${serverfiles}:${serverfiles}/Unturned_Headless_Data/Plugins/x86_64"

# steamclient.so x86_64 fix.
if [ ! -f "${serverfiles}/steamclient.so" ]; then
fixname="steamclient.so x86_64"
fn_fix_msg_start
mkdir -p "${serverfiles}"
if [ -f "${HOME}/.steam/steamcmd/linux64/steamclient.so" ]; then
cp "${HOME}/.steam/steamcmd/linux64/steamclient.so" "${serverfiles}/steamclient.so"
elif [ -f "${steamcmddir}/linux64/steamclient.so" ]; then
cp "${steamcmddir}/linux64/steamclient.so" "${serverfiles}/steamclient.so"
fi
fn_fix_msg_end
fi
13 changes: 0 additions & 13 deletions lgsm/functions/fix_wurm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,6 @@

functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"

# steamclient.so x86_64 fix.
if [ ! -f "${serverfiles}/nativelibs/steamclient.so" ]; then
fixname="steamclient.so x86_64"
fn_fix_msg_start
mkdir -p "${serverfiles}/nativelibs"
if [ -f "${HOME}/.steam/steamcmd/linux64/steamclient.so" ]; then
cp "${HOME}/.steam/steamcmd/linux64/steamclient.so" "${serverfiles}/nativelibs/steamclient.so"
elif [ -f "${steamcmddir}/linux64/steamclient.so" ]; then
cp "${steamcmddir}/linux64/steamclient.so" "${serverfiles}/nativelibs/steamclient.so"
fi
fn_fix_msg_end
fi

# First run requires start with no parms.
# After first run new dirs are created.
if [ ! -d "${serverfiles}/Creative" ]; then
Expand Down

0 comments on commit 5864379

Please sign in to comment.