ArchiSteamFarm/run.sh

50 lines
870 B
Bash
Raw Normal View History

2016-03-29 20:58:18 +00:00
#!/bin/bash
set -eu
2017-06-26 03:14:44 +00:00
PROJECT="ArchiSteamFarm"
OUT="out"
2017-06-26 03:48:48 +00:00
BINARY="${PROJECT}/${OUT}/${PROJECT}.dll"
2016-03-29 20:58:18 +00:00
2016-07-24 00:59:07 +00:00
ASF_ARGS=("")
2017-06-26 03:14:44 +00:00
UNTIL_CLEAN_EXIT=0
2016-03-29 20:58:18 +00:00
PRINT_USAGE() {
2017-06-26 03:48:48 +00:00
echo "Usage: $0 [--until-clean-exit] [--cryptkey=] [--path=] [--server]"
2016-03-29 20:58:18 +00:00
exit 1
}
for ARG in "$@"; do
case "$ARG" in
2016-07-24 00:49:59 +00:00
--cryptkey=*) ASF_ARGS+=("$ARG") ;;
--path=*) ASF_ARGS+=("$ARG") ;;
2016-07-24 00:51:16 +00:00
--server) ASF_ARGS+=("$ARG") ;;
2016-07-11 17:22:25 +00:00
--until-clean-exit) UNTIL_CLEAN_EXIT=1 ;;
2016-03-29 20:58:18 +00:00
*) PRINT_USAGE
esac
done
2017-06-26 03:14:44 +00:00
if ! hash dotnet &>/dev/null; then
echo "ERROR: dotnet CLI tools are not installed!"
exit 1
fi
2017-06-26 03:14:44 +00:00
cd "$(dirname "$(readlink -f "$0")")"
2016-03-29 20:58:18 +00:00
if [[ ! -f "$BINARY" ]]; then
echo "ERROR: $BINARY could not be found!"
exit 1
fi
2016-07-11 17:22:25 +00:00
if [[ "$UNTIL_CLEAN_EXIT" -eq 0 ]]; then
2017-06-26 03:14:44 +00:00
dotnet exec "$BINARY" "${ASF_ARGS[@]}"
2016-07-11 17:22:25 +00:00
exit $?
fi
while [[ -f "$BINARY" ]]; do
2017-06-26 03:14:44 +00:00
if dotnet exec "$BINARY" "${ASF_ARGS[@]}"; then
2016-07-11 17:22:25 +00:00
break
fi
2017-06-26 03:14:44 +00:00
2016-07-11 17:22:25 +00:00
sleep 1
done