2016-03-29 20:58:18 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -eu
|
|
|
|
|
|
|
|
BUILD="Release"
|
2016-07-24 00:48:49 +00:00
|
|
|
|
2016-07-11 17:22:25 +00:00
|
|
|
UNTIL_CLEAN_EXIT=0
|
2016-03-29 20:58:18 +00:00
|
|
|
|
2016-07-24 00:59:07 +00:00
|
|
|
ASF_ARGS=("")
|
2016-09-12 18:52:30 +00:00
|
|
|
MONO_ARGS=("")
|
2016-03-29 20:58:18 +00:00
|
|
|
|
|
|
|
PRINT_USAGE() {
|
2016-07-24 00:48:49 +00:00
|
|
|
echo "Usage: $0 [--until-clean-exit] [--cryptkey=] [--path=] [--server] [debug/release]"
|
2016-03-29 20:58:18 +00:00
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
for ARG in "$@"; do
|
|
|
|
case "$ARG" in
|
|
|
|
release|Release) BUILD="Release" ;;
|
|
|
|
debug|Debug) BUILD="Debug" ;;
|
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
|
|
|
|
|
2016-05-18 00:46:29 +00:00
|
|
|
if [[ "$BUILD" = "Debug" ]]; then
|
|
|
|
MONO_ARGS+=("--debug")
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd "$(dirname "$(readlink -f "$0")")"
|
|
|
|
|
2016-08-27 07:34:08 +00:00
|
|
|
if [[ -f "mono_envsetup.sh" ]]; then
|
2016-08-27 07:56:52 +00:00
|
|
|
set +u
|
2016-08-27 07:34:08 +00:00
|
|
|
source "mono_envsetup.sh"
|
2016-08-27 07:56:52 +00:00
|
|
|
set -u
|
2016-08-27 07:34:08 +00:00
|
|
|
fi
|
|
|
|
|
2016-03-29 20:58:18 +00:00
|
|
|
BINARY="ArchiSteamFarm/bin/$BUILD/ArchiSteamFarm.exe"
|
|
|
|
|
|
|
|
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
|
2016-07-24 00:48:49 +00:00
|
|
|
mono "${MONO_ARGS[@]}" "$BINARY" "${ASF_ARGS[@]}"
|
2016-07-11 17:22:25 +00:00
|
|
|
exit $?
|
|
|
|
fi
|
|
|
|
|
|
|
|
while [[ -f "$BINARY" ]]; do
|
2016-07-24 00:48:49 +00:00
|
|
|
if mono "${MONO_ARGS[@]}" "$BINARY" "${ASF_ARGS[@]}"; then
|
2016-07-11 17:22:25 +00:00
|
|
|
break
|
|
|
|
fi
|
|
|
|
sleep 1
|
|
|
|
done
|