This commit is contained in:
@@ -155,6 +155,14 @@ Install a built archive:
|
||||
./scripts/install-to-steam.sh dist/Elsword-GE-11-1+dxvk-git.tar.zst
|
||||
```
|
||||
|
||||
Generic installer for release archives, including Flatpak Steam users:
|
||||
|
||||
```bash
|
||||
./scripts/install-compat-tool.sh /path/to/Tool.tar.zst
|
||||
./scripts/install-compat-tool.sh --flatpak /path/to/Tool.tar.zst
|
||||
./scripts/install-compat-tool.sh --all /path/to/Tool.tar.zst
|
||||
```
|
||||
|
||||
Target path:
|
||||
|
||||
```text
|
||||
|
||||
Executable
+97
@@ -0,0 +1,97 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
native_dir_default="${HOME}/.local/share/Steam/compatibilitytools.d"
|
||||
flatpak_dir_default="${HOME}/.var/app/com.valvesoftware.Steam/data/Steam/compatibilitytools.d"
|
||||
|
||||
usage() {
|
||||
cat <<'EOF'
|
||||
Usage:
|
||||
./scripts/install-compat-tool.sh /path/to/Tool.tar.zst
|
||||
./scripts/install-compat-tool.sh --native /path/to/Tool.tar.zst
|
||||
./scripts/install-compat-tool.sh --flatpak /path/to/Tool.tar.zst
|
||||
./scripts/install-compat-tool.sh --all /path/to/Tool.tar.zst
|
||||
|
||||
Options:
|
||||
--native Install into native Steam only
|
||||
--flatpak Install into Flatpak Steam only
|
||||
--all Install into both native Steam and Flatpak Steam
|
||||
EOF
|
||||
}
|
||||
|
||||
mode="auto"
|
||||
archive=""
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--native|--flatpak|--all)
|
||||
mode="${1#--}"
|
||||
shift
|
||||
;;
|
||||
-h|--help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
archive="$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
[[ -n "$archive" ]] || {
|
||||
usage >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
[[ -f "$archive" ]] || {
|
||||
printf "Archive not found: %s\n" "$archive" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
mapfile -t archive_entries < <(tar -tf "$archive")
|
||||
tool_name="${archive_entries[0]%%/*}"
|
||||
[[ -n "$tool_name" ]] || {
|
||||
printf "Could not determine tool name from archive: %s\n" "$archive" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
targets=()
|
||||
|
||||
case "$mode" in
|
||||
native)
|
||||
targets+=("$native_dir_default")
|
||||
;;
|
||||
flatpak)
|
||||
targets+=("$flatpak_dir_default")
|
||||
;;
|
||||
all)
|
||||
targets+=("$native_dir_default" "$flatpak_dir_default")
|
||||
;;
|
||||
auto)
|
||||
if [[ -d "${native_dir_default%/}/.." || -d "$native_dir_default" ]]; then
|
||||
targets+=("$native_dir_default")
|
||||
fi
|
||||
if [[ -d "${flatpak_dir_default%/}/.." || -d "$flatpak_dir_default" ]]; then
|
||||
targets+=("$flatpak_dir_default")
|
||||
fi
|
||||
if [[ ${#targets[@]} -eq 0 ]]; then
|
||||
targets+=("$native_dir_default")
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
printf "Unsupported mode: %s\n" "$mode" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
for target in "${targets[@]}"; do
|
||||
mkdir -p "$target"
|
||||
rm -rf "$target/$tool_name"
|
||||
tar --zstd -xf "$archive" -C "$target"
|
||||
printf "Installed %s to %s\n" "$tool_name" "$target/$tool_name"
|
||||
done
|
||||
|
||||
printf "Steam restart required.\n"
|
||||
printf "Select '%s' in the game's compatibility settings.\n" "$tool_name"
|
||||
Reference in New Issue
Block a user