diff options
| -rw-r--r-- | faugus_run.py | 10 | ||||
| -rw-r--r-- | faugus_run_bwrap.sh | 16 |
2 files changed, 20 insertions, 6 deletions
diff --git a/faugus_run.py b/faugus_run.py index 7f5ee86..f3e895d 100644 --- a/faugus_run.py +++ b/faugus_run.py @@ -230,8 +230,16 @@ class FaugusRun: ] run_env = os.environ.copy() + if self.game_directories: - run_env['GAME_DIRS'] = self.game_directories + valid_dirs = [ + d.strip() for d in self.game_directories.split(",") + if os.path.isdir(d.strip()) + ] + + # join by NULL characters for sh + if valid_dirs: + run_env['GAME_DIRS'] = "\x00".join(valid_dirs) self.process = subprocess.Popen( popen_cmd, diff --git a/faugus_run_bwrap.sh b/faugus_run_bwrap.sh index 31aeaec..2c683e0 100644 --- a/faugus_run_bwrap.sh +++ b/faugus_run_bwrap.sh @@ -1,4 +1,4 @@ -#!/usr/bin/sh -x +#!/usr/bin/bash -x # we only set those if DRI_PRIME is set (use discrete gpu is checked) # DRI_PRIME=1 is not enough for nvidia, it works but handoff is slow @@ -13,6 +13,15 @@ if [ "${DRI_PRIME}" = "1" ]; then __GLX_VENDOR_LIBRARY_NAME=nvidia fi +bwrap_args=() + +# parse NULL-separated GAME_DIRS into a list of readonly binds +if [ -n "$GAME_DIRS" ]; then + while IFS= read -r -d '' dir; do + bwrap_args+=(--ro-bind "$dir" "$dir") + done < <(printf '%s\0' "$GAME_DIRS") +fi + bwrap \ --die-with-parent \ --as-pid-1 \ @@ -36,15 +45,12 @@ bwrap \ --ro-bind /usr/bin /bin \ --ro-bind /etc /etc \ --ro-bind /sys /sys \ + "${bwrap_args[@]}" \ --bind ${XDG_RUNTIME_DIR} ${XDG_RUNTIME_DIR} \ --bind /tmp /tmp \ --proc /proc \ --dev-bind /dev /dev \ - --ro-bind /mnt/stuff/Games /mnt/stuff/Games \ - --bind /mnt/games /mnt/games \ - --symlink /mnt/games ~/Games \ --bind "${WINEPREFIX}" "${WINEPREFIX}" \ - --bind ~/CloudSaves ~/CloudSaves \ --bind ~/.local/share/umu ~/.local/share/umu \ --ro-bind ~/.config/faugus-launcher/games.json ~/.config/faugus-launcher/games.json \ --ro-bind ~/.config/faugus-launcher/config.ini ~/.config/faugus-launcher/config.ini \ |
