Merge pull request #1 from FezVrasta/master

Rebasing all my stuff to master
This commit is contained in:
AnEmortalKid 2017-01-03 22:51:15 -06:00 committed by GitHub
commit 0a6f036810
10 changed files with 1888 additions and 579 deletions

2
.gitignore vendored
View File

@ -1 +1,3 @@
.DS_Store .DS_Store
.*.sw?
*~

View File

@ -1 +1 @@
1.5 1.6

View File

@ -129,6 +129,9 @@ Instanceless commands
`useconfig`:: `useconfig`::
Legacy command for specifying an instance for the following command(s) 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 Commands acting on instances
~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -146,12 +149,20 @@ instances.
`--noautoupdate`;; `--noautoupdate`;;
Disables automatic updating on startup if it is enabled 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`:: `stop`::
Stops the server if it is running Stops the server if it is running
`--warn`;; `--warn`;;
Warns any connected players that the server is going down Warns any connected players that the server is going down
`--warnreason`;;
Gives a reason for the shutdown. Defaults to `maintenance`
`--saveworld`;; `--saveworld`;;
Saves the world using `saveworld` - usually not Saves the world using `saveworld` - usually not
necessary, as server usually saves the world on a graceful necessary, as server usually saves the world on a graceful
@ -161,6 +172,9 @@ instances.
Runs the `stop` command followed by the `restart` command. Runs the `stop` command followed by the `restart` command.
Accepts and passes the options for those commands Accepts and passes the options for those commands
`--warnreason`;;
Gives a reason for the restart. Defaults to `a restart`
`install`:: `install`::
Downloads and installs (or validates an existing install) of Downloads and installs (or validates an existing install) of
the ARK server the ARK server
@ -205,21 +219,51 @@ instances.
Downloads the update but does not apply it. Only has effect Downloads the update but does not apply it. Only has effect
if a staging directory is set. if a staging directory is set.
`cancelshutdown`::
Cancels a pending update / shutdown / restart that was run with
the `--warn` option
`checkupdate`:: `checkupdate`::
Checks if an ARK server update is available Checks if an ARK server update is available
`installmod <modnum>`:: `installmods`::
Installs the specified mod into the `ShooterGame/Content/Mods` 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 directory
`uninstallmod <modnum>`:: `uninstallmod <modnum>[,<modnum>[,...]]`::
Deletes the specified mod from the `ShooterGame/Content/Mods` Deletes the specified mods from the `ShooterGame/Content/Mods`
directory 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` Runs the `uninstallmod` command followed by the `installmod`
command 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`:: `backup`::
Backs up the saved world and game config files to a compressed Backs up the saved world and game config files to a compressed
tar file in the backups directory specified in the config tar file in the backups directory specified in the config
@ -238,6 +282,46 @@ instances.
`status`:: `status`::
Prints the status of the ARK server 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 Configuration files
------------------- -------------------
@ -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 The relative path within an ARK server install to place the
autorestart lock file 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`:: `arkAutoUpdateOnStart`::
Set to `true` to enable updating before server startup Set to `true` to enable updating before server startup
@ -312,6 +402,16 @@ The following options can be overridden on a per-instance basis:
`arkMaxBackupSizeMB`:: `arkMaxBackupSizeMB`::
Limits the size of the stored backups 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`
`arkCpuAffinity`::
Attempts to set the CPU affinity of the ARK server.
Setting is a comma-delimited list of processor indices on which the server should run.
Requires `sudo` and `taskset`
`msgWarnUpdateMinutes`:: `msgWarnUpdateMinutes`::
`msgWarnUpdateSeconds`:: `msgWarnUpdateSeconds`::
`msgWarnRestartMinutes`:: `msgWarnRestartMinutes`::
@ -321,6 +421,32 @@ The following options can be overridden on a per-instance basis:
Templated messages for warnings, where `%d` is replaced with the Templated messages for warnings, where `%d` is replaced with the
number of minutes / seconds before the update / restart / shutdown 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`:: `logdir`::
Specifies where to store log files Specifies where to store log files
@ -368,7 +494,7 @@ Instance config files
Instance config files are stored under Instance config files are stored under
`/etc/arkmanager/instances/<instancename>.cfg`, `/etc/arkmanager/instances/<instancename>.cfg`,
`~/.local/config/arkmanager/instances/<instancename>.cfg` `~/.config/arkmanager/instances/<instancename>.cfg`
or as specified in the `configfile_<instancename>` options in or as specified in the `configfile_<instancename>` options in
the global config. the global config.
@ -401,6 +527,30 @@ the global config.
the `-StructureDestructionTag=DestroySwampSnowStructures` the `-StructureDestructionTag=DestroySwampSnowStructures`
option. 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 Common ARK options
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~

