mirror of
https://github.com/JustArchiNET/ArchiSteamFarm
synced 2024-11-10 07:04:27 +00:00
Correct scripts for osx compatibility
This commit is contained in:
parent
e25f0a371e
commit
8559604332
8 changed files with 153 additions and 28 deletions
|
@ -2,12 +2,16 @@
|
|||
set -eu
|
||||
|
||||
CONFIG_PATH="config/ASF.json"
|
||||
OS_TYPE="$(uname -s)"
|
||||
|
||||
cd "$(dirname "$(readlink -f "$0")")"
|
||||
|
||||
SCRIPT_DIR="$(pwd)"
|
||||
SCRIPT_PATH="${SCRIPT_DIR}/${0}"
|
||||
case "$OS_TYPE" in
|
||||
"Darwin") SCRIPT_PATH="$(readlink "$0")" ;;
|
||||
"FreeBSD") SCRIPT_PATH="$(readlink -f "$0")" ;;
|
||||
"Linux") SCRIPT_PATH="$(readlink -f "$0")" ;;
|
||||
*) echo "ERROR: Unknown OS type: ${OS_TYPE}. If you believe that our script should work on your machine, please let us know."; exit 1
|
||||
esac
|
||||
|
||||
SCRIPT_DIR="$(dirname "$SCRIPT_PATH")"
|
||||
BINARY="${SCRIPT_DIR}/ArchiSteamFarm.exe"
|
||||
|
||||
if [ ! -f "$BINARY" ]; then
|
||||
|
@ -15,6 +19,8 @@ if [ ! -f "$BINARY" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
cd "$SCRIPT_DIR"
|
||||
|
||||
BINARY_ARGS=""
|
||||
PATH_NEXT=0
|
||||
|
||||
|
|
|
@ -2,12 +2,16 @@
|
|||
set -eu
|
||||
|
||||
CONFIG_PATH="config/ASF.json"
|
||||
OS_TYPE="$(uname -s)"
|
||||
|
||||
cd "$(dirname "$(readlink -f "$0")")"
|
||||
|
||||
SCRIPT_DIR="$(pwd)"
|
||||
SCRIPT_PATH="${SCRIPT_DIR}/${0}"
|
||||
case "$OS_TYPE" in
|
||||
"Darwin") SCRIPT_PATH="$(readlink "$0")" ;;
|
||||
"FreeBSD") SCRIPT_PATH="$(readlink -f "$0")" ;;
|
||||
"Linux") SCRIPT_PATH="$(readlink -f "$0")" ;;
|
||||
*) echo "ERROR: Unknown OS type: ${OS_TYPE}. If you believe that our script should work on your machine, please let us know."; exit 1
|
||||
esac
|
||||
|
||||
SCRIPT_DIR="$(dirname "$SCRIPT_PATH")"
|
||||
BINARY="${SCRIPT_DIR}/ArchiSteamFarm.exe"
|
||||
|
||||
if [ ! -f "$BINARY" ]; then
|
||||
|
@ -15,6 +19,8 @@ if [ ! -f "$BINARY" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
cd "$SCRIPT_DIR"
|
||||
|
||||
BINARY_ARGS=""
|
||||
PATH_NEXT=0
|
||||
|
||||
|
|
|
@ -2,12 +2,16 @@
|
|||
set -eu
|
||||
|
||||
CONFIG_PATH="config/ASF.json"
|
||||
OS_TYPE="$(uname -s)"
|
||||
|
||||
cd "$(dirname "$(readlink -f "$0")")"
|
||||
|
||||
SCRIPT_DIR="$(pwd)"
|
||||
SCRIPT_PATH="${SCRIPT_DIR}/${0}"
|
||||
case "$OS_TYPE" in
|
||||
"Darwin") SCRIPT_PATH="$(readlink "$0")" ;;
|
||||
"FreeBSD") SCRIPT_PATH="$(readlink -f "$0")" ;;
|
||||
"Linux") SCRIPT_PATH="$(readlink -f "$0")" ;;
|
||||
*) echo "ERROR: Unknown OS type: ${OS_TYPE}. If you believe that our script should work on your machine, please let us know."; exit 1
|
||||
esac
|
||||
|
||||
SCRIPT_DIR="$(dirname "$SCRIPT_PATH")"
|
||||
BINARY="${SCRIPT_DIR}/ArchiSteamFarm.dll"
|
||||
|
||||
if [ ! -f "$BINARY" ]; then
|
||||
|
@ -15,6 +19,8 @@ if [ ! -f "$BINARY" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
cd "$SCRIPT_DIR"
|
||||
|
||||
BINARY_ARGS=""
|
||||
PATH_NEXT=0
|
||||
|
||||
|
|
|
@ -2,12 +2,16 @@
|
|||
set -eu
|
||||
|
||||
CONFIG_PATH="config/ASF.json"
|
||||
OS_TYPE="$(uname -s)"
|
||||
|
||||
cd "$(dirname "$(readlink -f "$0")")"
|
||||
|
||||
SCRIPT_DIR="$(pwd)"
|
||||
SCRIPT_PATH="${SCRIPT_DIR}/${0}"
|
||||
case "$OS_TYPE" in
|
||||
"Darwin") SCRIPT_PATH="$(readlink "$0")" ;;
|
||||
"FreeBSD") SCRIPT_PATH="$(readlink -f "$0")" ;;
|
||||
"Linux") SCRIPT_PATH="$(readlink -f "$0")" ;;
|
||||
*) echo "ERROR: Unknown OS type: ${OS_TYPE}. If you believe that our script should work on your machine, please let us know."; exit 1
|
||||
esac
|
||||
|
||||
SCRIPT_DIR="$(dirname "$SCRIPT_PATH")"
|
||||
BINARY="${SCRIPT_DIR}/ArchiSteamFarm.dll"
|
||||
|
||||
if [ ! -f "$BINARY" ]; then
|
||||
|
@ -15,6 +19,8 @@ if [ ! -f "$BINARY" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
cd "$SCRIPT_DIR"
|
||||
|
||||
BINARY_ARGS=""
|
||||
PATH_NEXT=0
|
||||
|
||||
|
|
|
@ -2,12 +2,16 @@
|
|||
set -eu
|
||||
|
||||
CONFIG_PATH="config/ASF.json"
|
||||
OS_TYPE="$(uname -s)"
|
||||
|
||||
cd "$(dirname "$(readlink -f "$0")")"
|
||||
|
||||
SCRIPT_DIR="$(pwd)"
|
||||
SCRIPT_PATH="${SCRIPT_DIR}/${0}"
|
||||
case "$OS_TYPE" in
|
||||
"Darwin") SCRIPT_PATH="$(readlink "$0")" ;;
|
||||
"FreeBSD") SCRIPT_PATH="$(readlink -f "$0")" ;;
|
||||
"Linux") SCRIPT_PATH="$(readlink -f "$0")" ;;
|
||||
*) echo "ERROR: Unknown OS type: ${OS_TYPE}. If you believe that our script should work on your machine, please let us know."; exit 1
|
||||
esac
|
||||
|
||||
SCRIPT_DIR="$(dirname "$SCRIPT_PATH")"
|
||||
BINARY="${SCRIPT_DIR}/ArchiSteamFarm"
|
||||
|
||||
if [ ! -f "$BINARY" ]; then
|
||||
|
@ -15,6 +19,8 @@ if [ ! -f "$BINARY" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
cd "$SCRIPT_DIR"
|
||||
|
||||
BINARY_ARGS=""
|
||||
PATH_NEXT=0
|
||||
|
||||
|
|
|
@ -2,12 +2,16 @@
|
|||
set -eu
|
||||
|
||||
CONFIG_PATH="config/ASF.json"
|
||||
OS_TYPE="$(uname -s)"
|
||||
|
||||
cd "$(dirname "$(readlink -f "$0")")"
|
||||
|
||||
SCRIPT_DIR="$(pwd)"
|
||||
SCRIPT_PATH="${SCRIPT_DIR}/${0}"
|
||||
case "$OS_TYPE" in
|
||||
"Darwin") SCRIPT_PATH="$(readlink "$0")" ;;
|
||||
"FreeBSD") SCRIPT_PATH="$(readlink -f "$0")" ;;
|
||||
"Linux") SCRIPT_PATH="$(readlink -f "$0")" ;;
|
||||
*) echo "ERROR: Unknown OS type: ${OS_TYPE}. If you believe that our script should work on your machine, please let us know."; exit 1
|
||||
esac
|
||||
|
||||
SCRIPT_DIR="$(dirname "$SCRIPT_PATH")"
|
||||
BINARY="${SCRIPT_DIR}/ArchiSteamFarm"
|
||||
|
||||
if [ ! -f "$BINARY" ]; then
|
||||
|
@ -15,6 +19,8 @@ if [ ! -f "$BINARY" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
cd "$SCRIPT_DIR"
|
||||
|
||||
BINARY_ARGS=""
|
||||
PATH_NEXT=0
|
||||
|
||||
|
|
|
@ -2,12 +2,16 @@
|
|||
set -eu
|
||||
|
||||
CONFIG_PATH="config/ASF.json"
|
||||
OS_TYPE="$(uname -s)"
|
||||
|
||||
cd "$(dirname "$(readlink -f "$0")")"
|
||||
|
||||
SCRIPT_DIR="$(pwd)"
|
||||
SCRIPT_PATH="${SCRIPT_DIR}/${0}"
|
||||
case "$OS_TYPE" in
|
||||
"Darwin") SCRIPT_PATH="$(readlink "$0")" ;;
|
||||
"FreeBSD") SCRIPT_PATH="$(readlink -f "$0")" ;;
|
||||
"Linux") SCRIPT_PATH="$(readlink -f "$0")" ;;
|
||||
*) echo "ERROR: Unknown OS type: ${OS_TYPE}. If you believe that our script should work on your machine, please let us know."; exit 1
|
||||
esac
|
||||
|
||||
SCRIPT_DIR="$(dirname "$SCRIPT_PATH")"
|
||||
BINARY="${SCRIPT_DIR}/ArchiSteamFarm"
|
||||
|
||||
if [ ! -f "$BINARY" ]; then
|
||||
|
@ -15,6 +19,8 @@ if [ ! -f "$BINARY" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
cd "$SCRIPT_DIR"
|
||||
|
||||
BINARY_ARGS=""
|
||||
PATH_NEXT=0
|
||||
|
||||
|
|
83
ArchiSteamFarm/overlay/osx-x64/ArchiSteamFarm-Service.sh
Normal file
83
ArchiSteamFarm/overlay/osx-x64/ArchiSteamFarm-Service.sh
Normal file
|
@ -0,0 +1,83 @@
|
|||
#!/usr/bin/env sh
|
||||
set -eu
|
||||
|
||||
CONFIG_PATH="config/ASF.json"
|
||||
OS_TYPE="$(uname -s)"
|
||||
|
||||
case "$OS_TYPE" in
|
||||
"Darwin") SCRIPT_PATH="$(readlink "$0")" ;;
|
||||
"FreeBSD") SCRIPT_PATH="$(readlink -f "$0")" ;;
|
||||
"Linux") SCRIPT_PATH="$(readlink -f "$0")" ;;
|
||||
*) echo "ERROR: Unknown OS type: ${OS_TYPE}. If you believe that our script should work on your machine, please let us know."; exit 1
|
||||
esac
|
||||
|
||||
SCRIPT_DIR="$(dirname "$SCRIPT_PATH")"
|
||||
BINARY="${SCRIPT_DIR}/ArchiSteamFarm"
|
||||
|
||||
if [ ! -f "$BINARY" ]; then
|
||||
echo "ERROR: $BINARY could not be found!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd "$SCRIPT_DIR"
|
||||
|
||||
BINARY_ARGS=""
|
||||
PATH_NEXT=0
|
||||
|
||||
PARSE_ARG() {
|
||||
BINARY_ARGS="$BINARY_ARGS $1"
|
||||
|
||||
case "$1" in
|
||||
--path) PATH_NEXT=1 ;;
|
||||
--path=*)
|
||||
if [ "$PATH_NEXT" -eq 1 ]; then
|
||||
PATH_NEXT=0
|
||||
cd "$1"
|
||||
else
|
||||
cd "$(echo "$1" | cut -d '=' -f 2-)"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
if [ "$PATH_NEXT" -eq 1 ]; then
|
||||
PATH_NEXT=0
|
||||
cd "$1"
|
||||
fi
|
||||
esac
|
||||
}
|
||||
|
||||
if [ -n "${ASF_PATH-}" ]; then
|
||||
cd "$ASF_PATH"
|
||||
fi
|
||||
|
||||
if [ -n "${ASF_ARGS-}" ]; then
|
||||
for ARG in $ASF_ARGS; do
|
||||
if [ -n "$ARG" ]; then
|
||||
PARSE_ARG "$ARG"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
for ARG in "$@"; do
|
||||
if [ -n "$ARG" ]; then
|
||||
PARSE_ARG "$ARG"
|
||||
fi
|
||||
done
|
||||
|
||||
CONFIG_PATH="$(pwd)/${CONFIG_PATH}"
|
||||
|
||||
# Kill underlying ASF process on shell process exit
|
||||
trap "trap - TERM && kill -- -$$" INT TERM
|
||||
|
||||
while :; do
|
||||
if [ -f "$CONFIG_PATH" ] && grep -Eq '"Headless":\s+?true' "$CONFIG_PATH"; then
|
||||
# We're running ASF in headless mode so we don't need STDIN
|
||||
"$BINARY" $BINARY_ARGS & # Start ASF in the background, trap will work properly due to non-blocking call
|
||||
wait $! # This will forward dotnet error code, set -e will abort the script if it's non-zero
|
||||
else
|
||||
# We're running ASF in non-headless mode, so we need STDIN to be operative
|
||||
"$BINARY" $BINARY_ARGS # Start ASF in the foreground, trap sadly won't work until process exit
|
||||
fi
|
||||
|
||||
chmod +x "$SCRIPT_PATH" # If ASF exited by itself, we need to ensure that our script is still set to +x after auto-update
|
||||
sleep 1
|
||||
done
|
Loading…
Reference in a new issue