-
Notifications
You must be signed in to change notification settings - Fork 96
/
manual_install
executable file
·304 lines (248 loc) · 8.35 KB
/
manual_install
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
#!/usr/bin/env bash
# Copyright (C) 2007-2010 PlayOnLinux Team
# Copyright (C) 2011 Pâris Quentin
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# PlayOnLinux / PlayOnMac 4 manual installation
[ "$PLAYONLINUX" = "" ] && exit
source "$PLAYONLINUX/lib/sources"
INSTALL_NUMBER="$(POL_Config_Read MANUAL_INSTALL_INCREMENT)"
INSTALL_NUMBER=$(( INSTALL_NUMBER + 1 ))
POL_Config_Write MANUAL_INSTALL_INCREMENT $INSTALL_NUMBER
TITLE="$(eval_gettext 'Manual installation')"
NOBUGREPORT="YES"
run_autorun()
{
POL_Debug_Message "Scanning autorun : $1"
NUMSTEP="3"
open=$(grep -i "^open" "$1")
open=${open//" = "/"="}
icon=$(grep -i "^icon" "$1")
icon=${icon//" = "/"="}
name=$(grep -i "^name" "$1")
name=${name//" = "/"="}
SetupIs=$(echo "$open" | cut -d\= -f2)
NameIs=$(echo $name | cut -d\= -f2)
IconIs=$(echo "$icon" | cut -d\= -f2)
if [ ! "$SetupIs" = "" ]
then
SetupIsNum=${#SetupIs}
SetupIs=${SetupIs:0:$(( SetupIsNum -1 ))}
else
POL_SetupWindow_message "$(eval_gettext 'No setup location found in autorun.inf')" "$(eval_gettext 'Autorun')"
POL_SetupWindow_Close
exit 0
fi
if [ ! "$NameIs" = "" ]
then
NameIsNum=${#NameIs}
NameIs=${NameIs:0:$(( NameIsNum -1 ))}
fi
if [ ! "$IconIs" = "" ]
then
IconIsNum=${#IconIs}
IconIs=${IconIs:0:$(( IconIsNum -1 ))}
fi
# Assumes last component is "autorun.inf", in root directory
cdromDirIs="${1%/*}"
if [ "$IconIs" = "" ]
then
$IconIs = "null"
fi
icon_test=`ls "$cdromDirIs" | grep $IconIs -i`
if [ "$icon_test" = "" ]
then
IconIs="$PLAYONLINUX/etc/playonlinux.png"
else
IconIs="$cdromDirIs/$icon_test"
fi
if [ ! "$(echo $IconIs | grep '.exe$')" = "" ]
then
IconIs="$PLAYONLINUX/etc/playonlinux.png"
fi
POL_Debug_Message $cdromDirIs
POL_Debug_Message "Setup path : $cdromDirIs/$SetupIs"
POL_Debug_Message "CD name : $cdromDirIs/$NameIs"
POL_Debug_Message "Icon : $IconIs"
POL_Debug_Message "WinePrefix : $Prefix"
SETUP_PATH="$cdromDirIs/$SetupIs"
}
POL_SetupWindow_Init
POL_SetupWindow_free_presentation "$(eval_gettext 'Manual installation')" "$(eval_gettext 'Welcome to $APPLICATION_TITLE manual installation wizard.\n\nThis script will allow you to install any program on $APPLICATION_TITLE and use it with all the tools\n\nWarning: We are unable to guarantee that your application will work perfectly.')"
LNG_LI_NEW="$(eval_gettext "Install a program in a new virtual drive")"
LNG_LI_PATCH="$(eval_gettext "Edit or update an existing application")"
POL_SetupWindow_menu "$(eval_gettext "What would you like to do?")" "$(eval_gettext 'Manual installation')" "$LNG_LI_NEW~$LNG_LI_PATCH" "~"
menu="$APP_ANSWER"
if [ "$menu" = "" ]
then
POL_Debug_Error "No action chosen"
POL_SetupWindow_Close
exit 0
fi
if [ "$menu" = "$LNG_LI_NEW" ]
then
while true; do
POL_SetupWindow_textbox "$(eval_gettext "Please type a name for your application's virtual drive.\nThis name shouldn't contain spaces.")" "$TITLE"
[[ "$APP_ANSWER" =~ [/\ ] ]] || break
done
PREFIXNAME="$APP_ANSWER"
POL_Wine_SelectPrefix "$PREFIXNAME"
fi
if [ "$menu" = "$LNG_LI_PATCH" ]
then
POL_SetupWindow_prefix_selector "$(eval_gettext "Please choose a program")"
PREFIXNAME="$APP_ANSWER"
POL_Wine_SelectPrefix "$APP_ANSWER"
fi
if [ "$WINEPREFIX" = "" ]
then
POL_Debug_Fatal "No name chosen"
fi
LNG_WC_ASSWV=$(eval_gettext "Use another version of Wine")
LNG_WC_CONFWINE=$(eval_gettext "Configure Wine")
LNG_WC_USEWT=$(eval_gettext "Install some libraries")
ITEMS="$LNG_WC_ASSWV~$LNG_WC_CONFWINE~$LNG_WC_USEWT"
POL_SetupWindow_checkbox_list "$(eval_gettext "What would you like to do before installation?")\n$(eval_gettext "If you don't know, unselect all")" "$TITLE" "$ITEMS" "~"
WHATTORUNBEFORE="$APP_ANSWER"
#Running AssignWine
if [ "$(echo $WHATTORUNBEFORE | grep -o "$LNG_WC_ASSWV")" == "$LNG_WC_ASSWV" ]
then
WINEVERSIONLIST="System"
WINEVERSIONDIRLIST=$(find "$POL_USER_ROOT/wine/$OS_NAME-$POL_ARCH/"* -maxdepth 0 -type d)
for single in $WINEVERSIONDIRLIST ; do
singleparsed=${single##*/}
WINEVERSIONLIST="$WINEVERSIONLIST~$singleparsed"
done
POL_SetupWindow_menu "$(eval_gettext "Which version of Wine would you like to use?")" "$TITLE" "$WINEVERSIONLIST" "~"
WINEVERSIONLIVE="$APP_ANSWER"
if [ "$WINEVERSIONLIVE" = "System" ]
then
WINEVERSIONLIVE=""
else
export POL_WINEVERSION="$WINEVERSIONLIVE"
fi
POL_System_SetArch "x86"
fi
# If system is wine64 capable, let the user choose the type of prefix
if [ "$AMD64_COMPATIBLE" = "True" ]; then
POL_SetupWindow_menu_num "$(eval_gettext 'What kind of virtual drive do you want to create')" "$TITLE" "32 bits windows installation~64 bits windows installation" "~"
arch="$APP_ANSWER"
else
arch="0"
fi
if [ "$arch" = "1" ]; then
POL_System_SetArch "amd64"
WINEVERSIONLIST=""
else
POL_System_SetArch "x86"
WINEVERSIONLIST="System"
fi
if [ "$menu" = "$LNG_LI_NEW" ]
then
POL_Wine_PrefixCreate
fi
#Running WineConfiguration
if [ "$(echo $WHATTORUNBEFORE | grep -o "$LNG_WC_CONFWINE")" == "$LNG_WC_CONFWINE" ]
then
POL_SetupWindow_wait_next_signal "$(eval_gettext "Configure Wine")" "$(eval_gettext 'Manual installation')"
cd "$WINEPREFIX"
POL_Wine winecfg
fi
#Running POL_Calls
if [ "$(echo $WHATTORUNBEFORE | grep -o "$LNG_WC_USEWT")" == "$LNG_WC_USEWT" ]
then
[ "$WINEPREFIX" == "" ] && POL_Debug_Fatal "WINEPREFIX is not set"
POL_Wine_AutoSetVersionEnv
wineserver -k
ITEMS=$($POL_WGET $SITE/V4_data/repository/getf.php -O-)
POL_SetupWindow_checkbox_list "$(eval_gettext "Please make your choice")" "$APPLICATION_TITLE" "$ITEMS" "/"
oldifs="$IFS"
IFS=/
set "$APP_ANSWER"
for i in $*
do
IFS="$oldifs"
POL_Debug_Message "POL_Call_list is calling $i"
POL_Call "$i"
done
IFS="$oldifs"
fi
[ "$POL_OS" = "Mac" ] && MEDIA_DIR="/Volumes"
if [ "$POL_OS" = "Linux" ] || [ "$POL_OS" = "FreeBSD" ]; then
MEDIA_DIR="/media"
# Ubuntu Quantal workaround
[ -d "/media/$USER" ] && MEDIA_DIR="/media/$USER"
# Fedora/Manjaro workaround
[ -d "/run/media/$USER" ] && DEVICES="/run/media/$USER"
fi
A_LIST=""
i=0
POL_SetupWindow_wait "$(eval_gettext 'Looking for runnable CD-ROMs')" "$TITLE"
cd "$MEDIA_DIR"
for device in *
do
AutorunInf=$(ls "$MEDIA_DIR/$device" | grep -i "autorun.inf")
POL_Debug_Message "Autorun : Checking $device..."
if [ ! "$AutorunInf" = "" ]
then
POL_Debug_Message "Autorun : Found $MEDIA_DIR/$device/$AutorunInf"
if [ $i = 0 ]
then
A_LIST="$MEDIA_DIR/$device/$AutorunInf"
B_LIST="CD-ROM : $device"
else
A_LIST="$A_LIST#$MEDIA_DIR/$device/$AutorunInf"
B_LIST="$B_LIST#CD-ROM : $device"
fi
i=$(( i+1 ))
fi
done
POL_Debug_Message "Autorun: Found $i media"
LNG_MANUAL_FILE="$(eval_gettext "Select another file")"
if [ ! "$i" = "0" ]
then
A_LIST="$A_LIST#MANUAL"
B_LIST="$B_LIST#$LNG_MANUAL_FILE"
POL_SetupWindow_menu_num "$(eval_gettext 'Please choose a way to install your program')" "$TITLE" "$B_LIST" "#"
N="$APP_ANSWER"
POL_Debug_Message "Action $N choosen"
CHOICE="$(cut -d "#" -f$(( N + 1 )) <<< "$A_LIST")"
fi
if [ "$CHOICE" = "MANUAL" ] || [ "$i" = "0" ]
then
cd "$HOME"
POL_SetupWindow_browse "$(eval_gettext "Please select the install file to run.")" "$TITLE"
SETUP_PATH="$APP_ANSWER"
else
run_autorun "$CHOICE"
fi
if [ "$SETUP_PATH" = "" ]
then
POL_SetupWindow_message "$(eval_gettext "You must choose a file!")" "$TITLE"
POL_SetupWindow_Close
exit 1
fi
WORKINGSETUP_PATH="$cdromDirIs/$NameIs"
cd "$WORKINGSETUP_PATH"
POL_SetupWindow_wait "$(eval_gettext '$APPLICATION_TITLE is installing your application...')" "$TITLE"
extension=$(echo "$SETUP_PATH" | $SED 's/.*\.//g')
if [ "$extension" = "msi" ]
then
POL_Wine msiexec /i "$SETUP_PATH"
else
POL_Wine "$SETUP_PATH"
fi
POL_Wine_WaitExit
rm "$POL_USER_ROOT/tmp/shortcuts" 2> /dev/null
POL_SetupWindow_shortcut_creator "$WINEVERSIONLIVE"
POL_SetupWindow_Close
exit