mirror of
https://github.com/JustArchiNET/ArchiSteamFarm
synced 2024-11-10 07:04:27 +00:00
Make ASF helper scripts aware of --service
This commit is contained in:
parent
78a88979dc
commit
88996d1e35
7 changed files with 21 additions and 7 deletions
|
@ -22,6 +22,7 @@ fi
|
||||||
cd "$SCRIPT_DIR"
|
cd "$SCRIPT_DIR"
|
||||||
|
|
||||||
BINARY_ARGS=""
|
BINARY_ARGS=""
|
||||||
|
SERVICE=0
|
||||||
PATH_NEXT=0
|
PATH_NEXT=0
|
||||||
|
|
||||||
PARSE_ARG() {
|
PARSE_ARG() {
|
||||||
|
@ -37,6 +38,7 @@ PARSE_ARG() {
|
||||||
cd "$(echo "$1" | cut -d '=' -f 2-)"
|
cd "$(echo "$1" | cut -d '=' -f 2-)"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
--service) SERVICE=1 ;;
|
||||||
*)
|
*)
|
||||||
if [ "$PATH_NEXT" -eq 1 ]; then
|
if [ "$PATH_NEXT" -eq 1 ]; then
|
||||||
PATH_NEXT=0
|
PATH_NEXT=0
|
||||||
|
@ -85,7 +87,7 @@ fi
|
||||||
mono --version
|
mono --version
|
||||||
|
|
||||||
while :; do
|
while :; do
|
||||||
if [ -f "$CONFIG_PATH" ] && grep -Eq '"Headless":\s+?true' "$CONFIG_PATH"; then
|
if [ "$SERVICE" -eq 1 ] || ([ -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
|
||||||
# Start ASF in the background, trap will work properly due to non-blocking call
|
# Start ASF in the background, trap will work properly due to non-blocking call
|
||||||
if [ -n "$BINARY_PREFIX" ]; then
|
if [ -n "$BINARY_PREFIX" ]; then
|
||||||
|
|
|
@ -22,6 +22,7 @@ fi
|
||||||
cd "$SCRIPT_DIR"
|
cd "$SCRIPT_DIR"
|
||||||
|
|
||||||
BINARY_ARGS=""
|
BINARY_ARGS=""
|
||||||
|
SERVICE=0
|
||||||
PATH_NEXT=0
|
PATH_NEXT=0
|
||||||
|
|
||||||
PARSE_ARG() {
|
PARSE_ARG() {
|
||||||
|
@ -37,6 +38,7 @@ PARSE_ARG() {
|
||||||
cd "$(echo "$1" | cut -d '=' -f 2-)"
|
cd "$(echo "$1" | cut -d '=' -f 2-)"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
--service) SERVICE=1 ;;
|
||||||
*)
|
*)
|
||||||
if [ "$PATH_NEXT" -eq 1 ]; then
|
if [ "$PATH_NEXT" -eq 1 ]; then
|
||||||
PATH_NEXT=0
|
PATH_NEXT=0
|
||||||
|
@ -84,7 +86,7 @@ fi
|
||||||
|
|
||||||
mono --version
|
mono --version
|
||||||
|
|
||||||
if [ -f "$CONFIG_PATH" ] && grep -Eq '"Headless":\s+?true' "$CONFIG_PATH"; then
|
if [ "$SERVICE" -eq 1 ] || ([ -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
|
||||||
# Start ASF in the background, trap will work properly due to non-blocking call
|
# Start ASF in the background, trap will work properly due to non-blocking call
|
||||||
if [ -n "$BINARY_PREFIX" ]; then
|
if [ -n "$BINARY_PREFIX" ]; then
|
||||||
|
|
|
@ -22,6 +22,7 @@ fi
|
||||||
cd "$SCRIPT_DIR"
|
cd "$SCRIPT_DIR"
|
||||||
|
|
||||||
BINARY_ARGS=""
|
BINARY_ARGS=""
|
||||||
|
SERVICE=0
|
||||||
PATH_NEXT=0
|
PATH_NEXT=0
|
||||||
|
|
||||||
PARSE_ARG() {
|
PARSE_ARG() {
|
||||||
|
@ -37,6 +38,7 @@ PARSE_ARG() {
|
||||||
cd "$(echo "$1" | cut -d '=' -f 2-)"
|
cd "$(echo "$1" | cut -d '=' -f 2-)"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
--service) SERVICE=1 ;;
|
||||||
*)
|
*)
|
||||||
if [ "$PATH_NEXT" -eq 1 ]; then
|
if [ "$PATH_NEXT" -eq 1 ]; then
|
||||||
PATH_NEXT=0
|
PATH_NEXT=0
|
||||||
|
@ -85,7 +87,7 @@ fi
|
||||||
dotnet --info
|
dotnet --info
|
||||||
|
|
||||||
while :; do
|
while :; do
|
||||||
if [ -f "$CONFIG_PATH" ] && grep -Eq '"Headless":\s+?true' "$CONFIG_PATH"; then
|
if [ "$SERVICE" -eq 1 ] || ([ -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
|
||||||
# Start ASF in the background, trap will work properly due to non-blocking call
|
# Start ASF in the background, trap will work properly due to non-blocking call
|
||||||
if [ -n "$BINARY_PREFIX" ]; then
|
if [ -n "$BINARY_PREFIX" ]; then
|
||||||
|
|
|
@ -22,6 +22,7 @@ fi
|
||||||
cd "$SCRIPT_DIR"
|
cd "$SCRIPT_DIR"
|
||||||
|
|
||||||
BINARY_ARGS=""
|
BINARY_ARGS=""
|
||||||
|
SERVICE=0
|
||||||
PATH_NEXT=0
|
PATH_NEXT=0
|
||||||
|
|
||||||
PARSE_ARG() {
|
PARSE_ARG() {
|
||||||
|
@ -37,6 +38,7 @@ PARSE_ARG() {
|
||||||
cd "$(echo "$1" | cut -d '=' -f 2-)"
|
cd "$(echo "$1" | cut -d '=' -f 2-)"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
--service) SERVICE=1 ;;
|
||||||
*)
|
*)
|
||||||
if [ "$PATH_NEXT" -eq 1 ]; then
|
if [ "$PATH_NEXT" -eq 1 ]; then
|
||||||
PATH_NEXT=0
|
PATH_NEXT=0
|
||||||
|
@ -84,7 +86,7 @@ fi
|
||||||
|
|
||||||
dotnet --info
|
dotnet --info
|
||||||
|
|
||||||
if [ -f "$CONFIG_PATH" ] && grep -Eq '"Headless":\s+?true' "$CONFIG_PATH"; then
|
if [ "$SERVICE" -eq 1 ] || ([ -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
|
||||||
# Start ASF in the background, trap will work properly due to non-blocking call
|
# Start ASF in the background, trap will work properly due to non-blocking call
|
||||||
if [ -n "$BINARY_PREFIX" ]; then
|
if [ -n "$BINARY_PREFIX" ]; then
|
||||||
|
|
|
@ -22,6 +22,7 @@ fi
|
||||||
cd "$SCRIPT_DIR"
|
cd "$SCRIPT_DIR"
|
||||||
|
|
||||||
BINARY_ARGS=""
|
BINARY_ARGS=""
|
||||||
|
SERVICE=0
|
||||||
PATH_NEXT=0
|
PATH_NEXT=0
|
||||||
|
|
||||||
PARSE_ARG() {
|
PARSE_ARG() {
|
||||||
|
@ -37,6 +38,7 @@ PARSE_ARG() {
|
||||||
cd "$(echo "$1" | cut -d '=' -f 2-)"
|
cd "$(echo "$1" | cut -d '=' -f 2-)"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
--service) SERVICE=1 ;;
|
||||||
*)
|
*)
|
||||||
if [ "$PATH_NEXT" -eq 1 ]; then
|
if [ "$PATH_NEXT" -eq 1 ]; then
|
||||||
PATH_NEXT=0
|
PATH_NEXT=0
|
||||||
|
@ -78,7 +80,7 @@ CONFIG_PATH="$(pwd)/${CONFIG_PATH}"
|
||||||
trap "trap - TERM && kill -- -$$" INT TERM
|
trap "trap - TERM && kill -- -$$" INT TERM
|
||||||
|
|
||||||
while :; do
|
while :; do
|
||||||
if [ -f "$CONFIG_PATH" ] && grep -Eq '"Headless":\s+?true' "$CONFIG_PATH"; then
|
if [ "$SERVICE" -eq 1 ] || ([ -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
|
||||||
# Start ASF in the background, trap will work properly due to non-blocking call
|
# Start ASF in the background, trap will work properly due to non-blocking call
|
||||||
if [ -n "$BINARY_PREFIX" ]; then
|
if [ -n "$BINARY_PREFIX" ]; then
|
||||||
|
|
|
@ -22,6 +22,7 @@ fi
|
||||||
cd "$SCRIPT_DIR"
|
cd "$SCRIPT_DIR"
|
||||||
|
|
||||||
BINARY_ARGS=""
|
BINARY_ARGS=""
|
||||||
|
SERVICE=0
|
||||||
PATH_NEXT=0
|
PATH_NEXT=0
|
||||||
|
|
||||||
PARSE_ARG() {
|
PARSE_ARG() {
|
||||||
|
@ -37,6 +38,7 @@ PARSE_ARG() {
|
||||||
cd "$(echo "$1" | cut -d '=' -f 2-)"
|
cd "$(echo "$1" | cut -d '=' -f 2-)"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
--service) SERVICE=1 ;;
|
||||||
*)
|
*)
|
||||||
if [ "$PATH_NEXT" -eq 1 ]; then
|
if [ "$PATH_NEXT" -eq 1 ]; then
|
||||||
PATH_NEXT=0
|
PATH_NEXT=0
|
||||||
|
@ -69,7 +71,7 @@ CONFIG_PATH="$(pwd)/${CONFIG_PATH}"
|
||||||
trap "trap - TERM && kill -- -$$" INT TERM
|
trap "trap - TERM && kill -- -$$" INT TERM
|
||||||
|
|
||||||
while :; do
|
while :; do
|
||||||
if [ -f "$CONFIG_PATH" ] && grep -Eq '"Headless":\s+?true' "$CONFIG_PATH"; then
|
if [ "$SERVICE" -eq 1 ] || ([ -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
|
||||||
"$BINARY" $BINARY_ARGS & # Start ASF in the background, trap will work properly due to non-blocking call
|
"$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
|
wait $! # This will forward dotnet error code, set -e will abort the script if it's non-zero
|
||||||
|
|
4
run.sh
4
run.sh
|
@ -28,6 +28,7 @@ fi
|
||||||
cd "$BINARY_DIR"
|
cd "$BINARY_DIR"
|
||||||
|
|
||||||
BINARY_ARGS=""
|
BINARY_ARGS=""
|
||||||
|
SERVICE=0
|
||||||
PATH_NEXT=0
|
PATH_NEXT=0
|
||||||
|
|
||||||
PARSE_ARG() {
|
PARSE_ARG() {
|
||||||
|
@ -43,6 +44,7 @@ PARSE_ARG() {
|
||||||
cd "$(echo "$1" | cut -d '=' -f 2-)"
|
cd "$(echo "$1" | cut -d '=' -f 2-)"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
--service) SERVICE=1 ;;
|
||||||
*)
|
*)
|
||||||
if [ "$PATH_NEXT" -eq 1 ]; then
|
if [ "$PATH_NEXT" -eq 1 ]; then
|
||||||
PATH_NEXT=0
|
PATH_NEXT=0
|
||||||
|
@ -81,7 +83,7 @@ fi
|
||||||
|
|
||||||
dotnet --info
|
dotnet --info
|
||||||
|
|
||||||
if [ -f "$CONFIG_PATH" ] && grep -Eq '"Headless":\s+?true' "$CONFIG_PATH"; then
|
if [ "$SERVICE" -eq 1 ] || ([ -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 "$BINARY" $BINARY_ARGS & # Start ASF in the background, trap will work properly due to non-blocking call
|
dotnet "$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
|
wait $! # This will forward dotnet error code, set -e will abort the script if it's non-zero
|
||||||
|
|
Loading…
Reference in a new issue