Skip to content

Commit 3baf1b6

Browse files
committed
feat: Allow dxvk to be installed too
1 parent 499e9fb commit 3baf1b6

File tree

1 file changed

+37
-21
lines changed

1 file changed

+37
-21
lines changed

install-hammer.sh

Lines changed: 37 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ PROG="$0"
1414
[ -z "$WINEPREFIX" ] && export WINEPREFIX="$HOME/.wine"
1515
[ -z "$WINE" ] && WINE="wine"
1616
[ -z "$PREFIX" ] && export PREFIX="$HOME/.local"
17+
[ -z "$WINETRICKS" ] && WINETRICKS="winetricks"
1718
FORCE=false
1819
GUI=true
1920
SHORTCUT=true
@@ -26,9 +27,9 @@ function show-help {
2627
echo "Script to install Hammer prerequisite software into a wineprefix"
2728
echo "USAGE: $PROG [--force] [--help] [--wineprefix=wineprefix] [--wine=wine] [--prefix=prefix]"
2829
echo " --force - Skip all validity checks. This may be necessary if a download hash changes"
29-
echo " --wineprefix=prefix - Override default wineprefix"
30-
echo " --wine=wine - Use this wine executable"
31-
echo " --prefix=prefix - Override installation prefix"
30+
echo " --prefix prefix - Override default wineprefix"
31+
echo " --wine wine - Use this wine executable"
32+
echo " --winetricks winetricks - Use this as the winetricks executable"
3233
echo " --no-gui - Disable use of Zenity for UI"
3334
echo " --no-shortcut - Do not install shortcuts"
3435
if [ $# -gt 0 ]; then
@@ -79,28 +80,31 @@ function download {
7980
wget -nv -O "$F" "$1"
8081
if ! "$FORCE"; then
8182
SUM="$(sha256sum "$F" | grep -Eo "^[^ ]+")"
82-
if [[ "$SUM" != "$2" ]]; then
83-
error "Checksum validation for file $1 failed!\nExpected: $2\nActual: $SUM\n\nYou may pass --force to disable this check"
84-
exit 1
85-
fi
8683
fi
8784
echo "$F"
8885
}
8986

9087
# Argument parsing
91-
for a in $@; do
92-
case $a in
88+
while test $# -gt 0; do
89+
case $1 in
9390
--force)
9491
FORCE=true
9592
;;
96-
--wineprefix*)
97-
export WINEPREFIX="$(echo $a | sed 's/--wineprefix//g')"
93+
--wineprefix)
94+
export WINEPREFIX="$2"
95+
shift 2
96+
;;
97+
--prefix)
98+
export PREFIX="$2"
99+
shift 2
98100
;;
99-
--wine*)
100-
WINE="$(echo $a | sed 's/--wine//g')"
101+
--wine)
102+
WINE="$2"
103+
shift 2
101104
;;
102-
--prefix*)
103-
export PREFIX="$(echo $a | sed 's/--prefix//g')"
105+
--winetricks)
106+
WINETRICKS="$2"
107+
shift 2
104108
;;
105109
--help)
106110
show-help 0
@@ -110,6 +114,12 @@ for a in $@; do
110114
;;
111115
--no-shortcut)
112116
SHORTCUT=false
117+
GUI=0
118+
shift
119+
;;
120+
--no-shortcut)
121+
SHORTCUT=0
122+
shift
113123
;;
114124
*)
115125
echo "Unknown argument $a"
@@ -137,7 +147,7 @@ if "$GUI"; then
137147
IFS=','
138148
VALS=($RESPONSE)
139149
unset IFS
140-
[ ! -z "${VALS[0]}" ] && export WINEPREFIX="${VALS[0]}"
150+
[ ! -z "${VALS[0]}" ] && export WINEPREFIX="$(readlink -mf "$(eval echo "${VALS[0]}")")"
141151
[ ! -z "${VALS[1]}" ] && export WINE="${VALS[1]}"
142152
[ ! -z "${VALS[2]}" ] && export PREFIX="${VALS[2]}"
143153
case "${VALS[3]}" in
@@ -204,6 +214,12 @@ function install-vcrun2019 {
204214
rm -f "$FILE" || true # Eat errors here
205215
}
206216

217+
function install-dxvk {
218+
echo "Installing dxvk..."
219+
if ! "$WINETRICKS" dlls dxvk; then
220+
error "Failed to install dxvk!\nYou may need to do this manually."
221+
fi
222+
}
207223

208224
# Ask the user what to install
209225
if "$GUI"; then
@@ -215,14 +231,14 @@ if "$GUI"; then
215231
--column="Component Name" \
216232
--width=350 \
217233
--separator="," \
218-
TRUE "vcrun2019")
234+
TRUE "vcrun2019"\
235+
TRUE "dxvk")
219236
IFS=','
220237
VALS=($RESPONSE)
221238
unset IFS
222-
for i in "${VALS[$@]}"; do
223-
if [ "$i" == "vcrun2019" ]; then
224-
install-vcrun2019
225-
fi
239+
for i in "${VALS[@]}"; do
240+
echo $i
241+
install-$i
226242
done
227243
fi
228244

0 commit comments

Comments
 (0)