|
6 | 6 |
|
7 | 7 | functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" |
8 | 8 |
|
9 | | -fn_install_steamcmd(){ |
10 | | - if [ "${shortname}" == "ark" ]&&[ "${installsteamcmd}" == "1" ]; then |
11 | | - steamcmddir="${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux" |
12 | | - fi |
13 | | - if [ ! -d "${steamcmddir}" ]; then |
14 | | - mkdir -p "${steamcmddir}" |
15 | | - fi |
16 | | - remote_fileurl="${1}" |
17 | | - remote_fileurl_backup="${2}" |
18 | | - remote_fileurl_name="${3}" |
19 | | - remote_fileurl_backup_name="${4}" |
20 | | - local_filedir="${5}" |
21 | | - local_filename="${6}" |
22 | | - chmodx="${7:-0}" |
23 | | - run="${8:-0}" |
24 | | - forcedl="${9:-0}" |
25 | | - md5="${10:-0}" |
26 | | - fn_fetch_file "http://media.steampowered.com/client/steamcmd_linux.tar.gz" "" "" "" "${tmpdir}" "steamcmd_linux.tar.gz" "" "norun" "noforce" "nomd5" |
27 | | - fn_dl_extract "${tmpdir}" "steamcmd_linux.tar.gz" "${steamcmddir}" |
28 | | - chmod +x "${steamcmddir}/steamcmd.sh" |
29 | | -} |
30 | | - |
31 | | -fn_check_steamcmd_user(){ |
32 | | - # Checks if steamuser is setup. |
33 | | - if [ "${steamuser}" == "username" ]; then |
34 | | - fn_print_fail_nl "Steam login not set. Update steamuser in ${configdirserver}" |
35 | | - echo -e " * Change steamuser=\"username\" to a valid steam login." |
36 | | - if [ -d "${lgsmlogdir}" ]; then |
37 | | - fn_script_log_fatal "Steam login not set. Update steamuser in ${configdirserver}" |
38 | | - fi |
39 | | - core_exit.sh |
40 | | - fi |
41 | | - # Anonymous user is set if steamuser is missing. |
42 | | - if [ -z "${steamuser}" ]; then |
43 | | - if [ -d "${lgsmlogdir}" ]; then |
44 | | - fn_script_log_info "Using anonymous Steam login" |
45 | | - fi |
46 | | - steamuser="anonymous" |
47 | | - steampass='' |
48 | | - fi |
49 | | -} |
50 | | - |
51 | | -fn_check_steamcmd(){ |
52 | | - # Checks if SteamCMD exists when starting or updating a server. |
53 | | - # Only install if steamcmd package is missing or steamcmd dir is missing. |
54 | | - if [ ! -f "${steamcmddir}/steamcmd.sh" ]&&[ -z "$(command -v steamcmd 2>/dev/null)" ]; then |
55 | | - if [ "${commandname}" == "INSTALL" ]; then |
56 | | - fn_install_steamcmd |
57 | | - else |
58 | | - fn_print_warn_nl "SteamCMD is missing" |
59 | | - fn_script_log_warn "SteamCMD is missing" |
60 | | - fn_install_steamcmd |
61 | | - fi |
62 | | - elif [ "${commandname}" == "INSTALL" ]; then |
63 | | - fn_print_information "SteamCMD is already installed..." |
64 | | - fn_print_ok_eol_nl |
65 | | - fi |
66 | | -} |
67 | | - |
68 | | -fn_check_steamcmd_dir(){ |
69 | | - # Worksround that pre-installs the correct steam directories to ensure all packages use the correct Standard. |
70 | | - # https://github.com/ValveSoftware/steam-for-linux/issues/6976#issuecomment-610446347 |
71 | | - |
72 | | - # Create Steam installation directory. |
73 | | - if [ ! -d "${XDG_DATA_HOME:="${HOME}/.local/share"}/Steam" ]; then |
74 | | - mkdir -p "${XDG_DATA_HOME:="${HOME}/.local/share"}/Steam" |
75 | | - fi |
76 | | - |
77 | | - # Create common Steam directory. |
78 | | - if [ ! -d "${HOME}/.steam" ]; then |
79 | | - mkdir -p "${HOME}/.steam" |
80 | | - fi |
81 | | - |
82 | | - # Symbolic links to Steam installation directory. |
83 | | - if [ ! -L "${HOME}/.steam/root" ]; then |
84 | | - if [ -d "${HOME}/.steam/root" ]; then |
85 | | - rm "${HOME}/.steam/root" |
86 | | - fi |
87 | | - ln -s "${XDG_DATA_HOME:="${HOME}/.local/share"}/Steam" "${HOME}/.steam/root" |
88 | | - fi |
89 | | - |
90 | | - if [ ! -L "${HOME}/.steam/steam" ]; then |
91 | | - if [ -d "${HOME}/.steam/steam" ]; then |
92 | | - rm -rf "${HOME}/.steam/steam" |
93 | | - fi |
94 | | - ln -s "${XDG_DATA_HOME:="${HOME}/.local/share"}/Steam" "${HOME}/.steam/steam" |
95 | | - fi |
96 | | -} |
97 | | - |
98 | | -fn_check_steamcmd_dir_legacy(){ |
99 | | - # Remove old Steam installation directories ~/Steam and ${rootdir}/steamcmd |
100 | | - if [ -d "${rootdir}/steamcmd" ]&&[ "${steamcmddir}" == "${XDG_DATA_HOME:="${HOME}/.local/share"}/Steam" ]; then |
101 | | - rm -rf "${rootdir:?}/steamcmd" |
102 | | - fi |
103 | | - |
104 | | - if [ -d "${HOME}/Steam" ]&&[ "${steamcmddir}" == "${XDG_DATA_HOME:="${HOME}/.local/share"}/Steam" ]; then |
105 | | - rm -rf "${HOME}/Steam" |
106 | | - fi |
107 | | -} |
108 | | - |
109 | | -fn_check_steamcmd_ark(){ |
110 | | - # Checks if SteamCMD exists in |
111 | | - # Engine/Binaries/ThirdParty/SteamCMD/Linux |
112 | | - # to allow ark mods to work |
113 | | - if [ ! -f "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamcmd.sh" ]; then |
114 | | - installsteamcmd=1 |
115 | | - if [ "${commandname}" == "INSTALL" ]; then |
116 | | - fn_install_steamcmd |
117 | | - else |
118 | | - fn_print_warn_nl "ARK mods SteamCMD is missing" |
119 | | - fn_script_log_warn "ARK mods SteamCMD is missing" |
120 | | - fn_install_steamcmd |
121 | | - fi |
122 | | - elif [ "${commandname}" == "INSTALL" ]; then |
123 | | - fn_print_information "ARK mods SteamCMD is already installed..." |
124 | | - fn_print_ok_eol_nl |
125 | | - fi |
126 | | -} |
127 | | - |
128 | | -fn_check_steamcmd_clear(){ |
129 | | -# Will remove steamcmd dir if steamcmd package is installed. |
130 | | -if [ "$(command -v steamcmd 2>/dev/null)" ]&&[ -d "${rootdir}/steamcmd" ]; then |
131 | | - rm -rf "${steamcmddir:?}" |
132 | | - exitcode=$? |
133 | | - if [ "${exitcode}" != 0 ]; then |
134 | | - fn_script_log_fatal "Removing ${rootdir}/steamcmd" |
135 | | - else |
136 | | - fn_script_log_pass "Removing ${rootdir}/steamcmd" |
137 | | - fi |
138 | | -fi |
139 | | -} |
140 | | - |
141 | | -fn_check_steamcmd_exec(){ |
142 | | - if [ "$(command -v steamcmd 2>/dev/null)" ]; then |
143 | | - steamcmdcommand="steamcmd" |
144 | | - else |
145 | | - steamcmdcommand="./steamcmd.sh" |
146 | | - fi |
147 | | -} |
| 9 | +# init steamcmd functions |
| 10 | +core_steamcmd.sh |
148 | 11 |
|
149 | 12 | fn_check_steamcmd_clear |
150 | 13 | fn_check_steamcmd |
|
0 commit comments