Skip to content

Commit

Permalink
Merge pull request #604 from FezVrasta/1.6-dev-rc
Browse files Browse the repository at this point in the history
Release ARK Server Tools v1.6
  • Loading branch information
FezVrasta authored Sep 17, 2016
2 parents 6d0af94 + 69aced9 commit 7636f0a
Show file tree
Hide file tree
Showing 6 changed files with 1,475 additions and 463 deletions.
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.5
1.6
155 changes: 150 additions & 5 deletions README.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ Instanceless commands
`useconfig`::
Legacy command for specifying an instance for the following command(s)

`remove-mods`::
Remove the specified mods from the `steamcmd` workshop directory

Commands acting on instances
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand All @@ -146,12 +149,20 @@ instances.
`--noautoupdate`;;
Disables automatic updating on startup if it is enabled

`--alwaysrestart`;;
Enable automatically restarting the server even if it crashes
without becoming ready for player connections.


`stop`::
Stops the server if it is running

`--warn`;;
Warns any connected players that the server is going down

`--warnreason`;;
Gives a reason for the shutdown. Defaults to `maintenance`

`--saveworld`;;
Saves the world using `saveworld` - usually not
necessary, as server usually saves the world on a graceful
Expand All @@ -161,6 +172,9 @@ instances.
Runs the `stop` command followed by the `restart` command.
Accepts and passes the options for those commands

`--warnreason`;;
Gives a reason for the restart. Defaults to `a restart`

`install`::
Downloads and installs (or validates an existing install) of
the ARK server
Expand Down Expand Up @@ -205,21 +219,51 @@ instances.
Downloads the update but does not apply it. Only has effect
if a staging directory is set.

`cancelshutdown`::
Cancels a pending update / shutdown / restart that was run with
the `--warn` option

`checkupdate`::
Checks if an ARK server update is available

`installmod <modnum>`::
Installs the specified mod into the `ShooterGame/Content/Mods`
`installmods`::
Installs all mods specified in the instance config into the
`ShooterGame/Content/Mods` directory

`uninstallmods`::
Deletes all mods from the `ShooterGame/Content/Mods` directory

`installmod <modnum>[,<modnum>[,...]]`::
Installs the specified mods into the `ShooterGame/Content/Mods`
directory

`uninstallmod <modnum>`::
Deletes the specified mod from the `ShooterGame/Content/Mods`
`uninstallmod <modnum>[,<modnum>[,...]]`::
Deletes the specified mods from the `ShooterGame/Content/Mods`
directory

`reinstallmod <modnum>`::
`removemod <modnum>[,<modnum>[,...]]`::
Deletes the specified mods from the SteamCMD workshop directory

`reinstallmod <modnum>[,<modnum>[,...]]`::
Runs the `uninstallmod` command followed by the `installmod`
command

`enablemod <modnum>`::
`enablemod <modnum>=<modtype>`::
Enables the `arkmod_<modnum>` setting in the instance config.
modtype defaults to `game`.
Mod types:

`game`;;
A mod in `GameModIds`

`map`;;
The `MapModId` mod

`tc`;;
`totalconversion`;;
The `TotalConversionMod` mod

`backup`::
Backs up the saved world and game config files to a compressed
tar file in the backups directory specified in the config
Expand All @@ -238,6 +282,46 @@ instances.
`status`::
Prints the status of the ARK server

`install-cronjob <command>`::
Installs a cron job that executes the specified command.
This accepts any of the options the specified command accepts,
as well as the following options. In order to specify an
argument to the command (e.g. to the `broadcast` command),
use the `--arg=<arg>` option.
Please read your `man 5 crontab` manpage to determine what
minute and hour values are valid, as some implementations
may not accept e.g. the `*/n` minute / hour specification.

`--daily`;;
The command should be executed daily

`--hourly`;;
The command should be executed hourly

`--hour=<hour>`;;
Specifies one or more hours when the command should execute.
This is the hour field of the cron job.
If you want to have the command execute every n hours, then
use `--hour='*/n'`
Default: `*` (i.e. all hours)

`--minute=<minute>`;;
Specifies one or more minutes of the hour when the command
should execute. This is the minute field of the cron job.
If you want to have the command execute every n minutes,
then use `--minute='*/n'`
Default: `0` (i.e. the first minute of the hour)

