Handle chmod +x for generic helper scripts

This commit is contained in:
JustArchi
2017-10-14 07:47:51 +02:00
parent d8160df985
commit 0c7d9bae48
2 changed files with 9 additions and 4 deletions

View File

@@ -11,8 +11,9 @@ ASF_ARGS+=" $*"
# Kill underlying ASF process on shell process exit
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT
while [[ -f ArchiSteamFarm.dll ]]; do
dotnet ArchiSteamFarm.dll $ASF_ARGS &
while :; do
dotnet ArchiSteamFarm.dll $ASF_ARGS & # We need to start ASF in the background for trap to work
wait $! # This will forward dotnet error code, set -e will abort the script if it's non-zero
chmod +x "$0" # If ASF exited by itself, we need to ensure that our script is still set to +x after auto-update
sleep 1
done

View File

@@ -8,5 +8,9 @@ fi
ASF_ARGS+=" $*"
# We don't need our shell anymore, just replace the current process instead of starting a new one
exec dotnet ArchiSteamFarm.dll $ASF_ARGS
# Kill underlying ASF process on shell process exit
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT
dotnet ArchiSteamFarm.dll $ASF_ARGS & # We need to start ASF in the background for trap to work
wait $! # This will forward dotnet error code, set -e will abort the script if it's non-zero
chmod +x "$0" # If ASF exited by itself, we need to ensure that our script is still set to +x after auto-update