View File

@ -4,6 +4,8 @@
# Net Installer, used with curl # Net Installer, used with curl
# #
arkstGithubRepo="FezVrasta/ark-server-tools"
steamcmd_user="$1" steamcmd_user="$1"
channel=${2:-master} # if defined by 2nd argument install the defined version, otherwise install master channel=${2:-master} # if defined by 2nd argument install the defined version, otherwise install master
shift shift
@ -19,50 +21,96 @@ elif [[ "$1" =~ ^--output= ]]; then
shift shift
fi fi
# Download and untar installation files unstable=
cd /tmp if [ "$1" = "--unstable" ]; then
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=1
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'`"
fi
fi fi
if [ -z "$COMMIT" ]; then userinstall=
echo "Unable to retrieve latest commit" if [ "$1" = "--perform-user-install" ]; then
userinstall=yes
fi
if [[ "$steamcmd_user" == "--me" && -z "$userinstall" ]]; then
echo "You have requested a user-install. You probably don't want this."
echo "A user-install will create ~/.config/arkmanager/instances/main.cfg"
echo "This config file will override /etc/arkmanager/instances/main.cfg"
echo "Add --perform-user-install if you really want this."
exit 1 exit 1
fi fi
mkdir ark-server-tools-${channel} function doInstallFromCommit(){
cd ark-server-tools-${channel} local commit="$1"
curl -L -k -s https://github.com/FezVrasta/ark-server-tools/archive/${COMMIT}.tar.gz | tar xz 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"
# Install ARK Server Tools if [ "$result" = 0 ] || [ "$result" = 2 ]; then
cd ark-server-tools-${COMMIT}/tools echo "ARK Server Tools successfully installed"
sed -i "s|^arkstCommit='.*'$|arkstCommit='${COMMIT}'|" arkmanager else
version=`<../.version` echo "ARK Server Tools install failed"
sed -i "s|^arkstVersion=\".*\"|arkstVersion='${version}'|" arkmanager fi
chmod +x install.sh return $result
bash install.sh "$steamcmd_user" "$@" >"$output" 2>&1 }
status=$? function doInstallFromRelease(){
local tagname=
local desc=
rm -rf /tmp/ark-server-tools-${channel} 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')
# Print messages if [ -n "$tagname" ]; then
case "$status" in echo "Latest release is ${tagname}"
"0") echo "Getting commit for latest release..."
echo "ARK Server Tools were correctly installed in your system inside the home directory of $steamcmd_user!" 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
}
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
}
# Download and untar installation files
cd "$TEMP"
if [ "$channel" = "master" ] && [ -z "$unstable" ]; then
doInstallFromRelease
else
doInstallFromBranch "$channel"
fi
"1")
echo "Something where wrong :("
;;
"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

File diff suppressed because it is too large Load Diff

View File

