blob: 30f6eaa7c54b7b83f38b4711b808449682d372e8 (
plain)
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
#!/bin/bash
PKGNAME='vtfedit'
PKGPATH='/usr/share/vtfedit'
PKGBIN='x86/VTFEdit.exe'
C_YELLOW='\e[33m'
C_CLEAR='\e[0m'
export WINEPREFIX="$HOME/.local/share/wineprefixes/$PKGNAME"
export WINEARCH='win32'
export WINEDEBUG=-all
if [[ ! -d $WINEPREFIX ]]; then
PROGRESS=$(mktemp)
MSG='Initialising your wineprefix, this may take a few minutes..'
echo -e "$C_YELLOW==>$C_CLEAR $MSG\n"
(winetricks -q winxp 2>&1 | tee -a $PROGRESS ) &
PID_XP="$!"
(winetricks -q dlls vcrun2005 dotnet35 2>&1 | tee -a $PROGRESS ) &
PID_DLL="$!"
exec 3>&1
(
DONE_XP=0
DONE_DLL=0
MAX_LINES=152
TICK=0
while [[ 1 ]]; do
LINES=$(cat $PROGRESS | wc -l)
PCT="$(($(echo $LINES) * 100 / $MAX_LINES))"
echo $PCT
if [[ $TICK == 10 ]]; then
TICK=0
echo -e "$C_YELLOW==>$C_CLEAR $PCT% complete ($LINES/$MAX_LINES)" >&3
echo -ne ' XP: ' >&3
if [[ $DONE_XP -eq 0 ]]; then
echo -n 'installing DLLs: ' >&3
else
echo -n 'done DLLs: ' >&3
fi
if [[ $DONE_DLL -eq 0 ]]; then
echo 'installing' >&3
else
echo 'done' >&3
fi
fi
sleep 1
if [[ $DONE_XP == 0 ]]; then
ps -p $PID_XP $2>1 >/dev/null
if [[ $? -ne 0 ]]; then
DONE_XP=1
echo -e "$C_YELLOW==>$C_CLEAR Finished winetricks winxp" >&3
fi
fi
if [[ $DONE_DLL == 0 ]]; then
ps -p $PID_DLL $2>1 >/dev/null
if [[ $? -ne 0 ]]; then
DONE_DLL=1
echo -e "$C_YELLOW==>$C_CLEAR Finished winetricks DLLs" >&3
fi
fi
if [[ $DONE_XP == 1 ]] && [[ $DONE_DLL == 1 ]]; then
echo -e "$C_YELLOW==>$C_CLEAR wineprefix setup complete" >&3
exit 0
fi
TICK=$(($TICK + 1))
done
) | zenity --progress --title='VTFEdit' --text="$MSG" --time-remaining --auto-close --no-cancel
fi
declare -a args
for arg; do
if [[ "${arg:0:1}" = "-" ]]; then
args+=("${arg/#-//}")
else
args+=("$(winepath -w "$arg")")
fi
done
wine $PKGPATH/$PKGBIN "${args[@]}"
EXIT=$?
if [[ $EXIT -ne 0 ]]; then
echo "error: vtfedit failed to launch!"
echo -e "If vtfedit didn't start, you should try deleting your vtfedit\nwineprefix and restarting:"
echo " rm -rf $WINEPREFIX"
exit $EXIT
fi
|