2023-02-01 02:58:12 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
2023-02-11 01:34:48 +01:00
|
|
|
die()
|
|
|
|
{
|
|
|
|
echo "$@"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2023-02-01 02:58:12 +01:00
|
|
|
echo "Xash3D FWGS installed as Flatpak."
|
|
|
|
|
2023-02-11 01:34:48 +01:00
|
|
|
# https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
|
|
|
# $XDG_DATA_HOME defines the base directory relative to which user-specific data files should be stored.
|
|
|
|
# If $XDG_DATA_HOME is either not set or empty, a default equal to $HOME/.local/share should be used.
|
|
|
|
if [ -z "$XDG_DATA_HOME" ]; then
|
|
|
|
export XDG_DATA_HOME="$HOME/.local/share"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$XASH3D_BASEDIR" ]; then
|
|
|
|
export XASH3D_BASEDIR="$XDG_DATA_HOME/xash3d-fwgs/"
|
|
|
|
fi
|
|
|
|
|
|
|
|
mkdir -p "$XASH3D_BASEDIR"
|
|
|
|
cd "$XASH3D_BASEDIR" || die "Can't cd into $XASH3D_BASEDIR"
|
|
|
|
echo "XASH3D_BASEDIR is $XASH3D_BASEDIR"
|
|
|
|
|
|
|
|
if [ -z "$XASH3D_RODIR" ]; then
|
|
|
|
# TODO: detect by libraryfolders.vdf and installed apps
|
|
|
|
STEAMDIRS="\
|
2023-02-11 01:56:40 +01:00
|
|
|
$HOME/.local/share/Steam/steamapps/common \
|
2023-02-11 01:34:48 +01:00
|
|
|
$HOME/.var/app/com.valvesoftware.Steam/.local/share/Steam/steamapps/common \
|
|
|
|
$HOME/.steam/steam/steamapps/common"
|
|
|
|
HALFLIFEDIR="Half-Life"
|
|
|
|
|
|
|
|
for i in $STEAMDIRS; do
|
|
|
|
if [ ! -d "$i" ]; then
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Detected Steam library in $i, probing Half-Life..."
|
|
|
|
|
2023-02-11 01:56:40 +01:00
|
|
|
if [ ! -d "$i/$HALFLIFEDIR" ]; then
|
2023-02-11 01:34:48 +01:00
|
|
|
continue
|
|
|
|
fi
|
2023-02-05 02:13:45 +01:00
|
|
|
|
2023-02-11 01:56:40 +01:00
|
|
|
echo "Detected Half-Life installation in $i/$HALFLIFEDIR..."
|
2023-02-01 02:58:12 +01:00
|
|
|
|
2023-02-11 01:56:40 +01:00
|
|
|
export XASH3D_RODIR="$i/$HALFLIFEDIR"
|
2023-02-11 01:34:48 +01:00
|
|
|
break
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
echo "XASH3D_RODIR is $XASH3D_RODIR"
|
2023-02-01 02:58:12 +01:00
|
|
|
|
2023-02-11 01:34:48 +01:00
|
|
|
if [ -z "$XASH3D_EXTRAS_PAK1" ]; then
|
|
|
|
export XASH3D_EXTRAS_PAK1=/app/share/xash3d/valve/extras.pk3
|
|
|
|
fi
|
|
|
|
echo "XASH3D_EXTRAS_PAK1 is $XASH3D_EXTRAS_PAK1"
|
2023-02-01 02:58:12 +01:00
|
|
|
|
2023-02-05 01:25:07 +01:00
|
|
|
exec $DEBUGGER /app/lib32/xash3d/xash3d "$@"
|