Add --warnreason

This commit is contained in:
Ben Peddell 2016-07-16 13:11:27 +10:00
parent 915b5ace41
commit 9a76dd8e16

View File

@ -865,7 +865,7 @@ doStop() {
for arg in "$@"; do for arg in "$@"; do
case "$arg" in case "$arg" in
--warn) dowarn=1; ;; --warn) dowarn=1; ;;
--warnreason=*) warnreason="${arg#*=}"; ;; --warnreason=*) warnreason="${arg#--warnreason=}"; ;;
--saveworld) dosave=1; ;; --saveworld) dosave=1; ;;
esac esac
done done
@ -995,6 +995,12 @@ printWarnMessage(){
fi fi
fi fi
msg="${msgWarnReason//\{time\}/$msgtime}" msg="${msgWarnReason//\{time\}/$msgtime}"
if [ -n "$warnreason" ]; then
local v="warnreason_$warnreason"
reason="${!v}"
if [ -z "$reason" ]; then
reason="$warnreason"
fi
if [ "$1" == "update" ]; then if [ "$1" == "update" ]; then
if [ -n "$appupdate" ]; then if [ -n "$appupdate" ]; then
if [ -n "$modupdate" ]; then if [ -n "$modupdate" ]; then
@ -1242,34 +1248,24 @@ doUpdate() {
local nodownload= local nodownload=
for arg in "$@"; do for arg in "$@"; do
if [ "$arg" == "--force" ]; then case "$arg" in
appupdate=1 --force) appupdate=1; ;;
elif [ "$arg" == "--safe" ]; then --safe) updatetype=safe; ;;
updatetype=safe --warn) updatetype=warn; ;;
elif [ "$arg" == "--warn" ]; then --ifempty) updatetype=ifempty; ;;
updatetype=warn --warnreason=*) warnreason="${arg#--warnreason=}"; ;;
elif [ "$arg" == "--ifempty" ]; then --validate) validate=validate; appupdate=1; ;;
updatetype=ifempty --saveworld) saveworld=1; ;;
elif [ "$arg" == "--validate" ]; then --update-mods) modupdate=1; ;;
validate=validate --backup) arkBackupPreUpdate=true; ;;
appupdate=1 --stagingdir=*) arkStagingDir="${arg#--stagingdir=}"; ;;
elif [ "$arg" == "--saveworld" ]; then --downloadonly) downloadonly=1; ;;
saveworld=1 --no-download) nodownload=1; ;;
elif [ "$arg" == "--update-mods" ]; then *)
modupdate=1 echo "Unrecognized option $arg"
elif [ "$arg" == "--backup" ]; then echo "Try 'arkmanager -h' or 'arkmanager --help' for more information."
arkBackupPreUpdate=true exit 1
elif [[ "$arg" =~ ^--stagingdir= ]]; then esac
arkStagingDir="${ark#--stagingdir=}"
elif [ "$arg" == "--downloadonly" ]; then
downloadonly=1
elif [ "$arg" == "--no-download" ]; then
nodownload=1
else
echo "Unrecognized option $arg"
echo "Try 'arkmanager -h' or 'arkmanager --help' for more information."
exit 1
fi
done done
echo "$$" >"${arkserverroot}/.ark-update.lock.$$" 2>/dev/null echo "$$" >"${arkserverroot}/.ark-update.lock.$$" 2>/dev/null