~ working on custom args
This commit is contained in:
parent
a67dc17a6f
commit
6d3a8fff6c
@ -4,6 +4,7 @@ EXPOSE 27015/udp 27015/tcp
|
||||
|
||||
ENV STEAM_PATH="/home/steam" \
|
||||
SERVER_PATH="/home/steam/serverfiles" \
|
||||
STEAM_CMD="/home/steam/steamcmd" \
|
||||
GROUP_ID=10000 \
|
||||
USER_ID=10000 \
|
||||
DOCKER_USER=steam \
|
||||
@ -24,7 +25,7 @@ ENV STEAM_PATH="/home/steam" \
|
||||
|
||||
ENTRYPOINT ["./home/entrypoint.sh"]
|
||||
|
||||
COPY ["entrypoint.sh", "/home/"]
|
||||
COPY ["entrypoint.sh", "experimental.sh", "forceWorkshopDownload.sh", "installAndMountAddons.sh", "/home/"]
|
||||
|
||||
# removed dep. lib32gcc1 libtcmalloc-minimal4:i386 gdb
|
||||
RUN dpkg --add-architecture i386 && \
|
||||
@ -38,6 +39,9 @@ RUN dpkg --add-architecture i386 && \
|
||||
sudo -u "$DOCKER_USER" mkdir -p "$SERVER_PATH" && \
|
||||
chown -R "$DOCKER_USER:$DOCKER_USER" "$STEAM_PATH" && \
|
||||
chmod a=rx /home/entrypoint.sh && \
|
||||
chmod a=rx /home/experimental.sh && \
|
||||
chmod a=rx /home/forceWorkshopDownload.sh && \
|
||||
chmod a=rx /home/installAndMountAddons.sh && \
|
||||
\
|
||||
ulimit -n 2048 && \
|
||||
locale-gen en_US.UTF-8 && \
|
||||
|
@ -4,15 +4,12 @@ sleep 5s
|
||||
echo "starting entrypoint.sh"
|
||||
set -e
|
||||
|
||||
|
||||
|
||||
cd "$STEAM_PATH"
|
||||
|
||||
parms="-game garrysmod +gamemode terrortown "$(printf "%s " "$@")
|
||||
#suggested -disableluarefresh -tickrate 66 +host_workshop_collection -port 27015
|
||||
export parms="-game garrysmod +gamemode terrortown "$(printf "%s " "$@")
|
||||
#not needed I think: sed -i 's/parms=/#parms=/g' /home/steam/lgsm/config-lgsm/gmodserver/common.cfg
|
||||
echo "starting with $parms"
|
||||
|
||||
ls -lA
|
||||
|
||||
if [ -e "${STEAM_PATH}/gmodserver" ]; then
|
||||
./gmodserver update-lgsm
|
||||
./gmodserver update
|
||||
@ -21,6 +18,14 @@ else
|
||||
./gmodserver auto-install
|
||||
fi
|
||||
|
||||
cd "/home"
|
||||
echo "check various options"
|
||||
./experimental.sh
|
||||
echo "force workshop download"
|
||||
./forceWorkshopDownload.sh
|
||||
echo "install & mount gamefiles"
|
||||
./installAndMountAddons.sh
|
||||
cd "$STEAM_PATH"
|
||||
|
||||
trap './home/steam/gmodserver stop' SIGTERM
|
||||
./gmodserver start
|
||||
|
21
experimental.sh
Normal file
21
experimental.sh
Normal file
@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
|
||||
|
||||
#create default server.config
|
||||
#TODO || [ cat "${SERVER_PATH}/garrysmod/cfg/server.cfg" ] check if empty (only whitespaces)
|
||||
#TODO don't miss to change to master!
|
||||
# not empty: grep -q '[^[:space:]]' < 'server.cfg' && echo "not empty"
|
||||
if [ ! -e "${SERVER_PATH}/garrysmod/cfg/server.cfg" ] || [ "0" = "$(grep -o '[^[:space:]]' "${SERVER_PATH}/garrysmod/cfg/server.cfg" | wc -l)" ]; then
|
||||
mkdir -p "${SERVER_PATH}/garrysmod/cfg"
|
||||
wget -O "${SERVER_PATH}/garrysmod/cfg/server.cfg" "https://raw.githubusercontent.com/jusito/docker-ttt/develop/server.cfg"
|
||||
fi
|
||||
|
||||
#this is a simple option for myself, but you can use it too
|
||||
if [ "$USE_MY_REPLACER_CONFIG" = "true" ]; then
|
||||
mkdir -p "${SERVER_PATH}/garrysmod/data/jusito_ttt_entity_replace"
|
||||
wget -O "${SERVER_PATH}/garrysmod/data/jusito_ttt_entity_replace/config.txt" "https://raw.githubusercontent.com/jusito/ttt_entity_replace/master/config.txt.example_fas2"
|
||||
fi
|
||||
|
28
forceWorkshopDownload.sh
Normal file
28
forceWorkshopDownload.sh
Normal file
@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
#using WORKSHOP_COLLECTION_ID
|
||||
LUA_PATH="${SERVER_PATH}/garrysmod/lua/autorun/server"
|
||||
LUA_FILE="${LUA_PATH}/workshop_autoload.lua"
|
||||
|
||||
#remove old file
|
||||
if [ -e "$LUA_FILE" ]; then
|
||||
rm "$LUA_FILE"
|
||||
else
|
||||
mkdir -p "$LUA_PATH"
|
||||
fi
|
||||
|
||||
if [ "$WORKSHOP_COLLECTION_ID" = "0" ] || [ "$WORKSHOP_COLLECTION_ID" = "" ]; then
|
||||
echo "given ID is default, no workshop download"
|
||||
else
|
||||
touch "$LUA_FILE"
|
||||
arr="$(wget -q -O - https://steamcommunity.com/sharedfiles/filedetails/?id=${WORKSHOP_COLLECTION_ID} | tr '\n' ' ' | grep -Po '"workshopItem"[^"]+"https://steamcommunity.com/sharedfiles/filedetails/\?id=(\d+)' | grep -Po '\d\d\d+' )"
|
||||
str=""
|
||||
for i in ${arr[@]}
|
||||
do
|
||||
str=${str}"resource.AddWorkshop( \"${i}\" )"$'\n'
|
||||
done
|
||||
echo "$str" > "$LUA_FILE"
|
||||
fi
|
||||
|
139
garrysmod.cfg
Normal file
139
garrysmod.cfg
Normal file
@ -0,0 +1,139 @@
|
||||
#### Server Settings ####
|
||||
|
||||
## Server Start Settings | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters
|
||||
ip="0.0.0.0"
|
||||
port="27015"
|
||||
clientport="27005"
|
||||
sourcetvport="27020"
|
||||
defaultmap="gm_construct"
|
||||
maxplayers="16"
|
||||
tickrate="66"
|
||||
gamemode="sandbox"
|
||||
|
||||
## Workshop Parameters | https://wiki.garrysmod.com/page/Workshop_for_Dedicated_Servers
|
||||
# To get an API key visit - https://steamcommunity.com/dev/apikey
|
||||
wsapikey=""
|
||||
wscollectionid=""
|
||||
|
||||
## Custom Start Parameters
|
||||
# Default -disableluarefresh, disables lua autorefresh reducing server lag. Auto refresh only useful for developers.
|
||||
customparms="-disableluarefresh"
|
||||
|
||||
## Optional: Game Server Login Token
|
||||
# GSLT can be used for running a public server.
|
||||
# More info: https://linuxgsm.com/gslt
|
||||
gslt=""
|
||||
|
||||
## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
|
||||
fn_parms(){
|
||||
parms="-game garrysmod -strictportbind -ip ${ip} -port ${port} -tickrate ${tickrate} +host_workshop_collection ${wscollectionid} -authkey ${wsapikey} +clientport ${clientport} +tv_port ${sourcetvport} +gamemode ${gamemode} +map ${defaultmap} +sv_setsteamaccount ${gslt} +servercfgfile ${servercfg} -maxplayers ${maxplayers} ${customparms}"
|
||||
}
|
||||
|
||||
#### LinuxGSM Settings ####
|
||||
|
||||
## Notification Alerts
|
||||
# (on|off)
|
||||
|
||||
# More info | https://github.com/GameServerManagers/LinuxGSM/wiki/Alerts#more-info
|
||||
postalert="off"
|
||||
postdays="7"
|
||||
posttarget="https://hastebin.com"
|
||||
|
||||
# Discord Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Discord
|
||||
discordalert="off"
|
||||
discordwebhook="webhook"
|
||||
|
||||
# Email Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Email
|
||||
emailalert="off"
|
||||
email="email@example.com"
|
||||
emailfrom=""
|
||||
|
||||
# IFTTT Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/IFTTT
|
||||
iftttalert="off"
|
||||
ifttttoken="accesstoken"
|
||||
iftttevent="linuxgsm_alert"
|
||||
|
||||
# Mailgun Email Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/mailgun
|
||||
mailgunalert="off"
|
||||
mailguntoken="accesstoken"
|
||||
mailgundomain="example.com"
|
||||
mailgunemailfrom="alert@example.com"
|
||||
mailgunemail="email@myemail.com"
|
||||
|
||||
# Pushbullet Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Pushbullet
|
||||
pushbulletalert="off"
|
||||
pushbullettoken="accesstoken"
|
||||
channeltag=""
|
||||
|
||||
# Pushover Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Pushover
|
||||
pushoveralert="off"
|
||||
pushovertoken="accesstoken"
|
||||
|
||||
# Telegram Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Telegram
|
||||
# You can add a custom cURL string eg proxy (useful in Russia) or else in "curlcustomstring".
|
||||
# like a "--socks5 ipaddr:port" for socks5 proxy see more in "curl --help", if you not need
|
||||
# any custom string in curl - simple ignore this parameter.
|
||||
telegramalert="off"
|
||||
telegramtoken="accesstoken"
|
||||
telegramchatid=""
|
||||
curlcustomstring=""
|
||||
|
||||
## Updating | https://github.com/GameServerManagers/LinuxGSM/wiki/Update
|
||||
updateonstart="off"
|
||||
|
||||
## Backup | https://github.com/GameServerManagers/LinuxGSM/wiki/Backup
|
||||
maxbackups="4"
|
||||
maxbackupdays="30"
|
||||
stoponbackup="on"
|
||||
|
||||
## Logging | https://github.com/GameServerManagers/LinuxGSM/wiki/Logging
|
||||
consolelogging="on"
|
||||
logdays="7"
|
||||
|
||||
#### LinuxGSM Advanced Settings ####
|
||||
|
||||
# ANSI Colors
|
||||
ansi="on"
|
||||
|
||||
## SteamCMD Settings
|
||||
# Server appid
|
||||
appid="4020"
|
||||
# Steam App Branch Select
|
||||
# Allows to opt into the various Steam app branches. Default branch is "".
|
||||
# Example: "-beta latest_experimental"
|
||||
branch=""
|
||||
|
||||
## LinuxGSM Server Details
|
||||
# Do not edit
|
||||
gamename="Garry's Mod"
|
||||
engine="source"
|
||||
|
||||
#### Directories ####
|
||||
# Edit with care
|
||||
|
||||
## Server Specific Directories
|
||||
systemdir="${serverfiles}/garrysmod"
|
||||
addonsdir="${systemdir}/addons"
|
||||
executabledir="${serverfiles}"
|
||||
executable="./srcds_run"
|
||||
servercfg="${servicename}.cfg"
|
||||
servercfgdefault="server.cfg"
|
||||
servercfgdir="${systemdir}/cfg"
|
||||
servercfgfullpath="${servercfgdir}/${servercfg}"
|
||||
|
||||
## Backup Directory
|
||||
backupdir="${rootdir}/backups"
|
||||
|
||||
## Logging Directories
|
||||
logdir="${rootdir}/log"
|
||||
gamelogdir="${systemdir}/logs"
|
||||
lgsmlogdir="${logdir}/script"
|
||||
consolelogdir="${logdir}/console"
|
||||
lgsmlog="${lgsmlogdir}/${servicename}-script.log"
|
||||
consolelog="${consolelogdir}/${servicename}-console.log"
|
||||
alertlog="${lgsmlogdir}/${servicename}-alert.log"
|
||||
postdetailslog="${lgsmlogdir}/${servicename}-postdetails.log"
|
||||
|
||||
## Logs Naming
|
||||
lgsmlogdate="${lgsmlogdir}/${servicename}-script-$(date '+%Y-%m-%d-%H:%M:%S').log"
|
||||
consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%Y-%m-%d-%H:%M:%S').log"
|
48
installAndMountAddons.sh
Normal file
48
installAndMountAddons.sh
Normal file
@ -0,0 +1,48 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
cd "$STEAM_CMD"
|
||||
mount='"mountcfg"'$'\n{\n'
|
||||
if [ "$INSTALL_CSS" = "true" ]; then
|
||||
echo "installing & mounting css"
|
||||
./steamcmd.sh +login anonymous +force_install_dir "$CSS_PATH" +app_update 232330 validate +quit
|
||||
mount=${mount}' "cstrike" "'"${CSS_PATH}/cstrike"$'"\n'
|
||||
if [ "$INSTALL_HL2" != "true" ]; then
|
||||
mount=${mount}' "hl2" "'"${CSS_PATH}/hl2"$'"\n'
|
||||
fi
|
||||
fi
|
||||
if [ "$INSTALL_HL2" = "true" ]; then
|
||||
echo "installing & mounting hl2"
|
||||
./steamcmd.sh +login anonymous +force_install_dir "$HL2_PATH" +app_update 232370 validate +quit
|
||||
mount=${mount}' "hl2" "'"${HL2_PATH}/hl2"$'"\n'
|
||||
mount=${mount}' "hl2mp" "'"${HL2_PATH}/hl2mp"$'"\n'
|
||||
fi
|
||||
if [ "$INSTALL_TF2" = "true" ]; then
|
||||
echo "installing & mounting tf2"
|
||||
./steamcmd.sh +login anonymous +force_install_dir "$TF2_PATH" +app_update 232250 validate +quit
|
||||
mount=${mount}' "tf2" "'"${TF2_PATH}/tf"$'"\n'
|
||||
if [ "$INSTALL_CSS" != "true" ] && [ "$INSTALL_HL2" != "true" ]; then
|
||||
mount=${mount}' "hl2" "'"${TF2_PATH}/hl2"$'"\n'
|
||||
fi
|
||||
fi
|
||||
if [ "$INSTALL_HLDM" = "true" ]; then
|
||||
echo "installing & mounting hldm"
|
||||
./steamcmd.sh +login anonymous +force_install_dir "$HLDM_PATH" +app_update 255470 validate +quit
|
||||
mount=${mount}' "hl1" "'"${HLDM_PATH}/hl1"$'"\n'
|
||||
mount=${mount}' "hldm" "'"${HLDM_PATH}/hldm"$'"\n'
|
||||
if [ "$INSTALL_CSS" != "true" ] && [ "$INSTALL_HL2" != "true" ] && [ "$INSTALL_TF2" != "true" ]; then
|
||||
mount=${mount}' "hl2" "'"${HLDM_PATH}/hl2"$'"\n'
|
||||
fi
|
||||
fi
|
||||
mount=${mount}$'}\n'
|
||||
|
||||
|
||||
if [ ! -e "${SERVER_PATH}/garrysmod/cfg" ]; then
|
||||
mkdir -p "${SERVER_PATH}/garrysmod/cfg"
|
||||
fi
|
||||
if [ -e "${SERVER_PATH}/garrysmod/cfg/mount.cfg" ]; then
|
||||
rm "${SERVER_PATH}/garrysmod/cfg/mount.cfg"
|
||||
fi
|
||||
touch "${SERVER_PATH}/garrysmod/cfg/mount.cfg"
|
||||
echo "$mount" > "${SERVER_PATH}/garrysmod/cfg/mount.cfg"
|
||||
|
Loading…
Reference in New Issue
Block a user