mirror of
https://github.com/JustArchiNET/ArchiSteamFarm
synced 2024-11-10 07:04:27 +00:00
Add handling of --path to headless detection
This commit is contained in:
parent
d34128910b
commit
feafd16269
3 changed files with 33 additions and 5 deletions
|
@ -1,5 +1,8 @@
|
|||
#!/bin/bash
|
||||
set -eu
|
||||
|
||||
CONFIG_PATH="config/ASF.json"
|
||||
|
||||
cd "$(dirname "$(readlink -f "$0")")"
|
||||
|
||||
if [[ -z "${ASF_ARGS-}" ]]; then
|
||||
|
@ -8,11 +11,17 @@ fi
|
|||
|
||||
ASF_ARGS+=" $*"
|
||||
|
||||
for ARG in $ASF_ARGS; do
|
||||
case "$ARG" in
|
||||
--path=*) CONFIG_PATH="$(echo "$ARG" | cut -d '=' -f 2-)/${CONFIG_PATH}" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Kill underlying ASF process on shell process exit
|
||||
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM
|
||||
|
||||
while :; do
|
||||
if grep -Eq '"Headless":\s+?true' 'config/ASF.json'; then
|
||||
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
|
||||
dotnet ArchiSteamFarm.dll $ASF_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
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
#!/bin/bash
|
||||
set -eu
|
||||
|
||||
CONFIG_PATH="config/ASF.json"
|
||||
|
||||
cd "$(dirname "$(readlink -f "$0")")"
|
||||
|
||||
if [[ -z "${ASF_ARGS-}" ]]; then
|
||||
|
@ -8,10 +11,16 @@ fi
|
|||
|
||||
ASF_ARGS+=" $*"
|
||||
|
||||
for ARG in $ASF_ARGS; do
|
||||
case "$ARG" in
|
||||
--path=*) CONFIG_PATH="$(echo "$ARG" | cut -d '=' -f 2-)/${CONFIG_PATH}" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Kill underlying ASF process on shell process exit
|
||||
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM
|
||||
|
||||
if grep -Eq '"Headless":\s+?true' 'config/ASF.json'; then
|
||||
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
|
||||
dotnet ArchiSteamFarm.dll $ASF_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
|
||||
|
|
16
run.sh
16
run.sh
|
@ -4,6 +4,8 @@ set -eu
|
|||
PROJECT="ArchiSteamFarm"
|
||||
OUT="out/source"
|
||||
|
||||
CONFIG_PATH="config/ASF.json"
|
||||
|
||||
cd "$(dirname "$(readlink -f "$0")")"
|
||||
|
||||
if [[ -z "${ASF_ARGS-}" ]]; then
|
||||
|
@ -12,6 +14,12 @@ fi
|
|||
|
||||
ASF_ARGS+=" $*"
|
||||
|
||||
for ARG in $ASF_ARGS; do
|
||||
case "$ARG" in
|
||||
--path=*) CONFIG_PATH="$(echo "$ARG" | cut -d '=' -f 2-)/${CONFIG_PATH}" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Kill underlying ASF process on shell process exit
|
||||
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM
|
||||
|
||||
|
@ -22,11 +30,13 @@ fi
|
|||
|
||||
dotnet --info
|
||||
|
||||
if grep -Eq '"Headless":\s+?true' "${PROJECT}/${OUT}/config/ASF.json"; then
|
||||
cd "${PROJECT}/${OUT}"
|
||||
|
||||
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
|
||||
dotnet exec "${PROJECT}/${OUT}/${PROJECT}.dll" $ASF_ARGS & # Start ASF in the background, trap will work properly due to non-blocking call
|
||||
dotnet exec "${PROJECT}.dll" $ASF_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
|
||||
dotnet exec "${PROJECT}/${OUT}/${PROJECT}.dll" $ASF_ARGS # Start ASF in the foreground, trap won't work until process exit
|
||||
dotnet exec "${PROJECT}.dll" $ASF_ARGS # Start ASF in the foreground, trap won't work until process exit
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue