-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHTTRack.sh
825 lines (663 loc) · 23.1 KB
/
HTTRack.sh
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
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
#!/bin/bash
Location=$HOME/Downloads/WebCopies
# DO NOT EDIT BELOW HERE !!
if ! [ -e /usr/bin/httrack ]
then
printf "Install HTTRack first!\n"
exit 1
fi
if [ -e /usr/bin/konsole ]
then
Desktop="KDE"
else
if [ -e /usr/bin/gnome-terminal ]
then
Desktop="Gnome"
else
Desktop="?"
fi
fi
function Confirm
{
if [ $# -gt 0 ]
then
Ask="yes"
while [ $Ask = "yes" ]
do
printf "\n" > /dev/tty
Choises=""
for Item in $@
do
Ch=${Item:0:1}
eval $Ch=$Item
printf "$Ch: $Item\n" > /dev/tty
Choises="$Choises$Ch"
done
printf '\033[1;33m'"Choose ($Choises)? "'\033[0m' > /dev/tty
read -n1 Choise
if [[ "$Choises" =~ "$Choise" ]]
then
eval Result=\$$Choise
printf "$Result"
Ask="no"
fi
printf "\n" > /dev/tty
done
else
Confirm "Yes" "No"
fi
}
function Select
{
if [ $# -gt 0 ]
then
printf '\033[1;33m'"\nMake a choise:"'\033[0m' > /dev/tty
Confirm $@
else
Confirm
fi
}
function HTTRack
{
clear
printf '\033[1;31m'"New PROJECT:\n\n"'\033[0m'
printf '\033[1;33m'"\tNAME:\t"'\033[0m'"$Name\n\n"'\033[1;33m'"\tURL:\t"'\033[0m'"$URL\n\n"'\033[1;33m'"\tMODE:\t"'\033[0m'"$Mode\n\n"'\033[1;33m'"\tJava:\t"'\033[0m'"$Java\n\n"'\033[1;33m'"\tDesktop:\t"'\033[0m'"$Desktop\n\n\n\n"
sleep 2
case $Desktop in
"KDE")
if [ "$Name" != "" ] && [ "$URL" != "" ] && [ "$Mode" != "" ] && [ "$Java" != "" ]
then
case "$Mode" in
"normal")
if [ "$Java" = "Yes" ]
then
konsole --new-tab --workdir "$Location" -e "httrack --path \"$Name\" --mirror $URL --keep-alive --test --disable-security-limits --depth=99999 --advanced-maxlinks=16777215 --ext-depth=0 --max-rate=3000000 --sockets=4 --timeout=30 --retries=2 --structure=0 --replace-external --generate-errors --cookies=0 --check-type=2 --parse-java=1 -%P --robots=0 --tolerant --updatehack --urlhack --user-agent \"HTTP(S)\" --referer \"REFERER\" --from \"FROM\" --footer \"<meta app='HTTRack'>\" --language \"en, *\" --verbose --index --purge-old=0 $Subs $Extras"
sleep 60
else
konsole --new-tab --workdir "$Location" -e "httrack --path \"$Name\" --mirror $URL --keep-alive --test --disable-security-limits --depth=99999 --advanced-maxlinks=16777215 --ext-depth=0 --max-rate=3000000 --sockets=4 --timeout=30 --retries=2 --structure=0 --replace-external --generate-errors --cookies=0 --check-type=2 --parse-java=0 -%P --robots=0 --tolerant --updatehack --urlhack --user-agent \"HTTP(S)\" --referer \"REFERER\" --from \"FROM\" --footer \"<meta app='HTTRack'>\" --language \"en, *\" --verbose --index --purge-old=0 $Subs $Extras"
sleep 60
fi
;;
"verbose")
if [ "$Java" = "Yes" ]
then
konsole --new-tab --workdir "$Location" -e "httrack --path \"$Name\" --verbose --mirror $URL --keep-alive --test --disable-security-limits --depth=99999 --advanced-maxlinks=16777215 --ext-depth=0 --max-rate=3000000 --sockets=4 --timeout=30 --retries=2 --structure=0 --replace-external --generate-errors --cookies=0 --check-type=2 --parse-java=1 -%P --robots=0 --tolerant --updatehack --urlhack --user-agent \"HTTP(S)\" --referer \"REFERER\" --from \"FROM\" --footer \"<meta app='HTTRack'>\" --language \"en, *\" --verbose --index --purge-old=0 $Subs $Extras"
sleep 60
else
konsole --new-tab --workdir "$Location" -e "httrack --path \"$Name\" --verbose --mirror $URL --keep-alive --test --disable-security-limits --depth=99999 --advanced-maxlinks=16777215 --ext-depth=0 --max-rate=3000000 --sockets=4 --timeout=30 --retries=2 --structure=0 --replace-external --generate-errors --cookies=0 --check-type=2 --parse-java=0 -%P --robots=0 --tolerant --updatehack --urlhack --user-agent \"HTTP(S)\" --referer \"REFERER\" --from \"FROM\" --footer \"<meta app='HTTRack'>\" --language \"en, *\" --verbose --index --purge-old=0 $Subs $Extras"
sleep 60
fi
;;
"display")
if [ "$Java" = "Yes" ]
then
konsole --new-tab --workdir "$Location" -e "httrack --path \"$Name\" --display --mirror $URL --keep-alive --test --disable-security-limits --depth=99999 --advanced-maxlinks=16777215 --ext-depth=0 --max-rate=3000000 --sockets=4 --timeout=30 --retries=2 --structure=0 --replace-external --generate-errors --cookies=0 --check-type=2 --parse-java=1 -%P --robots=0 --tolerant --updatehack --urlhack --user-agent \"HTTP(S)\" --referer \"REFERER\" --from \"FROM\" --footer \"<meta app='HTTRack'>\" --language \"en, *\" --verbose --index --purge-old=0 $Subs $Extras"
sleep 60
else
konsole --new-tab --workdir "$Location" -e "httrack --path \"$Name\" --display --mirror $URL --keep-alive --test --disable-security-limits --depth=99999 --advanced-maxlinks=16777215 --ext-depth=0 --max-rate=3000000 --sockets=4 --timeout=30 --retries=2 --structure=0 --replace-external --generate-errors --cookies=0 --check-type=2 --parse-java=0 -%P --robots=0 --tolerant --updatehack --urlhack --user-agent \"HTTP(S)\" --referer \"REFERER\" --from \"FROM\" --footer \"<meta app='HTTRack'>\" --language \"en, *\" --verbose --index --purge-old=0 $Subs $Extras"
sleep 60
fi
;;
esac
fi
;;
"Gnome") # "TO_DO"
if [ "$Name" != "" ] && [ "$URL" != "" ] && [ "$Mode" != "" ] && [ "$Java" != "" ]
then
case "$Mode" in
"normal")
if [ "$Java" = "Yes" ]
then
gnome-terminal --tab --profile="Default" --working-directory="$Location" -- httrack --path $Name --mirror $URL --keep-alive --test --disable-security-limits --depth=99999 --advanced-maxlinks=16777215 --ext-depth=0 --max-rate=3000000 --sockets=4 --timeout=30 --retries=2 --structure=0 --replace-external --generate-errors --cookies=0 --check-type=2 --parse-java=1 -%P --robots=0 --tolerant --updatehack --urlhack --user-agent 'HTTP(S)' --referer 'REFERER' --from 'FROM' --footer '<meta app="HTTRack">' --language 'en,*' --verbose --index --purge-old=0 $Subs $Extras
sleep 60
else
gnome-terminal --tab --profile="Default" --working-directory="$Location" -- httrack --path $Name --mirror $URL --keep-alive --test --disable-security-limits --depth=99999 --advanced-maxlinks=16777215 --ext-depth=0 --max-rate=3000000 --sockets=4 --timeout=30 --retries=2 --structure=0 --replace-external --generate-errors --cookies=0 --check-type=2 --parse-java=0 -%P --robots=0 --tolerant --updatehack --urlhack --user-agent 'HTTP(S)' --referer 'REFERER' --from 'FROM' --footer '<meta app="HTTRack">' --language 'en,*' --verbose --index --purge-old=0 $Subs $Extras
sleep 60
fi
;;
"verbose")
if [ "$Java" = "Yes" ]
then
gnome-terminal --tab --profile="Default" --working-directory="$Location" -- httrack --verbose --path $Name --mirror $URL --keep-alive --test --disable-security-limits --depth=99999 --advanced-maxlinks=16777215 --ext-depth=0 --max-rate=3000000 --sockets=4 --timeout=30 --retries=2 --structure=0 --replace-external --generate-errors --cookies=0 --check-type=2 --parse-java=1 -%P --robots=0 --tolerant --updatehack --urlhack --user-agent 'HTTP(S)' --referer 'REFERER' --from 'FROM' --footer '<meta app="HTTRack">' --language 'en,*' --verbose --index --purge-old=0 $Subs $Extras
sleep 60
else
gnome-terminal --tab --profile="Default" --working-directory="$Location" -- httrack --verbose --path $Name --mirror $URL --keep-alive --test --disable-security-limits --depth=99999 --advanced-maxlinks=16777215 --ext-depth=0 --max-rate=3000000 --sockets=4 --timeout=30 --retries=2 --structure=0 --replace-external --generate-errors --cookies=0 --check-type=2 --parse-java=0 -%P --robots=0 --tolerant --updatehack --urlhack --user-agent 'HTTP(S)' --referer 'REFERER' --from 'FROM' --footer '<meta app="HTTRack">' --language 'en,*' --verbose --index --purge-old=0 $Subs $Extras
sleep 60
fi
;;
"display")
if [ "$Java" = "Yes" ]
then
gnome-terminal --tab --profile="Default" --working-directory="$Location" -- httrack --display --path $Name --mirror $URL --keep-alive --test --disable-security-limits --depth=99999 --advanced-maxlinks=16777215 --ext-depth=0 --max-rate=3000000 --sockets=4 --timeout=30 --retries=2 --structure=0 --replace-external --generate-errors --cookies=0 --check-type=2 --parse-java=1 -%P --robots=0 --tolerant --updatehack --urlhack --user-agent 'HTTP(S)' --referer 'REFERER' --from 'FROM' --footer '<meta app="HTTRack">' --language 'en,*' --verbose --index --purge-old=0 $Subs $Extras
sleep 60
else
gnome-terminal --tab --profile="Default" --working-directory="$Location" -- httrack --display --path $Name --mirror $URL --keep-alive --test --disable-security-limits --depth=99999 --advanced-maxlinks=16777215 --ext-depth=0 --max-rate=3000000 --sockets=4 --timeout=30 --retries=2 --structure=0 --replace-external --generate-errors --cookies=0 --check-type=2 --parse-java=0 -%P --robots=0 --tolerant --updatehack --urlhack --user-agent 'HTTP(S)' --referer 'REFERER' --from 'FROM' --footer '<meta app="HTTRack">' --language 'en,*' --verbose --index --purge-old=0 $Subs $Extras
sleep 60
fi
;;
esac
fi
;;
"?")
echo "TO_DO"
;;
esac
}
function GetProjects
{
printf '\033[1;33m'"Projects:\n"'\033[0m'
Count=0
for Item in *
do
if [ "$Item" != "*" ]
then
if [ -d "$Item" ] && [ -d "$Item/hts-cache" ]
then
((Count++))
eval Project$Count=$Item
if [ $Count -gt 99 ]
then
printf "$Count: $Item\n"
elif [ $Count -gt 9 ]
then
printf " $Count: $Item\n"
else
printf " $Count: $Item\n"
fi
else
printf " : $Item\n"
fi
fi
done
printf "\n"
return $Count
}
DirStart=$(pw)
[ ! -d $Location ] && mkdir -p $Location
Run=true
while ($Run)
do
cd $Location
clear
printf '\033[1;33m'"\n\tMAIN MENU\n\n"'\033[0m'
Count=0
GetProjects
if [ $Count -gt 0 ]
then
Action=`Select 'continue' 'ContinueAll' 'update' 'UpdateAll' 'xClean' 'XCleanAll' 'release' 'delete' 'new' 'quit'`
else
Action=`Select 'new' 'quit'`
fi
printf "\nAction: $Action\n\n"
case $Action in
"new") # Continue download:
clear
printf '\033[1;33m'"Create a new download?\n\n"'\033[0m'
read -p "Enter Project-NAME or leave empty to abort: " Name
if [ "$Name" != "" ]
then
printf "\n"
read -p "Enter URLs: " URL
Ask="yes"
while [ $Ask = "yes" ]
do
Subs=""
printf "\nInclude sub-domains?"
if [ $(Confirm "yes" "no") = "yes" ]
then
if [[ "$URL" =~ "https://" ]]
then
if [[ "$URL" =~ "www." ]]
then
Subs="+https://*.${URL#*www.}/*"
else
Subs="+https://*.${URL#https://}/*"
fi
elif [[ "$URL" =~ "http://" ]]
then
if [[ "$URL" =~ "www." ]]
then
Subs="+http://*.${URL#*www.}/*"
else
Subs="+http://*.${URL#http://}/*"
fi
else
if [[ "$URL" =~ "www." ]]
then
Subs="+*.${URL#www.}/*"
else
printf "\n"
read -p "Enter sub-domains: " Subs
fi
fi
printf "\nIs this correct ($Subs)?"
if [ $(Confirm "yes" "no") = "yes" ] ; then Ask="no" ; fi
else
Ask="no"
fi
done
clear
printf '\033[1;33m'"Create a new download..\n\n"'\033[0m'
Ask="yes"
while [ $Ask = "yes" ]
do
Extras=""
printf "\nInclude additional extentions?"
if [ $(Confirm "yes" "no") = "yes" ]
then
case $(Select "auto" "manuel") in
"auto")
printf "\nInclude DOCUMENTs (doc,docx,msg,odt,pages,rtf,tex,tif,tiff,txt,wpd,wps)?"
if [ $(Confirm) = "yes" ]
then
Extras+="+*.doc +*.docx +*.log +*.msg +*.odt +*.pages +*.rtf +*.tex +*.tif +*.tiff +*.txt +*.wpd +*.wps"
fi
printf "\nInclude AUDIOs (aif,iff,m3u,m4a,mid,mp3,mpa,mts,mats,mvts,wav,weba,wma)?"
if [ $(Confirm) = "yes" ]
then
Extras+="+*.aif +*.iff +*.m3u +*.m4a +*.mid +*.mp3 +*.mpa +*.mts +*.mats +*.mvts +*.wav +*.weba +*.wma"
fi
printf "\nInclude VIDEOs (3g2,3gp,asf,avi,flv,m4v,mov,mp4,mpg,rm,srt,swf,vob,webm,wmv)?"
if [ $(Confirm ) = "yes" ]
then
Extras+="+*.3g2 +*.3gp +*.asf +*.avi +*.flv +*.m4v +*.mov +*.mp4 +*.mpg +*.rm +*.srt +*.swf +*.vob +*.webm +*.wmv"
fi
printf "\nInclude 3D-Images (3dm,3ds,blend,max,obj,stl)?"
if [ $(Confirm) = "yes" ]
then
Extras+="+*.3dm +*.3ds +*.blend +*.max +*.obj +*.stl"
fi
printf "\nInclude VECTOR-Images (ai,eps,svg)?"
if [ $(Confirm) = "yes" ]
then
Extras+="+*.ai +*.eps +*.svg"
fi
printf "\nInclude RASTER-Images (bpg,bmp,deep,drw,ecw,fits,flif,gem,gif,hdr,heif,ico,iff,ilbm,img,jpeg,jfif,jpg,liff,,nrrd,pam,pbm,pcx,pgf,pgm,plbm,png,pnm,ppm,sgi,sid,tga,tif,tiff,webp,xisf)?"
if [ $(Confirm) = "yes" ]
then
Extras+="+*.bpg +*.bmp +*.deep +*.drw +*.ecw +*.fits +*.flif +*.gem +*.gif +*.hdr +*.heif +*.ico +*.iff +*.ilbm +*.img +*.jpeg +*.jfif +*.jpg +*.liff +*.nrrd +*.pam +*.pbm +*.pcx +*.pgf +*.pgm +*.plbm +*.png +*.pnm +*.ppm +*.sgi +*.sid +*.tga +*.tif +*.tiff +*.webp +*.xisf"
fi
printf "\nInclude Layout-files (indd,pct,pdf)?"
if [ $(Confirm) = "yes" ]
then
Extras+="+*.indd +*.pct +*.pdf"
fi
printf "\nInclude SPREADSHEATS (xlr,xls,xlsx)?"
if [ $(Confirm ) = "yes" ]
then
Extras+="+*.xlr +*.xls +*.xlsx"
fi
printf "\nInclude DATABASEs (accdb,db,dbf,mdb,pdb,sql)?"
if [ $(Confirm) = "yes" ]
then
Extras+="+*.accdb +*.db +*.dbf +*.mdb +*.pdb +*.sql"
fi
printf "\nInclude RUNABLES (apk,app,bat,cgi,com,exe,gadget,jar,swf,wsf)?"
if [ $(Confirm) = "yes" ]
then
Extras+="+*.apk +*.app +*.bat +*.cgi +*.com +*.exe +*.gadget +*.jar +*.swf +*.wsf"
fi
printf "\nInclude ROMs (b,dem,gam,nes,rom,sav)?"
if [ $(Confirm) = "yes" ]
then
Extras+="+*.b +*.dem +*.gam +*.nes +*.rom +*.sav"
fi
printf "\nInclude CAD-files (cad,dwg,dxf)?"
if [ $(Confirm) = "yes" ]
then
Extras+="+*.cad +*.dwg +*.dxf"
fi
printf "\nInclude GIS-files (gis,gpx,kml,kmz)?"
if [ $(Confirm) = "yes" ]
then
Extras+="+*.gis +*.gpx +*.kml +*.kmz"
fi
printf "\nInclude WEB-files (asp,aspx,cer,cfm,crdownload,csr,css,dcr,htm,html,js,jsp,php,rss,xhtml)?"
if [ $(Confirm) = "yes" ]
then
Extras+="+*.asp +*.aspx +*.cer +*.cfm +*.crdownload +*.csr +*.css +*.dcr +*.htm +*.html +*.js +*.jsp +*.php +*.rss +*.xhtml"
fi
printf "\nInclude PLUGINs (crx,plugin)?"
if [ $(Confirm) = "yes" ]
then
Extras+="+*.crx +*.plugin"
fi
printf "\nInclude SYSTEM-files (cab,cpl,cur,deskthemepack,dll,dmp,drv,icns,ico,lnk,log,sys)?"
if [ $(Confirm) = "yes" ]
then
Extras+="+*.cab +*.cpl +*.cur +*.deskthemepack +*.dll +*.dmp +*.drv +*.icns +*.ico +*.lnk +*.sys"
fi
printf "\nInclude CONFIG-files (cfg,ini,prf)?"
if [ $(Confirm) = "yes" ]
then
Extras+="+*.cfg +*.ini +*.prf"
fi
printf "\nInclude ENCODED-files (hqx,mim,uue)?"
if [ $(Confirm) = "yes" ]
then
Extras+="+*.hqx +*.mim +*.uue"
fi
printf "\nInclude ARCHIVE (7z,cbr,deb,gz,pkg,rar,rpm,sitx,tar,gz,zip,zipx)?"
if [ $(Confirm) = "yes" ]
then
Extras+="+*.7z +*.cbr +*.deb +*.gz +*.pkg +*.rar +*.rpm +*.sitx +*.tar +*.gz +*.zip +*.zipx"
fi
printf "\nInclude DISK-IMAGEs (bin,cue,dmg,iso,mdf,toast,vcd)?"
if [ $(Confirm) = "yes" ]
then
Extras+="+*.bin +*.cue +*.dmg +*.iso +*.mdf +*.toast +*.vcd"
fi
printf "\nInclude DEVELOPMENT-files (c,class,cpp,cs,dtd,fla,h,java,lua,m,pl,py,sh,sln,swift,vb,vcxproj,xcodeproj)?"
if [ $(Confirm) = "yes" ]
then
Extras+="+*.c +*.class +*.cpp +*.cs +*.dtd +*.fla +*.h +*.java +*.lua +*.m +*.pl +*.py +*.sh +*.sln +*.swift +*.vb +*.vcxproj +*.xcodeproj"
fi
printf "\nInclude BACKUPs (bak,tmp)?"
if [ $(Confirm) = "yes" ]
then
Extras+="+*.bak +*.tmp"
fi
printf "\nInclude MISC-files (ics,msi,part,torrent)?"
if [ $(Confirm) = "yes" ]
then
Extras+="+*.ics +*.msi +*.part +*.torrent"
fi
;;
"manuel")
printf "\n"
read -p "Enter extras: " Extras
;;
esac
printf '\033[1;33m'"\n\nEXTRAS: `if [ \"$Extras\" = \"\" ] ; then printf \"none\" ; else printf \"$Extras\" ; fi`\n"'\033[0m'"Is this correct?"
if [ $(Confirm "yes" "no") = "yes" ]; then Ask="no" ; fi
else
Ask="no"
fi
done
clear
printf '\033[1;33m'"\nCreate a new download..\n"'\033[0m'
printf "\nEnable 'JavaScript' analyse?"
Java=$(Confirm "yes" "no")
clear
printf '\033[1;33m'"\nCreate a new download:\n"'\033[0m'
printf "\nChoose type of output:\n"
Mode=$(Select 'normal' 'verbose' 'display')
clear
printf '\033[1;33m'"Create a new download:\n"'\033[0m'
printf "\nNAME: $Name\n\nURL (sub-domains): $URL ($Subs)\n\nEXTRAs: $Extras\n\nJAVA: $Java\n\nMODE: $Mode\n\n"
printf '\033[1;31m'"\n===> Continue with httrack ?"'\033[0m'
if [ $(Confirm "Yes" "No") = "Yes" ]
then
HTTRack &
else
printf "Aborted!\n"
fi
else
printf "Aborted!\n"
fi
sleep 5
;;
"continue") # Continue download:
printf '\033[1;33m'"\nContinue a download..\n"'\033[0m'"Enter projectnumber or leave empty to abort:\n"
read -p "=> " Param
if [ "$Param" != "" ]
then
eval Project=\$Project$Param
if [ -d "$Project/hts-cache" ]
then
if [ $(Confirm "Yes" "No") = "Yes" ]
then
cd $Project
case "$Desktop" in
"KDE")
konsole --new-tab --workdir "$Location/$Project" -e "httrack --continue" &
;;
"Gnome")
gnome-terminal --tab --profile="Default" --working-directory="$Location/$Project" -- httrack --continue &
;;
"?")
echo "TO_DO"
;;
esac
printf "Started!\n"
cd ..
else
printf "Aborted!\n"
fi
else
printf "\nInvali project-number!\n"
fi
else
printf "Aborted!\n"
fi
sleep 3
;;
"ContinueAll") # Continue all downloads:
printf '\033[1;33m'"\nContinue all downloads?"'\033[0m'
if [ $(Confirm "Yes" "No") = "Yes" ]
then
Param=0
while [ $Param -lt $Count ]
do
((Param++))
eval Project=\$Project$Param
if [ -d "$Project/hts-cache" ]
then
cd $Project
case "$Desktop" in
"KDE")
konsole --new-tab --workdir "$Location/$Project" -e "httrack --continue" &
;;
"Gnome")
gnome-terminal --tab --profile="Default" --working-directory="$Location/$Project" -- httrack --continue &
;;
"?")
echo "TO_DO"
;;
esac
printf "$Project: Started!\n"
sleep 3
cd ..
else
printf "\nInvali project-number!\n"
fi
done
else
printf "Aborted!\n"
fi
sleep 3
;;
"update") # Upate a download:
printf '\033[1;33m'"\nUpdate a download?\n"'\033[0m'"Enter projectnumber or leave empty to abort:\n"
read -p "=> " Param
if [ "$Param" != "" ]
then
eval Project=\$Project$Param
if [ -d "$Project/hts-cache" ]
then
if [ $(Confirm "Yes" "No") = "Yes" ]
then
cd $Project
case "$Desktop" in
"KDE")
konsole --new-tab --workdir "$Location/$Project" -e "httrack --update" &
;;
"Gnome")
gnome-terminal --tab --profile="Default" --working-directory="$Location/$Project" -- httrack --update &
;;
"?")
echo "TO_DO"
;;
esac
printf "Started!\n"
cd ..
else
printf "Aborted!\n"
fi
else
printf "\nInvali project-number!\n"
fi
else
printf "Aborted!\n"
fi
sleep 3
;;
"UpdateAll") # Continue all downloads:
printf '\033[1;33m'"\nUpdate all downloads?\n"'\033[0m'
if [ $(Confirm "Yes" "No") = "Yes" ]
then
Param=0
while [ $Param -lt $Count ]
do
((Param++))
eval Project=\$Project$Param
if [ -d "$Project/hts-cache" ]
then
cd $Project
case "$Desktop" in
"KDE")
konsole --new-tab --workdir "$Location/$Project" -e "httrack --update" &
;;
"Gnome")
gnome-terminal --tab --profile="Default" --working-directory="$Location/$Project" -- httrack --update &
;;
"?")
echo "TO_DO"
;;
esac
printf "$Project: Started!\n"
sleep 3
cd ..
else
printf "\nInvali project-number!\n"
fi
done
else
printf "Aborted!\n"
fi
sleep 3
;;
"xClean") # Clean a download:
printf '\033[1;33m'"\nClean a download?\n"'\033[0m'"Enter projectnumber or leave empty to abort:\n"
read -p "=> " Param
if [ "$Param" != "" ]
then
eval Project=\$Project$Param
if [ -d "$Project/hts-cache" ]
then
if [ $(Confirm "Yes" "No") = "Yes" ]
then
cd $Project
find . -name *.tmp -print -delete
find . -empty -print -delete
cd ..
else
printf "Aborted!\n"
fi
else
printf "\nInvali project-number!\n"
fi
else
printf "Aborted!\n"
fi
sleep 3
;;
"XCleanAll") # Continue all downloads:
printf '\033[1;33m'"Clean all downloads?"'\033[0m'
if [ $(Confirm "Yes" "No") = "Yes" ]
then
Param=0
while [ $Param -lt $Count ]
do
((Param++))
eval Project=\$Project$Param
if [ -d "$Project/hts-cache" ]
then
cd $Project
find . -name *.tmp -print -delete
find . -empty -print -delete
cd ..
else
printf "\nInvali project-number!\n"
fi
done
else
printf "Aborted!\n"
fi
sleep 3
;;
"release") # Release a download:
printf '\033[1;33m'"\nRelease a download?\n"'\033[0m'"Enter projectnumber or leave empty to abort:\n"
read -p "=> " Param
if [ "$Param" != "" ]
then
eval Project=\$Project$Param
if [ -d "$Project/hts-cache" ]
then
if [ $(Confirm "Yes" "No") = "Yes" ]
then
cd $Project
for F in "hts-cache" "backblue.gif" "external.html" "fae.gif" "hts-in_progress.lock" "inex.html"
do
if [ -d "$F" ]
then
rm -v -r "$F"
elif [ -f "$F" ]
then
rm -v "$F"
else
printf "skip: $F\n"
fi
done
find . -name *.tmp -print -delete
find . -empty -print -delete
cd ..
else
printf "Aborted!\n"
fi
else
printf "\nInvali project-number!\n"
fi
else
printf "Aborted!\n"
fi
sleep 3
;;
"delete") # Delete a download:
printf '\033[1;33m'"\nDelete a download?\n"'\033[0m'"Enter projectnumber or leave empty to abort:\n"
read -p "=> " Param
if [ "$Param" != "" ]
then
eval Project=\$Project$Param
if [ -d "$Project/hts-cache" ]
then
printf '\033[1;31m'"\nAre you sure?\n"'\033[0m'
if [ $(Confirm "Yes" "No") = "Yes" ]
then
rm -v -r $Project
else
printf "Aborted!\n"
fi
else
printf "\nInvali project-number!\n"
fi
else
printf "Aborted!\n"
fi
sleep 3
;;
"quit") # End script:
printf '\033[1;33m'"\nDo you want to quit?\n"'\033[0m'
if [ $(Confirm "Yes" "No") = "Yes" ]
then
printf "\n\nThanks for using my script..\n"
Run=false
fi
;;
*)
echo "\nInvalid action; try again.\n"
sleep 1
esac
printf "\n"
done
exit 0