@ -8,6 +8,7 @@ steamcmdroot="/home/steam/steamcmd" # path of yo
steamcmdexec="steamcmd.sh" # name of steamcmd executable steamcmdexec="steamcmd.sh" # name of steamcmd executable
steamcmd_user="steam" # name of the system user who own steamcmd folder steamcmd_user="steam" # name of the system user who own steamcmd folder
steamcmd_appinfocache="/home/steam/Steam/appcache/appinfo.vdf" # cache of the appinfo command steamcmd_appinfocache="/home/steam/Steam/appcache/appinfo.vdf" # cache of the appinfo command
steamcmd_workshoplog="/home/steam/Steam/logs/workshop_log.txt" # Steam workshop log
#steamlogin="anonymous" # Uncomment this to specify steam login instead of using anonymous login #steamlogin="anonymous" # Uncomment this to specify steam login instead of using anonymous login
# config environment # config environment
@ -32,6 +33,10 @@ msgWarnRestartMinutes="This ARK server will shutdown for a restart in %d minutes
msgWarnRestartSeconds="This ARK server will shutdown for a restart in %d seconds" msgWarnRestartSeconds="This ARK server will shutdown for a restart in %d seconds"
msgWarnShutdownMinutes="This ARK server will shutdown in %d minutes" msgWarnShutdownMinutes="This ARK server will shutdown in %d minutes"
msgWarnShutdownSeconds="This ARK server will shutdown in %d seconds" msgWarnShutdownSeconds="This ARK server will shutdown in %d seconds"
msgWarnCancelled="Restart cancelled by player request"
# Restart cancel chat command
#chatCommandRestartCancel="/cancelupdate"
# ARK server common options - use ark_<optionname>=<value> # ARK server common options - use ark_<optionname>=<value>
# comment out these values if you want to define them # comment out these values if you want to define them

View File

@ -3,6 +3,7 @@
userinstall=no userinstall=no
steamcmd_user= steamcmd_user=
showusage=no showusage=no
migrateconfig=no
while [ -n "$1" ]; do while [ -n "$1" ]; do
case "$1" in case "$1" in
@ -63,6 +64,9 @@ while [ -n "$1" ]; do
DATADIR="$2" DATADIR="$2"
shift shift
;; ;;
--migrate-config)
migrateconfig=yes
;;
-*) -*)
echo "Invalid option '$1'" echo "Invalid option '$1'"
showusage=yes showusage=yes
@ -169,7 +173,7 @@ if [ "$userinstall" == "yes" ]; then
"${INSTALL_ROOT}${INSTANCEDIR}/instance.cfg.example" "${INSTALL_ROOT}${INSTANCEDIR}/instance.cfg.example"
# Copy arkmanager.cfg to ~/.arkmanager.cfg.NEW # Copy arkmanager.cfg to ~/.arkmanager.cfg.NEW
cp arkmanager.cfg "${INSTALL_ROOT}${CONFIGFILE}.NEW" cp arkmanager.cfg "${INSTALL_ROOT}${CONFIGFILE}.example"
# Change the defaults in the new config file # Change the defaults in the new config file
sed -i -e "s|^steamcmd_user=\"steam\"|steamcmd_user=\"--me\"|" \ sed -i -e "s|^steamcmd_user=\"steam\"|steamcmd_user=\"--me\"|" \
-e "s|\"/home/steam|\"${PREFIX}|" \ -e "s|\"/home/steam|\"${PREFIX}|" \
@ -177,18 +181,24 @@ if [ "$userinstall" == "yes" ]; then
-e "s|^install_bindir=.*|install_bindir=\"${BINDIR}\"|" \ -e "s|^install_bindir=.*|install_bindir=\"${BINDIR}\"|" \
-e "s|^install_libexecdir=.*|install_libexecdir=\"${LIBEXECDIR}\"|" \ -e "s|^install_libexecdir=.*|install_libexecdir=\"${LIBEXECDIR}\"|" \
-e "s|^install_datadir=.*|install_datadir=\"${DATADIR}\"|" \ -e "s|^install_datadir=.*|install_datadir=\"${DATADIR}\"|" \
"${INSTALL_ROOT}${CONFIGFILE}.NEW" "${INSTALL_ROOT}${CONFIGFILE}.example"
# Copy arkmanager.cfg to ~/.arkmanager.cfg if it doesn't already exist # Copy arkmanager.cfg to ~/.arkmanager.cfg if it doesn't already exist
if [ -f "${INSTALL_ROOT}${CONFIGFILE}" ]; then if [ -f "${INSTALL_ROOT}${CONFIGFILE}" ]; then
bash ./migrate-config.sh "${INSTALL_ROOT}${CONFIGFILE}" SUFFIX=
bash ./migrate-main-instance.sh "${INSTALL_ROOT}${CONFIGFILE}" "${INSTALL_ROOT}${INSTANCEDIR}/main.cfg" if [ "$migrateconfig" = "no" ]; then
SUFFIX=".NEW"
cp "${INSTALL_ROOT}${CONFIGFILE}" "${INSTALL_ROOT}${CONFIGFILE}${SUFFIX}"
fi
bash ./migrate-config.sh "${INSTALL_ROOT}${CONFIGFILE}${SUFFIX}"
bash ./migrate-main-instance.sh "${INSTALL_ROOT}${CONFIGFILE}${SUFFIX}" "${INSTALL_ROOT}${INSTANCEDIR}/main.cfg${SUFFIX}"
echo "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 "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 "A copy of the new configuration file was included in '${CONFIGFILE}.NEW'. Make sure to review any changes and update your config accordingly!" echo "A copy of the new configuration file was included in '${CONFIGFILE}.NEW'. Make sure to review any changes and update your config accordingly!"
exit 2 exit 2
else else
mv -n "${INSTALL_ROOT}${CONFIGFILE}.NEW" "${INSTALL_ROOT}${CONFIGFILE}" cp -n "${INSTALL_ROOT}${CONFIGFILE}.example" "${INSTALL_ROOT}${CONFIGFILE}"
cp -n "${INSTALL_ROOT}/${INSTANCEDIR}/instance.cfg.example" "${INSTALL_ROOT}/${INSTANCEDIR}/main.cfg" cp -n "${INSTALL_ROOT}/${INSTANCEDIR}/instance.cfg.example" "${INSTALL_ROOT}/${INSTANCEDIR}/main.cfg"
fi fi
else else
@ -301,24 +311,30 @@ else
# Copy arkmanager.cfg inside linux configuation folder if it doesn't already exists # Copy arkmanager.cfg inside linux configuation folder if it doesn't already exists
mkdir -p "${INSTALL_ROOT}/etc/arkmanager" mkdir -p "${INSTALL_ROOT}/etc/arkmanager"
chown "$steamcmd_user" "${INSTALL_ROOT}/etc/arkmanager" chown "$steamcmd_user" "${INSTALL_ROOT}/etc/arkmanager"
cp arkmanager.cfg "${INSTALL_ROOT}${CONFIGFILE}.NEW" cp arkmanager.cfg "${INSTALL_ROOT}${CONFIGFILE}.example"
chown "$steamcmd_user" "${INSTALL_ROOT}${CONFIGFILE}.NEW" chown "$steamcmd_user" "${INSTALL_ROOT}${CONFIGFILE}.example"
sed -i -e "s|^steamcmd_user=\"steam\"|steamcmd_user=\"$steamcmd_user\"|" \ sed -i -e "s|^steamcmd_user=\"steam\"|steamcmd_user=\"$steamcmd_user\"|" \
-e "s|\"/home/steam|\"/home/$steamcmd_user|" \ -e "s|\"/home/steam|\"/home/$steamcmd_user|" \
-e "s|^install_bindir=.*|install_bindir=\"${BINDIR}\"|" \ -e "s|^install_bindir=.*|install_bindir=\"${BINDIR}\"|" \
-e "s|^install_libexecdir=.*|install_libexecdir=\"${LIBEXECDIR}\"|" \ -e "s|^install_libexecdir=.*|install_libexecdir=\"${LIBEXECDIR}\"|" \
-e "s|^install_datadir=.*|install_datadir=\"${DATADIR}\"|" \ -e "s|^install_datadir=.*|install_datadir=\"${DATADIR}\"|" \
"${INSTALL_ROOT}${CONFIGFILE}.NEW" "${INSTALL_ROOT}${CONFIGFILE}.example"
if [ -f "${INSTALL_ROOT}${CONFIGFILE}" ]; then if [ -f "${INSTALL_ROOT}${CONFIGFILE}" ]; then
bash ./migrate-config.sh "${INSTALL_ROOT}${CONFIGFILE}" SUFFIX=
bash ./migrate-main-instance.sh "${INSTALL_ROOT}${CONFIGFILE}" "${INSTALL_ROOT}${INSTANCEDIR}/main.cfg" if [ "$migrateconfig" = "no" ]; then
SUFFIX=".NEW"
cp "${INSTALL_ROOT}${CONFIGFILE}" "${INSTALL_ROOT}${CONFIGFILE}${SUFFIX}"
fi
bash ./migrate-config.sh "${INSTALL_ROOT}${CONFIGFILE}${SUFFIX}"
bash ./migrate-main-instance.sh "${INSTALL_ROOT}${CONFIGFILE}${SUFFIX}" "${INSTALL_ROOT}${INSTANCEDIR}/main.cfg${SUFFIX}"
echo "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 "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 "A copy of the new configuration file was included in /etc/arkmanager. Make sure to review any changes and update your config accordingly!" echo "A copy of the new configuration file was included in /etc/arkmanager. Make sure to review any changes and update your config accordingly!"
exit 2 exit 2
else else
mv -n "${INSTALL_ROOT}${CONFIGFILE}.NEW" "${INSTALL_ROOT}${CONFIGFILE}" cp -n "${INSTALL_ROOT}${CONFIGFILE}.example" "${INSTALL_ROOT}${CONFIGFILE}"
cp -n "${INSTALL_ROOT}/${INSTANCEDIR}/instance.cfg.example" "${INSTALL_ROOT}/${INSTANCEDIR}/main.cfg" cp -n "${INSTALL_ROOT}/${INSTANCEDIR}/instance.cfg.example" "${INSTALL_ROOT}/${INSTANCEDIR}/main.cfg"
fi fi
fi fi

