Skip to content

Commit 1613276

Browse files
committed
mangohud bin: make sure script is posix compliant
1 parent 672d648 commit 1613276

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

bin/mangohud.in

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,10 @@ if [ "$#" -eq 0 ]; then
88
exit 1
99
fi
1010

11-
# Names of executables that we do not want LD_PRELOAD set for
12-
DISABLE_LD_PRELOAD=("cs2.sh")
1311

14-
# Combine all command line arguments into a single string
15-
command_line="$0 $@"
16-
disable_preload=false
12+
# Add exe names newline separated to the string to disable LD_PRELOAD
13+
DISABLE_LD_PRELOAD="cs2.sh
14+
some_other_exe"
1715

1816
MANGOHUD_LIB_NAME="@ld_libdir_mangohud@libMangoHud_opengl.so"
1917

@@ -29,9 +27,14 @@ if [ "$1" = "--version" ]; then
2927
exit 0
3028
fi
3129

32-
# Check if any of the names in DISABLE_LD_PRELOAD are in the command line
33-
for name in "${DISABLE_LD_PRELOAD[@]}"; do
34-
if echo "$command_line" | grep -q "$name"; then
30+
# grab all arguments from command_line
31+
command_line="$*"
32+
# flag for disable_preload
33+
disable_preload=false
34+
35+
# Check if the script name or any of the executables in DISABLE_LD_PRELOAD are in the command line
36+
for exe in $DISABLE_LD_PRELOAD; do
37+
if echo "$command_line" | grep -q "$exe"; then
3538
disable_preload=true
3639
break
3740
fi

0 commit comments

Comments
 (0)