`--enable-output`;;
Enables the output from the command - the cron daemon usually
emails this to the user specified in the cron configuration

`--arg=<arg>`;;
Specifies an argument to pass to the command

`remove-cronjob <command>`::
Removes a cron job previously installed by `install-cronjob`

Configuration files
-------------------
Expand Down Expand Up @@ -299,6 +383,12 @@ The following options can be overridden on a per-instance basis:
The relative path within an ARK server install to place the
autorestart lock file
`arkAlwaysRestartOnCrash`::
Set to `true` to enable automatically restarting even when the
server has not become ready for player connections.
Be aware that this may cause the server to enter an endless
crash-restart loop if the cause of the crash is not resolved.
`arkAutoUpdateOnStart`::
Set to `true` to enable updating before server startup
Expand All @@ -312,6 +402,11 @@ The following options can be overridden on a per-instance basis:
`arkMaxBackupSizeMB`::
Limits the size of the stored backups
`arkPriorityBoost`::
Attempts to boost the priority of the ARK server.
Negative values give a higher priority, and positive values give a lower priority.
Requires `sudo` and `renice`
`msgWarnUpdateMinutes`::
`msgWarnUpdateSeconds`::
`msgWarnRestartMinutes`::
Expand All @@ -321,6 +416,32 @@ The following options can be overridden on a per-instance basis:
Templated messages for warnings, where `%d` is replaced with the
number of minutes / seconds before the update / restart / shutdown
`msgWarnReason`::
`msgTimeMinutes`::
`msgTimeSeconds`::
`msgReasonUpdateApp`::
`msgReasonUpdateMod`::
`msgReasonUpdateAppMod`::
`msgReasonRestart`::
`msgReasonShutdown`::
Alternative templated messages for warnings with the following
replacement parameters:
`{reason}`;;
Valid in `msgWarnReason`, replaced at runtime with the appropriate `msgReason*` template
`{time}`;;
Valid in `msgWarnReason` and `msgReason*`, replaced at runtime with the appropriate `msgTime*` template
`{modnamesupdated}`;;
Valid in `msgReason*Mod`, replaced at runtime with a comma-delimited list of updated mod names
`{minutes}`;;
Valid in `msgTimeMinutes`, replaced at runtime with minutes remaining until shutdown
`{seconds}`;;
Valid in `msgTimeSeconds`, replaced at runtime with seconds remaining until shutdown
`logdir`::
Specifies where to store log files
Expand Down Expand Up @@ -401,6 +522,30 @@ the global config.
the `-StructureDestructionTag=DestroySwampSnowStructures`
option.
`arkmod_<modnum>=<modtype>`::
Specifies a mod that can be enabled or disabled using
`enablemod` and `disablemod`. Note that mod ids specified
using these options are in addition to those specified directly
in the `ark_GameModIds` option, and override those specified in the
`ark_MapModId`, `serverMapMod` and `ark_TotalConversionMod`
options. Options are processed in the order they are specified
in the instance config file, and `arkmod_*` options in the
common config file are not applied.
Mod types:
`game`;;
A mod to be specified in `GameModIds`
`map`;;
The mod to be specified in `MapModId`
`tc`;;
`totalconversion`;;
The mod to be specified in `TotalConversionMod`
`disabled`;;
A disabled mod
Common ARK options
~~~~~~~~~~~~~~~~~~
Expand Down
111 changes: 73 additions & 38 deletions netinstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
# Net Installer, used with curl
#

arkstGithubRepo="FezVrasta/ark-server-tools"

steamcmd_user="$1"
channel=${2:-master} # if defined by 2nd argument install the defined version, otherwise install master
shift
Expand All @@ -19,50 +21,83 @@ elif [[ "$1" =~ ^--output= ]]; then
shift
fi

# Download and untar installation files
cd /tmp
COMMIT="`curl -L -k -s https://api.github.com/repos/FezVrasta/ark-server-tools/git/refs/heads/${channel} | sed -n 's/^ *"sha": "\(.*\)",.*/\1/p'`"
unstable=
if [ "$1" = "--unstable" ]; then
unstable=1
fi

