2022-06-01 10:48:59 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# Lutris pre-loader script, for allowing loading multiple pre-load scripts.
|
|
|
|
|
|
|
|
# Enabling debug will enable the script output.
|
2023-06-11 09:18:20 +00:00
|
|
|
|
|
|
|
# Folder path (relative to Lutris prefix directory)
|
|
|
|
FOLDER="${PRELOADER_PATH:-"./preloader"}"
|
|
|
|
DEBUG="${PRELOADER_DEBUG:-0}"
|
2022-06-01 10:48:59 +00:00
|
|
|
|
|
|
|
execute_file () {
|
|
|
|
# Just in case...
|
|
|
|
chmod +x "$1"
|
|
|
|
if [[ $DEBUG -eq 0 ]]; then
|
|
|
|
nohup "$1" >/dev/null 2>&1 &
|
|
|
|
else
|
2023-06-11 09:18:20 +00:00
|
|
|
fullfile="$1"
|
|
|
|
filename="${fullfile##*/}"
|
2022-06-01 11:43:32 +00:00
|
|
|
nohup "$1" > ./logs/"$FOLDER"_"$filename".log 2>&1 &
|
2022-06-01 10:48:59 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2023-06-11 09:18:20 +00:00
|
|
|
if [[ $DEBUG -ne 0 ]]; then
|
|
|
|
echo "!!!DEBUGGING ENABLED!!!"
|
|
|
|
echo "Debug log may leak your sensitive information, use with caution."
|
|
|
|
echo "!!!DEBUGGING ENABLED!!!"
|
|
|
|
mkdir -p "$FOLDER" ./logs/
|
|
|
|
fi
|
2022-06-01 10:48:59 +00:00
|
|
|
echo "Checking directory..."
|
2022-06-01 11:43:32 +00:00
|
|
|
for file in "$FOLDER"/*.*; do
|
2022-06-01 10:48:59 +00:00
|
|
|
[ -e "$file" ] || continue
|
|
|
|
echo "Found $file, loading..."
|
|
|
|
execute_file "$file"
|
|
|
|
done
|
|
|
|
|