-
Notifications
You must be signed in to change notification settings - Fork 20
/
launcher_template.sh.in
60 lines (54 loc) · 1.89 KB
/
launcher_template.sh.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#! /bin/bash
function showHelp() {
echo "Usage: glxosd [options] command"
echo " -h or --help : show this help message"
echo " -c <path> or --config <path> : specify the path to an additional config location"
echo " -p <path> or --scripts-root <path> : specify the path to the location of GLXOSD scripts"
echo " -s or --steam : inject Steam overlay"
echo " --steam-path <path> : set path to Steam"
echo "Also, you can set GLXOSD_PRELOAD in the same way as LD_PRELOAD, except that GLXOSD_PRELOAD will be in LD_PRELOAD before GLXOSD libraries."
}
OPTIND=1
INJECT_STEAM_OVERLAY=false
STEAM_PATH=~/.local/share/Steam
GLXOSD_SCRIPTS_ROOT="@CMAKE_INSTALL_FULL_DATAROOTDIR@/glxosd/"
GLXOSD_ADDITIONAL_CONFIG_LOCATION=""
while : ; do
case "$1" in
-h|--help)
showHelp;
exit 0;;
-c|--config)
GLXOSD_ADDITIONAL_CONFIG_LOCATION="$2"
shift 2 ;;
-p|--scripts-root)
GLXOSD_SCRIPTS_ROOT="$2"
shift 2 ;;
-s|--steam)
INJECT_STEAM_OVERLAY=true;
shift 1;;
--steam-path)
STEAM_PATH="$2"
shift 2 ;;
*)
break;;
esac
done
STEAM_OVERLAY_LIB_PATHS=""
STEAM_OVERLAY_LIBS=""
if [ "$INJECT_STEAM_OVERLAY" = true ]; then
STEAM_OVERLAY_LIBS="gameoverlayrenderer.so"
for dir in $(find ${STEAM_PATH} -maxdepth 1 -name "*_32"); do
STEAM_OVERLAY_LIB_PATHS="${STEAM_OVERLAY_LIB_PATHS}:${dir}"
done
for dir in $(find ${STEAM_PATH} -maxdepth 1 -name "*_64"); do
STEAM_OVERLAY_LIB_PATHS="${STEAM_OVERLAY_LIB_PATHS}:${dir}"
done
fi
GLXOSD_LIBRARY_PATH_I386="@CMAKE_INSTALL_PREFIX@/@INSTALLATION_SUFFIX_32@/glxosd/"
GLXOSD_LIBRARY_PATH_AMD64="@CMAKE_INSTALL_PREFIX@/@INSTALLATION_SUFFIX_64@/glxosd/"
export LD_LIBRARY_PATH="${STEAM_OVERLAY_LIB_PATHS}:${GLXOSD_LIBRARY_PATH_I386}:${GLXOSD_LIBRARY_PATH_AMD64}:${LD_LIBRARY_PATH}"
export LD_PRELOAD="${GLXOSD_PRELOAD}:${STEAM_OVERLAY_LIBS}:libglxosd-glinject.so:${LD_PRELOAD}"
export GLXOSD_SCRIPTS_ROOT
export GLXOSD_ADDITIONAL_CONFIG_LOCATION
exec "$@"