@@ -185,8 +185,7 @@ abortInstall() {
185
185
186
186
startInstall () {
187
187
188
- local magic desc
189
- local msg=" Windows is being started, please wait..."
188
+ html " Starting Windows..."
190
189
191
190
if [ -f " $STORAGE /$CUSTOM " ]; then
192
191
@@ -207,36 +206,24 @@ startInstall() {
207
206
208
207
BASE=" $VERSION .iso"
209
208
210
- if ! skipInstall && [ ! -f " $STORAGE /$BASE " ]; then
211
-
212
- desc=$( printVersion " $VERSION " )
213
- [ -z " $desc " ] && desc=" Windows"
214
- msg=" $desc is being downloaded, please wait..."
215
- fi
216
-
217
209
else
218
210
219
211
BASE=$( basename " ${VERSION%% \? * } " )
220
212
: " ${BASE// +/ } " ; printf -v BASE ' %b' " ${_//%/ \\ x} "
221
213
BASE=$( echo " $BASE " | sed -e ' s/[^A-Za-z0-9._-]/_/g' )
222
214
223
- if ! skipInstall && [ ! -f " $STORAGE /$BASE " ]; then
224
- msg=" Image '$BASE ' is being downloaded, please wait..."
225
- fi
226
-
227
215
fi
228
216
229
217
[[ " ${BASE,,} " == " custom." * ]] && BASE=" windows.iso"
230
218
231
219
fi
232
220
233
- html " $msg "
234
-
235
221
[ -z " $MANUAL " ] && MANUAL=" N"
236
222
237
223
if [ -f " $STORAGE /$BASE " ]; then
238
224
239
225
# Check if the ISO was already processed by our script
226
+ local magic=" "
240
227
magic=$( dd if=" $STORAGE /$BASE " seek=0 bs=1 count=1 status=none | tr -d ' \000' )
241
228
magic=" $( printf ' %s' " $magic " | od -A n -t x1 -v | tr -d ' \n' ) "
242
229
@@ -277,34 +264,53 @@ downloadImage() {
277
264
278
265
local iso=" $1 "
279
266
local url=" $2 "
280
- local progress
267
+ local file=" $iso "
268
+ local desc=" $BASE "
269
+ local rc progress
270
+
281
271
rm -f " $iso "
282
272
283
273
if [[ " $EXTERNAL " != [Yy1]* ]]; then
284
274
285
- cd " $TMP "
286
- if ! /run/mido.sh " $url " ; then
287
- return 1
288
- fi
289
- cd /run
275
+ file=" $iso .PART"
276
+ desc=$( printVersion " $VERSION " )
277
+ [ -z " $desc " ] && desc=" Windows"
290
278
291
- [ ! -f " $iso " ] && return 1
292
- return 0
293
279
fi
294
280
295
- info " Downloading $BASE as boot image..."
281
+ local msg=" Downloading $desc ..."
282
+ info " $msg " && html " $msg "
283
+
284
+ /run/progress.sh " $file " " Downloading $desc ([P])..." &
285
+
286
+ if [[ " $EXTERNAL " != [Yy1]* ]]; then
287
+
288
+ cd " $TMP "
289
+ { /run/mido.sh " $url " ; rc=$? ; } || :
290
+ cd /run
291
+
292
+ fKill " progress.sh"
293
+ (( rc != 0 )) && return 1
296
294
297
- # Check if running with interactive TTY or redirected to docker log
298
- if [ -t 1 ]; then
299
- progress=" --progress=bar:noscroll"
300
295
else
301
- progress=" --progress=dot:giga"
302
- fi
303
296
304
- { wget " $url " -O " $iso " -q --no-check-certificate --show-progress " $progress " ; rc=$? ; } || :
305
- (( rc != 0 )) && error " Failed to download $url , reason: $rc " && exit 60
297
+ # Check if running with interactive TTY or redirected to docker log
298
+ if [ -t 1 ]; then
299
+ progress=" --progress=bar:noscroll"
300
+ else
301
+ progress=" --progress=dot:giga"
302
+ fi
303
+
304
+ { wget " $url " -O " $iso " -q --no-check-certificate --show-progress " $progress " ; rc=$? ; } || :
305
+
306
+ fKill " progress.sh"
307
+ (( rc != 0 )) && error " Failed to download $url , reason: $rc " && exit 60
308
+
309
+ fi
306
310
307
311
[ ! -f " $iso " ] && return 1
312
+
313
+ html " Download finished successfully..."
308
314
return 0
309
315
}
310
316
0 commit comments