-
Notifications
You must be signed in to change notification settings - Fork 0
/
wine-gameprep
executable file
·44 lines (44 loc) · 1.32 KB
/
wine-gameprep
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
#!/bin/sh
test -n "$1" || exit 1
cd "$1" || exit 1
for x in goggame-*.ico gfw_high.ico; do
test -f "$x" || continue
gid=$(fgrep rootGameId "${x%.ico}.info" 2>/dev/null)
gid="${gid%\"*}"
gid="${gid##*\"}"
test -n "$gid" -a "$x" != goggame-${gid}.ico -a -f goggame-${gid}.ico && continue
convert "$x" "${x%.ico}.png"
break
done
# older games had 256x256 always, but some newer ones have 2x 128x128 instead
# so just pick a 128x128 if no 256x256 exists (they're both the same)
p256=
p128=
for x in *-{,1}[0-9].png; do
test -f "$x" || continue
f="`file \"\$x\"`"
case "$f" in
*"256 x 256"*RGBA*) p256="$x" ;;
*"128 x 128"*RGBA*) p128="$x" ;;
esac
done
test -z "$p256" && p256="$p128"
for x in *-{,1}[0-9].png; do
test -f "$x" || continue
case "$x" in
"$p256") ;;
*) rm "$x" ;;
esac
done
chmod -R og-rwx .
find . -type f -exec chmod -x {} \;
chmod -R g+rX .
test -h /usr/local/games/wine/"$1" -o -d /usr/local/games/wine/"$1" && sudo mv /usr/local/games/wine/"$1"{,.old}
cd ..
sudo mv "$1" /usr/local/games/wine/. || exit 1
mkdir "$1"
sudo chown -hR root:games /usr/local/games/wine/"$1"
#rm *-{,1}[0-9].png 2>/dev/null
cp -a /usr/local/games/wine/"$1"/*-{,1}[0-9].png "$1" 2>/dev/null
sudo chown root:games -h setup*.{bin,exe} 2>/dev/null
sudo mv setup*.{bin,exe} /usr/local/games/wine/"$1"/. 2>/dev/null