Add new file
This commit is contained in:
parent
39802ce09e
commit
807aa645ac
77
start.sh
Normal file
77
start.sh
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
STEAM_VOLUME="/home/arma3"
|
||||||
|
STEAMCMD="$STEAM_VOLUME/steamcmd"
|
||||||
|
ARMA3_INST="$STEAMCMD/arma3_inst.txt"
|
||||||
|
WGET_BIN=$(command -v wget)
|
||||||
|
TAR_BIN=$(command -v tar)
|
||||||
|
|
||||||
|
if [ ! -d "$STEAMCMD" ]; then
|
||||||
|
mkdir -p $STEAMCMD/arma3
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -z $STEAM_GUARD_CODE ]; then
|
||||||
|
SGC="set_steam_guard_code $STEAM_GUARD_CODE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
cat << EOF > $STEAMCMD/arma3_inst.txt
|
||||||
|
// installing arma3
|
||||||
|
@ShutdownOnFailedCommand 1 //set to 0 if updating multiple servers at once
|
||||||
|
@NoPromptForPassword 1
|
||||||
|
$SGC
|
||||||
|
login $STEAM_LOGIN $STEAM_PASSWORD
|
||||||
|
force_install_dir ./arma3/
|
||||||
|
app_update 233780 -beta validate
|
||||||
|
quit
|
||||||
|
EOF
|
||||||
|
|
||||||
|
$WGET_BIN -O /tmp/steamcmd_linux.tar.gz https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz
|
||||||
|
$TAR_BIN --overwrite -xvzf /tmp/steamcmd_linux.tar.gz -C $STEAMCMD
|
||||||
|
|
||||||
|
if [ ! -z ${ARMA3_UPDATE_DATA+x} ] || [ ! -f $STEAMCMD/arma3/server.cfg ]; then
|
||||||
|
$STEAMCMD/steamcmd.sh +runscript $ARMA3_INST
|
||||||
|
mkdir -p $HOME/".local/share/Arma 3"
|
||||||
|
mkdir -p $HOME/".local/share/Arma 3 - Other Profiles"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z ${ARMA3_SERVER_CFG+x} ]; then
|
||||||
|
echo "Using the default server.cfg..."
|
||||||
|
cp /tmp/server.cfg $STEAMCMD/arma3/server.cfg
|
||||||
|
else
|
||||||
|
echo "Using custom server.cfg..."
|
||||||
|
$WGET_BIN -O $STEAMCMD/arma3/server.cfg $ARMA3_SERVER_CFG
|
||||||
|
local STATUS=$?
|
||||||
|
if [ $STATUS -ne 0 ]; then
|
||||||
|
echo "Unable to fetch server.cfg from remote, falling back to default server.cfg..."
|
||||||
|
cp /tmp/server.cfg $STEAMCMD/arma3/server.cfg
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -z ${SERVER_UPDATE_PASSWORD+x} ]; then
|
||||||
|
ADMIN_PASSWORD=$(cat /dev/urandom| tr -dc 'a-zA-Z0-9!#' | fold -w 15 | head -1)
|
||||||
|
SERVER_COMMAND_PASSWORD=$(cat /dev/urandom| tr -dc 'a-zA-Z0-9!#' | fold -w 15 | head -1)
|
||||||
|
sed -i "s/passwordAdmin.*/passwordAdmin = \"$ADMIN_PASSWORD\";/g" $STEAMCMD/arma3/server.cfg
|
||||||
|
sed -i "s/serverCommandPassword.*/serverCommandPassword = \"$SERVER_COMMAND_PASSWORD\";/g" $STEAMCMD/arma3/server.cfg
|
||||||
|
else
|
||||||
|
ADMIN_PASSWORD=$(grep passwordAdmin $STEAMCMD/arma3/server.cfg | cut -f2 -d'"')
|
||||||
|
SERVER_COMMAND_PASSWORD=$(grep serverCommandPassword $STEAMCMD/arma3/server.cfg | cut -f2 -d'"')
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "admin password: $ADMIN_PASSWORD"
|
||||||
|
echo "server command password: $SERVER_COMMAND_PASSWORD"
|
||||||
|
|
||||||
|
#######################################################
|
||||||
|
# This is the mod specific part. Anyone can overwrite
|
||||||
|
# This file to configure a specific mod in top of this
|
||||||
|
# Arma3 Docker image.
|
||||||
|
# You just need to define $MOD_SCRIPT when running and
|
||||||
|
# add it to the image build.
|
||||||
|
|
||||||
|
if [ ! -z ${MOD_SCRIPT+x} ] && [ -f $MOD_SCRIPT ]; then
|
||||||
|
echo "Launching $MOD_SCRIPT to setup mod for this instance"
|
||||||
|
/bin/bash $MOD_SCRIPT
|
||||||
|
#######################################################
|
||||||
|
else
|
||||||
|
cd $STEAMCMD/arma3/ && ./arma3server -name=public -config=server.cfg -mod="@rhsafrf;@rhsusaf;@rhsgref;"
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user