mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2025-12-19 07:50:29 +00:00
Add handling of --path to headless detection
This commit is contained in:
@@ -1,5 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
|
CONFIG_PATH="config/ASF.json"
|
||||||
|
|
||||||
cd "$(dirname "$(readlink -f "$0")")"
|
cd "$(dirname "$(readlink -f "$0")")"
|
||||||
|
|
||||||
if [[ -z "${ASF_ARGS-}" ]]; then
|
if [[ -z "${ASF_ARGS-}" ]]; then
|
||||||
@@ -8,11 +11,17 @@ fi
|
|||||||
|
|
||||||
ASF_ARGS+=" $*"
|
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
|
# Kill underlying ASF process on shell process exit
|
||||||
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM
|
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM
|
||||||
|
|
||||||
while :; do
|
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
|
# 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
|
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
|
wait $! # This will forward dotnet error code, set -e will abort the script if it's non-zero
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
|
CONFIG_PATH="config/ASF.json"
|
||||||
|
|
||||||
cd "$(dirname "$(readlink -f "$0")")"
|
cd "$(dirname "$(readlink -f "$0")")"
|
||||||
|
|
||||||
if [[ -z "${ASF_ARGS-}" ]]; then
|
if [[ -z "${ASF_ARGS-}" ]]; then
|
||||||
@@ -8,10 +11,16 @@ fi
|
|||||||
|
|
||||||
ASF_ARGS+=" $*"
|
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
|
# Kill underlying ASF process on shell process exit
|
||||||
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM
|
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
|
# 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
|
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
|
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"
|
PROJECT="ArchiSteamFarm"
|
||||||
OUT="out/source"
|
OUT="out/source"
|
||||||
|
|
||||||
|
CONFIG_PATH="config/ASF.json"
|
||||||
|
|
||||||
cd "$(dirname "$(readlink -f "$0")")"
|
cd "$(dirname "$(readlink -f "$0")")"
|
||||||
|
|
||||||
if [[ -z "${ASF_ARGS-}" ]]; then
|
if [[ -z "${ASF_ARGS-}" ]]; then
|
||||||
@@ -12,6 +14,12 @@ fi
|
|||||||
|
|
||||||
ASF_ARGS+=" $*"
|
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
|
# Kill underlying ASF process on shell process exit
|
||||||
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM
|
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM
|
||||||
|
|
||||||
@@ -22,11 +30,13 @@ fi
|
|||||||
|
|
||||||
dotnet --info
|
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
|
# 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
|
wait $! # This will forward dotnet error code, set -e will abort the script if it's non-zero
|
||||||
else
|
else
|
||||||
# We're running ASF in non-headless mode, so we need STDIN to be operative
|
# 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
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user