View File

@ -3,7 +3,7 @@
configfile="$1" configfile="$1"
instancefile="$2" instancefile="$2"
if grep "^arkserverroot=" <"$configfile" >/dev/null 2>&1 && [ ! -f "$instancefile" ]; then if ! grep '^arkSingleInstance=' <"$configfile" >/dev/null 2>&1 && grep "^arkserverroot=" <"$configfile" >/dev/null 2>&1 && [ ! -f "$instancefile" ]; then
sed -n '/^#*\(ark\(\|flag\|opt\)_[^=]*\|arkserverroot\|serverMap\(\|ModId\)\)=/p' <"$configfile" >"$instancefile" sed -n '/^#*\(ark\(\|flag\|opt\)_[^=]*\|arkserverroot\|serverMap\(\|ModId\)\)=/p' <"$configfile" >"$instancefile"
sed -i '/^ark\(serverroot\|_\(RCONPort\|Port\|QueryPort\)\)=/d' "$configfile" sed -i '/^ark\(serverroot\|_\(RCONPort\|Port\|QueryPort\)\)=/d' "$configfile"
echo 'defaultinstance="main"' >>"$configfile" echo 'defaultinstance="main"' >>"$configfile"

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
DAEMON=/usr/bin/arkmanager DAEMON="/usr/bin/arkmanager"
for service in $(${DAEMON} list-instances --brief); do for service in $(${DAEMON} list-instances --brief); do
case "$1" in case "$1" in

View File

@ -5,7 +5,8 @@ After=network.target
[Service] [Service]
ExecStart=/usr/libexec/arkmanager/arkmanager.init start ExecStart=/usr/libexec/arkmanager/arkmanager.init start
ExecStop=/usr/libexec/arkmanager/arkmanager.init stop ExecStop=/usr/libexec/arkmanager/arkmanager.init stop
Type=oneshot Type=forking
RemainAfterExit=yes
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target