-
Notifications
You must be signed in to change notification settings - Fork 1
/
lazy.sh
1304 lines (1134 loc) · 37.5 KB
/
lazy.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
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/bash
uline='\e[4m'
bold='\e[21m'
black='\e[30m'
magenta='\e[31m'
green='\e[32m'
yellow='\e[33m'
blue='\e[34m'
red='\e[35m'
cyan='\e[36m'
blink='\e[5m'
endc='\e[0m'
default='\e[39m'
bgblue='\e[44m'
bglgray='\e[47m'
bgdefault='\e[49m'
bgcyan='\e[46m'
inverted='\e[7m'
bgyellow='\e[43m'
line='<==============================================================================>'
scriptloc=META-INF/com/google/android
aconfigloc=META-INF/com/google/android/aroma-config
coreusloc=/Working/META-INF/com/google/android/updater-script
uscriptloc=META-INF/com/google/android/updater-script
aromasorloc=META-INF/com/google/android/aroma
list_menu(){
menuchoice=00
#tree -di $1/ --noreport >$2
echo ''
cd $1
ls > $2
loop=`wc -l < $2`
echo -e "$cyan Number $endc | Path\n"
echo ''
for((i=1;i<=$loop;i++));
do
list=`echo -e "$cyan$i$endc : : " ;head -n $i $2 | tail -n 1`
echo -e $list
done
while [ $menuchoice == 00 ]
do
echo -en "\n$red Enter choice $cyan [1-$loop] $endc $endc : "
read menuchoice
if [ $menuchoice -ge 1 ] && [ $menuchoice -le $loop ];then
choice=`head -n $menuchoice $2 | tail -n 1`
menuchoice=99
#return $choice
else
echo -e "\nWrong choice! Enter Again \n"
menuchoice=00
fi
done
}
alert_window(){
echo ''
echo $line
echo -en "\n$red Enter Alert Prompt Title $endc : ";read alert_title
echo -en "\n$red Enter Alert Text $endc : ";read alert_text
cat >> $aconfigloc <<EOF
##
# Alert Window
#
alert( "$alert_title", "$alert_text");
EOF
}
aroma_builder(){
mkdir -p $scriptloc 2>/dev/null
rm $aconfigloc 2>/dev/null
touch $scriptloc/aroma-config 2>/dev/null
echo ''
echo $line
echo -e "Writing initial Information to $yellow aroma-config $endc...\n"
sleep 1;
echo '# Fix Colorspace Issue' >> $aconfigloc
echo 'ini_set("force_colorspace","rgba");' >> $aconfigloc
#echo -e "\t $uline ini_set("force_colorspace","rgba");"
sleep 1
echo -e "\n $bgblue Select Screen Resolution $endc \n"
echo -e "\n$cyan 1. $endc LDPI \n$cyan 2. $endc MDPI \n$cyan 3. $endc HDPI \n$cyan 4. $endc XHDPI \n$cyan 5. $endc XXHDPI \n"
echo -en "\n$red Enter choice $cyan [1-5] $endc $endc : "
read sresol
cat >> $aconfigloc <<EOF
##
# Screen Resolution
#
ini_set("dp","$sresol");
EOF
echo ''
echo $line
sleep 1
echo -e "\n $bgblue Initialization Information $endc \n"
echo -en "$red Rom/Mod Name $endc : ";read rom_name
echo -en "$red Rom/Mod Version $endc : ";read rom_version
echo -en "$red Rom/Mod Author $endc : ";read rom_author
echo -en "$red Device $endc : ";read rom_device
echo -en "$red Rom/mod Date $endc : ";read rom_date
cat >> $aconfigloc <<EOF
##
# Initializing Information
#
ini_set("rom_name", "$rom_name ");
ini_set("rom_version", "$rom_version");
ini_set("rom_author", "$rom_author");
ini_set("rom_device", "$rom_device");
ini_set("rom_date", "$rom_date");
EOF
echo ''
echo $line
sleep 1
echo -e "\n $bgblue Add Simple Splash[s] / Animated Splash[a] /No Splash[n] ? $endc\n"
echo -en "$red Enter Choice $cyan [a/s/n] $endc $endc : ";read splashchoice
case $splashchoice in
s|S)
echo -e "\nRe/Place the Splash image at $yellow Working/$aromasorloc/SPLASH.png $endc \n" | pv -qL 15
echo -e " with your SPLASH.png,Image Name Should be SPLASH.png" | pv -qL 15
echo -e "$red";read -p "Press any key when done...";echo -e "$endc"
echo -en "$red Enter no of MILLISECONDS you want the Splash Image to Stay $endc : ";read animtime
cat >> $aconfigloc <<EOF
##
# Show Simple Splash
#
splash(
#-- Eg:Duration 5000ms / 5 seconds
$animtime,
#-- <AROMA Resource Dir>/SPLASH.png
"SPLASH"
);
EOF
echo "";;
a|A)
echo -e "\nRe/Place your Animation images in " | pv -qL 15
echo -e " $yellow Working/$aromasorloc/anim/<images> $endc \n" | pv -qL 15
echo -e "$red";read -p "Press any key when done...";echo -e "$endc"
echo -en "$red Enter no of time you want the animation to Loop $endc : ";read animloop
echo -en "$red Enter no of MILLISECONDS you want AN Image to stay $endc : ";read animtime
#animimageloop=`ls -l $aromasorloc/anim | wc -l `
ls $aromasorloc/anim/ | xargs -n 1 basename >temp.txt
sed -i 's/.png//g' temp.txt 2>/dev/null
sed -i 's/.jpg//g' temp.txt 2>/dev/null
echo "###Show Animated Splash" >> $aconfigloc
echo "anisplash(" >> $aconfigloc
echo -e "#-- Number Loop\n $animloop," >> $aconfigloc
al=`wc -l < temp.txt`
for((z=1;z<=al;z++))
do
animimg=`head -n $z temp.txt | tail -n 1`
if [ $z -eq $al ] ; then
cat >> $aconfigloc <<EOF
"anim/$animimg", $animtime
EOF
else
cat >> $aconfigloc <<EOF
"anim/$animimg", $animtime,
EOF
fi
done < temp.txt
echo ");" >> $aconfigloc
echo "";;
*)echo "No Splash"
esac
echo ''
echo $line
sleep 1
echo -e "Adding code to Show $bgblue Language Selection Window $endc...."
echo ''
cat >> $aconfigloc <<EOF
##
# Font Selection
#
fontresload( "0", "ttf/Roboto-Regular.ttf;ttf/DroidSansArabic.ttf;ttf/DroidSansFallback.ttf;", "12" ); #-- Use sets of font (Font Family)
##
# SHOW LANGUAGE SELECTION
#
selectbox(
#-- Title
"Select Language",
#-- Sub Title
"Please select installer language that you want to use while Installing ROM",
#-- Icon:
"@default",
#-- Will be saved in /tmp/aroma/lang.prop
"lang.prop",
"English", "Welcome to Installer", 1, #-- selected.0 = 1
"Indonesian", "Selamat datang di Installer", 0, #-- selected.0 = 2
"Espanol", "Bienvenido al Instalador", 0, #-- selected.0 = 3
"Simplified Chinesse","欢迎到安装", 0, #-- selected.0 = 4
"Arabic", "مرحبا بكم في المثبت", 0, #-- selected.0 = 5
"French", "Bienvenue dans l'installateur", 0, #-- selected.0 = 6
"Russian", "Добро пожаловать в установщик", 0, #-- selected.0 = 7
"Italian", "Benvenuti Installer", 0, #-- selected.0 = 8
"Hebrew", "ברוכים הבאים להתקנה", 0, #-- selected.0 = 9
"Germany", "Willkommen bei Installer", 0 #-- selected.0 = 10
);
##
# SET LANGUAGE & FONT FAMILY
#
if prop("lang.prop","selected.0")=="1" then
loadlang("langs/en.lang");
fontresload( "0", "ttf/Roboto-Regular.ttf", "12" ); #-- "0" = Small Font ( Look at Fonts & UNICODE Demo Below )
fontresload( "1", "ttf/Roboto-Regular.ttf", "18" ); #-- "1" = Big Font
endif;
if prop("lang.prop","selected.0")=="2" then
loadlang("langs/id.lang");
fontresload( "0", "ttf/Roboto-Regular.ttf", "12" );
fontresload( "1", "ttf/Roboto-Regular.ttf", "18" );
endif;
if prop("lang.prop","selected.0")=="3" then
loadlang("langs/es.lang");
fontresload( "0", "ttf/Roboto-Regular.ttf", "12" );
fontresload( "1", "ttf/Roboto-Regular.ttf", "18" );
endif;
if prop("lang.prop","selected.0")=="4" then
loadlang("langs/cn.lang");
fontresload( "0", "ttf/DroidSansFallback.ttf;ttf/Roboto-Regular.ttf", "12" );
fontresload( "1", "ttf/DroidSansFallback.ttf;ttf/Roboto-Regular.ttf", "18" );
endif;
if prop("lang.prop","selected.0")=="5" then
loadlang("langs/ar.lang");
fontresload( "0", "ttf/DroidSansArabic.ttf;ttf/Roboto-Regular.ttf", "12" );
fontresload( "1", "ttf/DroidSansArabic.ttf;ttf/Roboto-Regular.ttf", "18" );
endif;
if prop("lang.prop","selected.0")=="6" then
loadlang("langs/fr.lang");
fontresload( "0", "ttf/Roboto-Regular.ttf", "12" );
fontresload( "1", "ttf/Roboto-Regular.ttf", "18" );
endif;
if prop("lang.prop","selected.0")=="7" then
loadlang("langs/ru.lang");
fontresload( "0", "ttf/Roboto-Regular.ttf", "12" );
fontresload( "1", "ttf/Roboto-Regular.ttf", "18" );
endif;
if prop("lang.prop","selected.0")=="8" then
loadlang("langs/it.lang");
fontresload( "0", "ttf/Roboto-Regular.ttf", "12" );
fontresload( "1", "ttf/Roboto-Regular.ttf", "18" );
endif;
if prop("lang.prop","selected.0")=="9" then
loadlang("langs/he.lang");
fontresload( "0", "ttf/Roboto-Regular.ttf", "12" );
fontresload( "1", "ttf/Roboto-Regular.ttf", "18" );
endif;
if prop("lang.prop","selected.0")=="10" then
loadlang("langs/de.lang");
fontresload( "0", "ttf/Roboto-Regular.ttf", "12" );
fontresload( "1", "ttf/Roboto-Regular.ttf", "18" );
endif;
EOF
echo ''
echo $line
sleep 1
echo -e "\n $bgblue Theme Selection $endc \n"
echo -e "\n$cyan 1. $endc Add a Theme Selection Window\n$cyan 2. $endc Just use any one theme (No user choice)"
echo -e "$cyan 3. $endc Use Default Generic Theme \n"
echo -en "$red Enter Choice $cyan [1-3] $endc $endc : "
read themechoice
case $themechoice in
1)echo -e "\nTheme Selection Window Added"
cat >> $aconfigloc <<EOF
##
# SELECT THEME
#
selectbox(
#-- Title
"<~themes.title>",
#-- Sub Title
"<~themes.desc>",
#-- Icon:
"@personalize",
#-- Will be saved in /tmp/aroma/theme.prop
"theme.prop",
"Generic", "Unthemed AROMA Installer", 0, #-- selected.0 = 1
"MIUI Theme", "MIUI Theme by mickey-r & amarullz", 0, #-- selected.0 = 2
"NXT Theme", "NXT Theme by Pranav Pandey", 0, #-- selected.0 = 3
"NextGen Theme", "NextGen Theme by amarullz edit by Ayush", 0, #-- selected.0 = 4
"Sense Theme", "HTC Sense Theme by amarullz", 0, #-- selected.0 = 5
"Honami Theme", "Xperia i1 Theme by Ayush", 1 #-- selected.1 = 6
);
##
# SET THEME
#
if prop("theme.prop","selected.0")=="2" then
theme("miui");
endif;
if prop("theme.prop","selected.0")=="3" then
theme("xNXT");
endif;
if prop("theme.prop","selected.0")=="4" then
theme("NextGen");
endif;
if prop("theme.prop","selected.0")=="5" then
theme("sense");
endif;
if prop("theme.prop","selected.0")=="6" then
theme("i1");
endif;
EOF
echo '';;
2)
origpath=`pwd`
list_menu META-INF/com/google/android/aroma/themes /tmp/theme.txt
cd $origpath
echo -e "\n$yellow $choice $endc Theme Selected"
cat >> $aconfigloc <<EOF
##
# SET THEME
#
theme("$choice");
EOF
echo'';;
*)
echo "Generic Theme Added."
echo '';;
esac
echo $line
echo -e "\nAdding code to Show $bgblue Welcome Window - Rom/mod Info $endc...."
cat >> $aconfigloc <<EOF
##
# SHOW ROM/Mod INFORMATION
#
viewbox(
#-- Title
"<~welcome.title>",
#-- Text
"<~welcome.text1> <b>"+
#-- Get Config Value
ini_get("rom_name")+
"</b> <~common.for> <b>"+ini_get("rom_device")+"</b>.\n\n"+
"<~welcome.text2>\n\n"+
" <~welcome.version>\t: <b><#selectbg_g>"+ini_get("rom_version")+"</#></b>\n"+
" <~welcome.updated>\t: <b><#selectbg_g>"+ini_get("rom_date")+"</#></b>\n\n\n"+
"<~welcome.next>",
#-- Icon
"@welcome"
);
EOF
echo ''
echo $line
sleep 2
echo ''
echo -e "$bgblue License Window $endc\n"
echo -e "Do you want to include a License Window? $cyan [ y = yes/ n =no ] $endc"
echo -en "\n$red Enter choice $cyan [y/n] $endc$endc : ";read licensechoice
case $licensechoice in
y|Y)
echo -e "\nEdit the License file at " | pv -qL 15
echo -e " $yellow $aromasorloc/license.txt $endc\n" | pv -qL 15
echo -e "$red";read -p "Press any key when done...";echo -e "$endc"
cat >> $aconfigloc <<EOF
##
# LICENSE
#
agreebox(
#-- Title
"$rom_name T&C",
#-- Subtitle / Description
"Read Carefully",
#-- Icon:
"@license",
#-- Text Content
resread("license.txt"),
#-- Checkbox Text
"Do you agree??",
#-- Unchecked Alert Message
"Can't Proceed till you Agree!!"
);
EOF
echo ''
;;
*)echo ''
echo $line
sleep 1
esac
}
menu_box(){
echo ''
echo $line
echo -e "This Option Adds the following to the Menu Box \n" | pv -qL 15
sleep 1
spccolor="$bgcyan $endc"
echo -e "$bgcyan $endc"
echo -e "$spccolor#------------+-------------[ Menubox Items ]---------------+---------------#$spccolor"
echo -e "$spccolor# TITLE | SUBTITLE | Item Icons #$spccolor"
echo -e "$spccolor#------------+---------------------------------------------+---------------#$spccolor";
echo -e "$spccolor#(o) $rom_name Installation, #$spccolor";
echo -e "$spccolor# ROM Installation with Various Features - RECOMMENDED #$spccolor";
echo -e "$spccolor#(o) System Info, #$spccolor";
echo -e "$spccolor# Get and show device/partition informations, #$spccolor";
echo -e "$spccolor#(o) ChangeLog, #$spccolor";
echo -e "$spccolor# ROM/Mod ChangeLog, #$spccolor";
echo -e "$spccolor#(o) Quit Install, #$spccolor";
echo -e "$spccolor# Quit Install, #$spccolor";
echo -e "$spccolor#--------------------------------------------------------------------------#$spccolor"
echo -e "$bgcyan $endc"
echo ''
echo $line
sleep 2
echo -e "\n$yellow $rom_name Installation $endc and $yellow Quit Install $endc" | pv -qL 15
echo -e " are included by default" | pv -qL 15
echo -e "\nWant to Add $yellow System Info and Changelog $endc as well? "
echo -e "$cyan y $endc = Yes,Add the two options \n$cyan n $endc = NO,dont Add."
echo -en "\n$red Enter choice $cyan [y/n] $endc$endc : ";read boxch
case $boxch in
y|Y)echo -en "\n$red Enter Model No:$endc : ";read rom_model
echo -en "$red Enter Manufacturer:$endc : ";read rom_manufacturer
echo -e "\nAdding Entire Menubox..."
cat >> $aconfigloc <<EOF
##
# MAIN MENU- INSTALLER n MISC
#
menubox(
#-- Title
"$rom_name™ Menu",
#-- Sub Title
"Please select from the Menu Below to Modify the required features",
#-- Icon
"@apps",
#-- Will be saved in /tmp/aroma/menu.prop
"menu.prop",
#------------+-------------[ Menubox Items ]---------------+---------------#
# TITLE | SUBTITLE | Item Icons #
#------------+---------------------------------------------+---------------#
"$rom_name Installation", "ROM Installation with Various Features - RECOMMENDED","@install", #-- selected = 1
"System Info", "Get and show device/partition informations", "@info", #-- selected = 2
"ChangeLog", "ROM/Mod ChangeLog", "@agreement", #-- selected = 3
"Quit Install", "Quit Install", "@install" #-- selected = 4
);
##
# System Info
#
if prop("menu.prop","selected")=="2" then
#-- Show Please Wait
pleasewait("Getting System Information...");
#-- Fetch System Information
setvar(
#-- Variable Name
"sysinfo",
#-- Variable Value
"<@center><b>Your Device System Information</b></@>\n\n"+
"Device Name\t\t: <#469>$rom_device</#>\n"+
"Board Name\t\t: <#469>$rom_model</#>\n"+
"Manufacturer\t\t: <#469>$rom_manufacturer</#>\n"+
"\n"+
"System Size\t\t: <b><#selectbg_g>"+getdisksize("/system","m")+" MB</#></b>\n"+
"\tFree\t\t: <b><#selectbg_g>"+getdiskfree("/system","m")+" MB</#></b>\n\n"+
"Data Size\t\t: <b><#selectbg_g>"+getdisksize("/data","m")+" MB</#></b>\n"+
"\tFree\t\t: <b><#selectbg_g>"+getdiskfree("/data","m")+" MB</#></b>\n\n"+
"SDCard Size\t\t: <b><#selectbg_g>"+getdisksize("/sdcard","m")+" MB</#></b>\n"+
"\tFree\t\t: <b><#selectbg_g>"+getdiskfree("/sdcard","m")+" MB</#></b>\n\n"+
""
);
#-- Show Textbox
textbox(
#-- Title
"System Information",
#-- Subtitle
"Current system Information on your $rom_device",
#-- Icon
"@info",
#-- Text
getvar("sysinfo")
);
#-- Back to Menu ( 2 Wizard UI to Back )
back("2");
endif;
##
# CHANGELOG DISPLAY
#
if prop("menu.prop","selected")=="3" then
#-- TextDialog
textdialog(
#-- Title
"YOUR ROM NAME Changelog",
#-- Text
resread("changelog.txt"),
#-- Custom OK Button Text (Optional)
"Close"
);
#-- Back to Menu ( 2 Wizard UI to Back )
back("1");
endif;
##
# QUIT INSTALLER
#
if prop("menu.prop","selected")=="4" then
#-- Exit
if
confirm(
#-- Title
"Exit",
#-- Text
"Are you sure want to exit the Installer?",
#-- Icon (Optional)
"@alert"
)=="yes"
then
#-- Exit
exit("");
endif;
endif;
EOF
echo '';;
*)
echo -e "\nAdding only $yellow $rom_name Installation $endc and $yellow Quit Install ...$endc"
cat >> $aconfigloc <<EOF
##
# MAIN MENU- INSTALLER n MISC
#
menubox(
#-- Title
"$rom_name Menu",
#-- Sub Title
"Please select from the Menu Below to Modify the required features",
#-- Icon
"@apps",
#-- Will be saved in /tmp/aroma/menu.prop
"menu.prop",
#------------+-------------[ Menubox Items ]---------------+---------------#
# TITLE | SUBTITLE | Item Icons #
#------------+---------------------------------------------+---------------#
"$rom_name Installation", "ROM Installation with Various Features - RECOMMENDED", "@install",#--selected=1
"Quit Install", "Quit Install", "@install" #-- selected = 4
);
##
# QUIT INSTALLER
#
if prop("menu.prop","selected")=="4" then
#-- Exit
if
confirm(
#-- Title
"Exit",
#-- Text
"Are you sure want to exit the Installer?",
#-- Icon (Optional)
"@alert"
)=="yes"
then
#-- Exit
exit("");
endif;
endif;
EOF
echo '';;
esac
}
select_box(){
echo -en "\n$red Enter $cyan No $endc$red of Groups You want to Add in SelectBox $endc$cyan$i$endc : $endc ";read selbox_grp_cnt
mkdir /tmp/select 2>/dev/null ;
for((g=1;g<=$selbox_grp_cnt;g++))
do
defflag=0
defaultch=0
echo -en "\n$red Enter Group $cyan $g $endc $red title $endc : ";read header[$i][$g]
#echo "${header[$i][$g]}"
grpname="${header[$i][$g]}"
gname=`echo "$grpname" | sed 's/ //g'`
#echo "$gname";
#rm /tmp/${header[$i][$g]} 2>/dev/null
touch /tmp/select/$gname 2>/dev/null;
cat >> $aconfigloc <<EOF
"${header[$i][$g]}", "", 2, #-- Group $g. key = "selected.$g"
EOF
echo ""
echo $line
echo -e "$bgblue Group ${header[$i][$g]} : $endc"
echo -en "\n$red Enter $cyan No $endc$red of options you want in Group $endc$green${header[$i][$g]} $endc$endc : ";read grp_opt_cnt;
for((o=1;o<=$grp_opt_cnt;o++))
do
echo ''
echo " ---------------"
echo -en "\n$red Enter $default Title $endc$red for Option$endc $cyan$o$endc$red in Group $endc$green${header[$i][$g]} $endc$endc : ";read option
echo -en "$red Enter $default Description $endc$red for Option $endc$cyan$option$endc $endc$endc : ";read odescrip
if [ "$defflag" -eq 0 ]; then
echo -e "\n$red Keep Option $endc$cyan$option$endc $red Default Selected? $endc$cyan[1=yes / 0=No]$endc\n ";
echo -en "$red Enter Choice $cyan [1/0] $endc$endc : ";
read defaultch;
if [ "$defaultch" -eq 1 ]; then defflag=1;fi
else
defflg=1
defaultch=0
fi
cat >> /tmp/select/$gname <<EOF
$option , file_getprop("/tmp/aroma/window$i.prop","selected.$g") == "$o"
EOF
if [ "$o" -eq "$grp_opt_cnt" ] && [ "$g" -eq "$selbox_grp_cnt" ] ; then
cat >> $aconfigloc <<EOF
"$option", "$odescrip", $defaultch #-- selected.$g = $o
EOF
else
cat >> $aconfigloc <<EOF
"$option", "$odescrip", $defaultch, #-- selected.$g = $o
EOF
fi
#echo "$odescrip" >> /tmp/${header[$i][$g]};
done
echo -e "" >> $aconfigloc
echo ''
echo $line
done
}
check_box(){
echo -en "\n$red Enter $cyan No $endc$red of Groups You want to Add in CheckBox $endc$cyan$i$endc : $endc ";read selbox_grp_cnt
mkdir /tmp/select 2>/dev/null
for((g=1;g<=$selbox_grp_cnt;g++))
do
echo -en "\n$red Enter Group $cyan $g $endc $red title $endc : ";read header[$i][$g]
grpname="${header[$i][$g]}"
gname=`echo "$grpname" | sed 's/ //g'`
#rm /tmp/${header[$i][$g]} 2>/dev/null
touch /tmp/select/$gname 2>/dev/null
cat >> $aconfigloc <<EOF
"${header[$i][$g]}", "", 2, #-- Group $g
EOF
echo ""
echo $line
echo -e "$bgblue Group ${header[$i][$g]} : $endc"
echo -en "\n$red Enter $cyan No $endc$red of options you want in Group $endc$green${header[$i][$g]} $endc$endc : ";read grp_opt_cnt;
for((o=1;o<=$grp_opt_cnt;o++))
do
echo ''
echo " ---------------"
echo -en "\n$red Enter $default Title $endc$red for Option$endc $cyan$o$endc$red in Group $endc$green${header[$i][$g]} $endc$endc : ";read option
echo -en "$red Enter $default Description $endc$red for Option $endc$cyan$option$endc $endc$endc : ";read odescrip
echo -e "\n$red Keep Option $endc$cyan$option$endc $red Default Selected? $endc$cyan[1=yes / 0=No]$endc\n ";
echo -en "$red Enter Choice $cyan [1/0] $endc$endc : ";
read defaultch;
cat >> /tmp/select/$gname <<EOF
$option , file_getprop("/tmp/aroma/checkbox$i.prop","item.$g.$o") == "1"
EOF
if [ "$o" -eq "$grp_opt_cnt" ] && [ "$g" -eq "$selbox_grp_cnt" ] ; then
cat >> $aconfigloc <<EOF
"$option", "$odescrip", $defaultch #-- item.$g.$o
EOF
else
cat >> $aconfigloc <<EOF
"$option", "$odescrip", $defaultch, #-- item.$g.$o
EOF
fi
done
echo -e "" >> $aconfigloc
echo ''
echo $line
done
}
build_menu(){
cd /Working
menuchoice=0
rm list.txt 2>/dev/null
tree -dfi $1/ --noreport >list.txt -P */app/
loop=`wc -l < list.txt`
echo -e '<==============================================================================>';
echo " Choose Directory to Push ";
echo -e '<==============================================================================>\n'
echo -e "$cyan Path Number $endc | | Path"
for((i=1;i<=$loop;i++));
do
list=`echo -e "$cyan$i$endc : : " ;head -n $i list.txt | tail -n 1`
echo -e $list
done
cd /tmp/select
#read -p "WAit"
}
uscript_fun(){
rm $uscriptloc 2>/dev/null
touch /Working/$uscriptloc
echo ''
echo $line
echo ''
echo -e "Adding initial code to updater-script...."
cat >> $uscriptloc <<EOF
################################ UPDATER SCRIPT #####################################
##############################Created by Lazy Aroma##################################
ui_print("-> Initialising....");
ui_print("-> Please Wait....");
if
file_getprop("/tmp/aroma-data/menu.prop","selected") == "1"
then
ui_print("-> Installing $rom_name ");
EOF
echo -en "\n$red Add code to Mount $cyan /system [y/n] $endc ? $endc : ";read sysmountch
case $sysmountch in
n|N)
echo '';;
*) echo 'ui_print("-> Mounting System...");' >> $coreusloc
echo 'run_program("/sbin/busybox", "mount", "/system");' >> $coreusloc;;
esac
echo -en "\n$red Add code to Mount $cyan /data [y/n] $endc ? $endc : ";read sysmountch
case $sysmountch in
n|N)
echo '';;
*) echo 'ui_print("-> Mounting Data...");' >> $coreusloc
echo 'run_program("/sbin/busybox", "mount", "/data");' >> $coreusloc;;
esac
echo -en "\n$red Add code to Mount $cyan /sdcard [y/n] $endc ? $endc : ";read sysmountch
case $sysmountch in
n|N)
echo '';;
*) echo 'ui_print("-> Mounting SYSTEM...");' >> $coreusloc
echo 'run_program("/sbin/busybox", "mount", "/sdcard");' >> $coreusloc;;
esac
if [ -d [s]ystem ];then
echo "" >> $coreusloc
echo 'ui_print("-> Extracting System...");' >> $coreusloc
echo 'package_extract_dir("system", "/system");' >> $coreusloc
echo "" >> $coreusloc
fi
if [ -d [d]ata ];then
echo "" >> $coreusloc
echo 'ui_print("-> Extracting Data...");' >> $coreusloc
echo 'package_extract_dir("data", "/data");' >> $coreusloc
echo "" >> $coreusloc
fi
echo -e "\n$line\n"
echo "Now you will be shown the options that you have created in" | pv -qL 25
echo -e " the Aroma GUI Window/s \n" | pv -qL 15
echo "Select what happens when an option is selected by user..." | pv -qL 25
cd /tmp/select
for file in ./*
do
fle=`echo ${file##*/}`
echo $fle
echo ''
echo -e "$line"
echo ''
echo -e "$bgblue Group $fle $endc\n"
line_cnt=`wc -l < ${fle}`
for((l=1;l<=$line_cnt;l++));
do
lne=`head -n $l $fle | tail -n 1`
part1=`echo "${lne%%,*}"`
part2=`echo "${lne#*,}"`
sleep 2
echo -e "\n$line\n"
echo -e "What do you want to do when $bgyellow $part1 $endc is selected? $endcn : \n"
echo -e "$cyan 1. $endc Push files from $green $adirname $endc to the $green phone $endc "
echo -e "$cyan 2. $endc Write a custom $green Edify $endc command by self.\n "
echo -en "$red Enter Choice $cyan [1-2] $endc : "; read whatdo
case $whatdo in
1)
build_menu $adirname
menuchoice=0
errorflag=0
echo -e "\n$line\n$red From which directory do you want to Push/Install when $green$part1$endc$red is selected? $endcn\n"
while [ "$errorflag" -eq 0 ]
do
echo -en "$red Enter Choice $cyan [1-$loop] $endc$endc : ";read pushsrcch
if [ "$pushsrcch" -ge 1 ] && [ "$pushsrcch" -le $loop ];then
yo=`head -n $pushsrcch /Working/list.txt | tail -n 1`
echo -en "\nYou have chosen: $green $yo $endc \n"
errorflag=1;
else
echo -e "\n$pushsrcch isn't a valid choice. Valid Choice ==> $cyan [1-$loop] $endc <== \n"
errorflag=0
fi
done
echo -e "\n$line\n"
echo -e "$bgblue Where to Push/Install $endc\n"
echo -e "$cyan 1. $endc To $green /system $endc "
echo -e "$cyan 2. $endc To $green /data $endc "
echo -e "$cyan 3. $endc To $green /sdcard $endc "
echo -e "$cyan 4. $endc To $green custom/other path $endc\n "
echo -en "$red Enter Choice $cyan [1-4] $endc : ";read pushdestch
case $pushdestch in
1)yo1="/system";;
2)yo1="/data";;
3)yo1="/sdcard";;
*)echo -en "\n$red Enter Custom Path or just ENTER for nothing: $endc";read yo1;;
esac
cat >> $coreusloc <<EOF
if
$part2
then
ui->print(" Installing $part1 ");
package_extract_dir("$yo", "$yo1");
endif;
EOF
echo '';;
*)
echo -e "\n $line \n"
echo -e "$bgblue Group $fle $endc\n"
echo "Enter the Edify command and the ';' as well : ";read edifycmd
cat >> $coreusloc <<EOF
if
$part2
then
ui->print(" Installing $part1 ");
$edifycmd
endif;
EOF
echo '';;
esac
done
done
echo -e "\n$line\n"
cd /Working
echo -en "\n$red Add code to $cyan Fix-Permisions [y/n] $endc $red (Useful for Roms) ? $endc : ";read xtrach
if [ $xtrach == y ];then
cp /bin/files/fix_permissions /Working/
cat >> $uscriptloc <<EOF
ui_print("-> Fixing Permissions :P");
package_extract_file("fix_permissions", "/tmp/fix_permissions");
set_perm(0, 0, 0777, "/tmp/fix_permissions");
run_program("/tmp/fix_permissions");
EOF
else
echo ''
fi
echo -en "\n$red Add code to $cyan Symlink [y/n] $endc $red (Useful for Roms) ? $endc : ";read xtrach
if [ $xtrach == y ];then
cat >> $uscriptloc <<EOF
ui_print("-> Making symlinks...");
symlink("toolbox", "/system/bin/start");
symlink("toolbox", "/system/bin/lsmod");
symlink("toolbox", "/system/bin/r");
symlink("toolbox", "/system/bin/vmstat");
symlink("toolbox", "/system/bin/ifconfig");
symlink("toolbox", "/system/bin/ionice");
symlink("toolbox", "/system/bin/schedtop");
symlink("toolbox", "/system/bin/wipe");
symlink("toolbox", "/system/bin/reboot1");
symlink("toolbox", "/system/bin/rmdir");
symlink("toolbox", "/system/bin/route");
symlink("toolbox", "/system/bin/chown");
symlink("toolbox", "/system/bin/lsof");
symlink("toolbox", "/system/bin/getevent");
symlink("toolbox", "/system/bin/mkdir");
symlink("toolbox", "/system/bin/netstat");
symlink("toolbox", "/system/bin/renice");
symlink("toolbox", "/system/bin/uptime");
symlink("mksh", "/system/bin/sh");
symlink("toolbox", "/system/bin/smd");
symlink("toolbox", "/system/bin/sync");
symlink("toolbox", "/system/bin/mount");
symlink("toolbox", "/system/bin/printenv");
symlink("toolbox", "/system/bin/top");
symlink("toolbox", "/system/bin/log");
symlink("toolbox", "/system/bin/sendevent");
symlink("toolbox", "/system/bin/ps");
symlink("toolbox", "/system/bin/dmesg");
symlink("toolbox", "/system/bin/umount");
symlink("toolbox", "/system/bin/kill");
symlink("toolbox", "/system/bin/stop");
symlink("toolbox", "/system/bin/newfs_msdos");
symlink("toolbox", "/system/bin/iftop");
symlink("toolbox", "/system/bin/chmod");
symlink("toolbox", "/system/bin/rmmod");
symlink("toolbox", "/system/bin/setconsole");
symlink("toolbox", "/system/bin/mv");
symlink("toolbox", "/system/bin/rm");
symlink("toolbox", "/system/bin/id");
symlink("toolbox", "/system/bin/watchprops");
symlink("toolbox", "/system/bin/hd");
symlink("toolbox", "/system/bin/ctrlaltdel");
symlink("toolbox", "/system/bin/sleep");
symlink("toolbox", "/system/bin/ls");
symlink("toolbox", "/system/bin/cmp");
symlink("toolbox", "/system/bin/insmod");
symlink("toolbox", "/system/bin/nandread");
symlink("toolbox", "/system/bin/date");
symlink("toolbox", "/system/bin/dd");
symlink("toolbox", "/system/bin/getprop");
symlink("toolbox", "/system/bin/cat");
symlink("toolbox", "/system/bin/df");
symlink("toolbox", "/system/bin/touch");
symlink("toolbox", "/system/bin/ioctl");
symlink("toolbox", "/system/bin/setprop");
symlink("toolbox", "/system/bin/notify");
symlink("toolbox", "/system/bin/ln");
EOF
else
echo ''
fi
cat >> $uscriptloc <<EOF
ui_print("-> Finished Installation...!");