if [ -z "$COMMIT" ]; then
if [ "$channel" != "master" ]; then
echo "Channel ${channel} not found - trying master"
channel=master
COMMIT="`curl -L -k -s https://api.github.com/repos/FezVrasta/ark-server-tools/git/refs/heads/${channel} | sed -n 's/^ *"sha": "\(.*\)",.*/\1/p'`"
function doInstallFromCommit(){
local commit="$1"
tmpdir="$(mktemp -t -d "ark-server-tools-XXXXXXXX")"
if [ -z "$tmpdir" ]; then echo "Unable to create temporary directory"; exit 1; fi
cd "$tmpdir"
echo "Downloading installer"
curl -s -L "https://github.com/${arkstGithubRepo}/archive/${commit}.tar.gz" | tar -xz
cd "ark-server-tools-${commit}/tools"
if [ ! -f "install.sh" ]; then echo "install.sh not found in $PWD"; exit 1; fi
sed -i -e "s|^arkstCommit='.*'|arkstCommit='${commit}'|" \
-e "s|^arkstTag='.*'|arkstTag='${tagname}'|" \
arkmanager
echo "Running install.sh"
bash install.sh "$steamcmd_user" "${reinstall_args[@]}"
result=$?
cd /
rm -rf "$tmpdir"

if [ "$result" = 0 ] || [ "$result" = 2 ]; then
echo "ARK Server Tools successfully installed"
else
echo "ARK Server Tools install failed"
fi
fi
return $result
}

if [ -z "$COMMIT" ]; then
echo "Unable to retrieve latest commit"
exit 1
fi
function doInstallFromRelease(){
local tagname=
local desc=

mkdir ark-server-tools-${channel}
cd ark-server-tools-${channel}
curl -L -k -s https://github.com/FezVrasta/ark-server-tools/archive/${COMMIT}.tar.gz | tar xz
echo "Getting latest release..."
# Read the variables from github
while IFS=$'\t' read n v; do
case "${n}" in
tag_name) tagname="${v}"; ;;
body) desc="${v}"
esac
done < <(curl -s "https://api.github.com/repos/${arkstGithubRepo}/releases/latest" | sed -n 's/^ "\([^"]*\)": "*\([^"]*\)"*,*/\1\t\2/p')

# Install ARK Server Tools
cd ark-server-tools-${COMMIT}/tools
sed -i "s|^arkstCommit='.*'$|arkstCommit='${COMMIT}'|" arkmanager
version=`<../.version`
sed -i "s|^arkstVersion=\".*\"|arkstVersion='${version}'|" arkmanager
chmod +x install.sh
bash install.sh "$steamcmd_user" "$@" >"$output" 2>&1
if [ -n "$tagname" ]; then
echo "Latest release is ${tagname}"
echo "Getting commit for latest release..."
local commit="$(curl -s "https://api.github.com/repos/${arkstGithubRepo}/git/refs/tags/${tagname}" | sed -n 's/^ *"sha": "\(.*\)",.*/\1/p')"
doInstallFromCommit "$commit"
else
echo "Unable to get latest release"
return 1
fi
}

status=$?
function doInstallFromBranch(){
channel="$1"
commit="`curl -s "https://api.github.com/repos/${arkstGithubRepo}/git/refs/heads/${channel}" | sed -n 's/^ *"sha": "\(.*\)",.*/\1/p'`"

if [ -z "$commit" ]; then
if [ -n "$unstable" ]; then
echo "Channel ${channel} not found - trying master"
doInstallFromBranch master
else
doInstallFromRelease
fi
else
doInstallFromCommit "$commit"
fi
}

rm -rf /tmp/ark-server-tools-${channel}
# Download and untar installation files
cd "$TEMP"

# Print messages
case "$status" in
"0")
echo "ARK Server Tools were correctly installed in your system inside the home directory of $steamcmd_user!"
;;
if [ "$channel" = "master" ] && [ -z "$unstable" ]; then
doInstallFromRelease
else
doInstallFromBranch "$channel"
fi

"1")
echo "Something went wrong :( Make sure you meet the Prerequisites found in the readme."
;;
"2")
echo "WARNING: A previous version of ARK Server Tools was detected in your system, your old configuration was not overwritten. You may need to manually update it."
echo "ARK Server Tools were correctly installed in your system inside the home directory of $steamcmd_user!"
;;
esac
Loading

0 comments on commit 7636f0a

Please sign in to comment.