summarylogtreecommitdiffstats
path: root/gog-stardew-valley
diff options
context:
space:
mode:
Diffstat (limited to 'gog-stardew-valley')
-rwxr-xr-x[-rw-r--r--]gog-stardew-valley29
1 files changed, 20 insertions, 9 deletions
diff --git a/gog-stardew-valley b/gog-stardew-valley
index 6efc13cb3452..92d85479c22f 100644..100755
--- a/gog-stardew-valley
+++ b/gog-stardew-valley
@@ -1,13 +1,24 @@
-#! /bin/sh
+#! /bin/bash
-run="/opt/gog-stardew-valley/start.sh"
-# The launcher fails unless in its dir.
-cd "/opt/gog-stardew-valley/" || exit 1
+pkgname="gog-stardew-valley"
+pkgdir="/opt/${pkgname}/"
+run="${pkgdir}/start.sh"
-if which firejail >/dev/null 2>&1 && [ -z "$FIREJAIL_IGNORE" ]; then
- echo "Firejail detected. Enforcing a sandbox"
- echo "To bypass Firejail enforcement, run FIREJAIL_IGNORE=1 $run."
- firejail --caps.drop=all "$run"
+if hash firejail; then
+ echo "Firejail detected; attempting to enforce a sandbox..."
+ if [[ -f "${XDG_CONFIG_HOME}/firejail/${pkgname}.profile" ]]; then
+ echo "Firejail profile for ${pkgname} found in ${XDG_CONFIG_HOME}/firejail/"
+ echo "Enforcing a sandbox!"
+ firejail "${run}"
+ elif [[ -f "/etc/firejail/${pkgname}.profile" ]]; then
+ echo "Firejail profile for ${pkgname} found in /etc/firejail/"
+ echo "Enforcing a sandbox!"
+ firejail "${run}"
+ else
+ echo "No Firejail profile detected!"
+ echo "Skipping Firejail sandbox..."
+ "${run}"
+ fi
else
- "${run}"
+ "${run}"
fi