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:48:49 +00:00
|
|
|
ASF_ARGS=()
|
2016-06-02 22:16:31 +00:00
|
|
|
MONO_ARGS=("--llvm" "--server" "-O=all")
|
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-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
|