mangohud bin: make sure script is posix compliant

pull/1160/head
Alessandro Toia 7 months ago
parent 672d6481cc
commit 1613276182

@ -8,12 +8,10 @@ if [ "$#" -eq 0 ]; then
exit 1 exit 1
fi fi
# Names of executables that we do not want LD_PRELOAD set for
DISABLE_LD_PRELOAD=("cs2.sh")
# Combine all command line arguments into a single string # Add exe names newline separated to the string to disable LD_PRELOAD
command_line="$0 $@" DISABLE_LD_PRELOAD="cs2.sh
disable_preload=false some_other_exe"
MANGOHUD_LIB_NAME="@ld_libdir_mangohud@libMangoHud_opengl.so" MANGOHUD_LIB_NAME="@ld_libdir_mangohud@libMangoHud_opengl.so"
@ -29,9 +27,14 @@ if [ "$1" = "--version" ]; then
exit 0 exit 0
fi fi
# Check if any of the names in DISABLE_LD_PRELOAD are in the command line # grab all arguments from command_line
for name in "${DISABLE_LD_PRELOAD[@]}"; do command_line="$*"
if echo "$command_line" | grep -q "$name"; then # flag for disable_preload
disable_preload=false
# Check if the script name or any of the executables in DISABLE_LD_PRELOAD are in the command line
for exe in $DISABLE_LD_PRELOAD; do
if echo "$command_line" | grep -q "$exe"; then
disable_preload=true disable_preload=true
break break
fi fi

Loading…
Cancel
Save