forked from NVIDIA/Q2RTX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfind-retail-paks.sh
executable file
·77 lines (65 loc) · 2.05 KB
/
find-retail-paks.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/bash
if [[ -n "${XDG_DATA_HOME}" ]]; then
XDG_DATA_HOME = "${HOME}/.local/share"
fi
DEST_DIR="${XDG_DATA_HOME}/quake2rtx"
# Check for zenity/yad
ZEN=""
# Default to not copying retail files (since we can't distribute them, and not
# every player will have the full game)
NO_COPY_RETAIL=1
copy_retail_files() {
FULL_GAME_DIR="$1"
pushd "${FULL_GAME_DIR}"
mkdir -p "${DEST_DIR}/baseq2"
cp baseq2/pak*.pak "${DEST_DIR}/baseq2"
cp -R baseq2/players "${DEST_DIR}/baseq2"
cp -R baseq2/music "${DEST_DIR}/baseq2"
# GoG version of game puts music in basedir
cp -R music "${DEST_DIR}/baseq2"
popd
}
# which zenity
if [[ -f "/usr/bin/zenity" ]]; then
ZEN="$(which zenity)"
# XXX[ljm] WAR steam-runtime bug: https://github.com/ValveSoftware/steam-runtime/issues/104
# The steam-runtime copy of zenity relies on a older zenity.ui file
# version, and won't work on more modern distros
ZEN="/usr/bin/zenity"
ZEN_QUESTION="${ZEN} --question --text"
ZEN_INFO="${ZEN} --info --text"
ZEN_DIR_SELECT="${ZEN} --file-selection --directory"
else
which kdialog
if [[ ! -z "$?" ]]; then
ZEN="$(which kdialog)"
ZEN_QUESTION="${ZEN} --title Q2RTX --warningyesnocancel"
ZEN_INFO="${ZEN} --title Q2RTX --msgbox"
ZEN_DIR_SELECT="${ZEN} --title Q@RTX --getexistingdirectory"
else
ZEN=0
fi
fi
if [[ ! -z ${ZEN} ]]; then
${ZEN_QUESTION} "Do you own the Retail copy of Quake 2 and would like to import the PAK files to Quake 2 RTX?"
# XXX[ljm] -z isn't working for some reason :(
if [[ "0" -eq "$?" ]]; then
NO_COPY_RETAIL=0
fi
fi
# XXX[ljm] -z isn't working for some reason :(
if [[ "0" -eq ${NO_COPY_RETAIL} ]]; then
# Check usual install location
if [[ -d "${HOME}/.steam/steam/steamapps/common/Quake 2" ]]; then
copy_retail_files "${HOME}/.steam/steam/steamapps/common/Quake 2"
exit 0;
fi
# Prompt user for custom existing-install location
if [[ ! -z ${ZEN} ]]; then
${ZEN_INFO} "Please select your existing Quake 2 Retail Installation Directory."
copy_retail_files "$(${ZEN_DIR_SELECT})"
exit 0;
fi
fi
# No retail found or user wasn't interested
exit 1