forked from ScriBt/ScriBt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ROM.sh
1165 lines (1107 loc) · 52.1 KB
/
ROM.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
#========================< Projekt ScriBt >============================#
#===========< Copyright 2016, Arvindraj Thangaraj - "a7r3" >===========#
#======================================================================#
# #
# This software is licensed under the terms of the GNU General Public #
# License version 2, as published by the Free Software Foundation, and #
# may be copied, distributed, and modified under those terms. #
# #
# 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. #
# #
#======================================================================#
# #
# https://github.com/a7r3/ScriBt - I live here #
# #
# Feel free to enter your modifications and submit it to me with #
# a Pull Request, such Contributions are WELCOME #
# #
# Contributors: #
# Arvindraj (Myself) #
# Adrian DC #
# Akhil Narang #
# CubeDev #
# nosedive #
#======================================================================#
function cherrypick() # Automated Use only
{
echo -ne '\033]0;ScriBt : Picking Cherries\007';
echo -e "${CL_WYT}=======================${NONE} ${CL_LRD}Pick those Cherries${NONE} ${CL_WYT}======================${NONE}\n";
echo -e "${EXE} ${ATBT} Attempting to Cherry-Pick Provided Commits\n";
git fetch ${URL/\/tree\// };
git cherry-pick $1;
echo -e "\n${INF} It's possible that the pick may have conflicts. Solve those and then continue.";
echo -e "${CL_WYT}==================================================================${NONE}";
} # cherrypick
function exitScriBt() # ID
{
function prefGen()
{
echo -e "\n\n${EXE} Deleting old Configs...";
sed -e '/SB.*/d' -e '/function configs()/d' -e '/{ # as on.*/d' -e '/} # configs/d' -i PREF.rc;
echo -e "\n${EXE} Saving Current Configuration to PREF.rc...";
(set -o posix; set) > ${TV2};
echo -e "function configs()\n{ # as on $DNT" >> PREF.rc
diff ${TV1} ${TV2} | grep SB | sed -e 's/[<>] / /g' | awk '{print $0";"}' >> PREF.rc;
echo -e "} # configs" >> PREF.rc;
echo -e "\n${SCS} PREF.rc for the current Configuration created successfully\nYou may automate ScriBt next time...";
} # prefGen
[[ "$RQ_PGN" == [Yy] ]] && prefGen;
echo -e "\n\n${SCS} Thanks for using ScriBt.\n\n";
[[ "$1" == "0" ]] && echo -e "${CL_LGN}[${NONE}${CL_LRD}<3${NONE}${CL_LGN}]${NONE} Peace! :)" || echo -e "${CL_LRD}[${NONE}${CL_RED}<${NONE}${CL_LGR}/${NONE}${CL_RED}3${NONE}${CL_LRD}]${NONE} Failed somewhere :(";
exit $1;
} # exitScriBt
function main_menu()
{
echo -ne '\033]0;ScriBt : Main Menu\007';
echo -e "${CL_WYT}===================${NONE}${SCS} ${CL_LBL}Main Menu${NONE} ${SCS}${CL_WYT}===================${NONE}\n";
echo -e "1 Choose ROM & Init* 1";
echo -e "2 Sync 2";
echo -e "3 Pre-Build 3";
echo -e "4 Build 4";
echo -e "5 Various Tools 5\n";
echo -e "6 EXIT 6\n";
echo -e "* - Sync will Automatically Start after Init'ing Repo";
echo -e "${CL_WYT}=======================================================${NONE}\n";
echo -e "\n${QN} Select the Option you want to start with : \c";
read ACTION;
teh_action $ACTION "mm";
} # main_menu
function pkgmgr_check() # ID
{
if [ -d "/etc/apt" ]; then
echo -e "\n${SCS} Alright, apt detected.\033[0m\n";
PKGMGR="apt";
elif [ -d "/etc/pacman.d" ]; then
echo -e "\n${SCS} Alright, pacman detected.\033[0m\n";
PKGMGR="pacman";
else
echo -e "\n${FLD} Neither apt nor pacman configuration has been found.";
echo -e "\n${INF} A Debian/Ubuntu based Distribution or Archlinux is required to run ScriBt.";
exitScriBt 1;
fi
} # pkgmgr_check
function quick_menu()
{
echo -ne '\033]0;ScriBt : Quick Menu\007';
echo -e "${CL_WYT}\n====================${NONE} ${CL_PNK}Quick-Menu${NONE} ${CL_WYT}======================${NONE}";
echo -e "1. Init | 2. Sync | 3. Pre-Build | 4. Build | 5. Tools";
echo -e " 6. Exit";
echo -e "${CL_WYT}======================================================${NONE}\n";
read -p $'\033[1;36m[>]\033[0m ' ACTION;
teh_action $ACTION "qm";
} # quick_menu
function rom_select() # D 1,2
{
echo -e "${CL_WYT}=======================================================${NONE}\n";
echo -e "${CL_YEL}[?]${NONE} ${CL_WYT}Which ROM are you trying to build\nChoose among these (Number Selection)\n";
for RNO in {1..30}; do
rom_names $RNO;
echo -e "$RNO. $ROM_FN";
done
echo -e "\n=======================================================${NONE}\n";
[ -z "$automate" ] && read -p $'\033[1;36m[>]\033[0m ' SBRN;
rom_names "$SBRN";
echo -e "\n${INF} You have chosen -> ${ROM_FN}\n";
} # rom_select
function shut_my_mouth() # ID
{
if [ ! -z "$automate" ]; then
RST="SB$1";
echo -e "${CL_PRP}[!]${NONE} ${ATBT} $2 : ${!RST}";
else
read -p $'\033[1;36m[>]\033[0m ' SB2;
[ -z "$3" ] && export SB$1="${SB2}" || eval SB$1=${SB2};
fi
echo;
} # shut_my_mouth
function set_ccache() # D set_ccvars
{
echo -e "\n${EXE} Setting up CCACHE\n";
ccache -M ${CCSIZE}G;
echo -e "\n${SCS} CCACHE Setup Successful.\n";
} # set_ccache
function set_ccvars() # D 4,5
{
echo -e "${INF} \nCCACHE Size must be >50 GB.\n Specify the Size (Number) for Reservation of CCACHE (in GB) : \n";
read -p $'\033[1;36m[>]\033[0m ' CCSIZE;
echo -e "${INF} Create a New Folder for CCACHE and Specify it's location from / : \n";
read -p $'\033[1;36m[>]\033[0m ' CCDIR;
for RC in .bashrc .profile; do
if [ -f ${HOME}/${RC} ] && [[ $(grep -c 'USE_CCACHE\|CCACHE_DIR') != "1" ]]; then
echo -e "export USE_CCACHE=1\nexport CCACHE_DIR=${CCDIR}" >> ${HOME}/${RC};
. ${HOME}/${RC};
fi
done
set_ccache;
} # set_ccvars
function tranScriBt() # ID
{
function transIt()
{
echo -e "${EXE} Transferring ScriBt to the Specified Directory\n";
for FILE in `ls`; do
cp -rf ${FILE} $1/${FILE};
done
echo -e "${SCS} Successfully Transferred\n";
sleep 2;
echo -e "${EXE} Starting ScriBt in $1\n";
sleep 0.5;
echo -e "${CL_WYT}===============================================${NONE}\n";
cd $1;
exec bash ROM.sh $2;
} # transIt
echo -e "${EXE} Checking Directory Existence\n";
if [ ! -f $1 ]; then
echo -e "${FLD} Directory does not exist\n";
echo -e "${EXE} Trying to create directory\n";
TDIR=`mkdir $1 | echo "$?"`;
if [[ "$TDIR" == 0 ]]; then
echo -e "${SCS} Directory created\n";
transIt $1 $2;
else
echo -e "${FLD} Invalid Directory specified\n";
exitScriBt 1;
fi
else
echo -e "${SCS} Directory Exists\n";
transIt $1 $2;
fi
} # tranScriBt
function the_response() # D ALL
{
case "$1" in
"COOL") echo -e "\n${SCS} ${ATBT} Automated $2 Successful! :)" ;;
"FAIL") echo -e "\n${FLD} ${ATBT} Automated $2 Failed :(" ;;
esac
} # the_response
function init() # 1
{
[ ! -z "$automate" ] && teh_action 1;
rom_select;
sleep 1;
echo -e "${EXE} Detecting Available Branches in ${ROM_FN} Repository...";
RCT=$[ ${#ROM_NAME[*]} - 1 ];
for RC in `eval echo "{0..$RCT}"`; do
echo -e "\nOn ${ROM_NAME[$RC]} (ID->$RC)...\n";
git ls-remote -h https://github.com/${ROM_NAME[$RC]}/${MAN[$RC]} |\
awk '{print $2}' | awk -F "/" '{if (length($4) != 0) {print $3"/"$4} else {print $3}}';
done
echo -e "\n${INF} These Branches are available at the moment\n${QN} Specify the ID and Branch you're going to sync\n${INF} Format : [ID] [BRANCH]\n";
ST="Branch"; shut_my_mouth NBR "$ST";
RC=`echo "$SBNBR" | awk '{print $1}'`; SBBR=`echo "$SBNBR" | awk '{print $2}'`;
MNF=`echo "${MAN[$RC]}"`;
RNM=`echo "${ROM_NAME[$RC]}"`;
echo -e "${QN} Any Source you have already synced ${CL_WYT}[y/n]${NONE}\n"; gimme_info "refer";
ST="Use Reference Source"; shut_my_mouth RF "$ST";
if [[ "$SBRF" == [Yy] ]]; then
echo -e "\n${QN} Provide me the Synced Source's Location from /\n";
ST="Reference Location"; shut_my_mouth RFL "$ST";
REF=--reference\=\"${SBRFL}\";
else
REF=" ";
fi
echo -e "${QN} Set clone-depth ${CL_WYT}[y/n]${NONE}\n"; gimme_info "cldp";
ST="Use clone-depth"; shut_my_mouth CD "$ST";
if [[ "$SBCD" == [Yy] ]]; then
echo -e "${QN} Depth Value [1]\n";
ST="clone-depth Value"; shut_my_mouth DEP "$ST";
[ -z "$SBDEP" ] && SBDEP=1;
CDP=--depth\=\"${SBDEP}\";
fi
# Check for Presence of Repo Binary
if [[ ! $(which repo) ]]; then
echo -e "${EXE} Looks like the Repo binary isn't installed. Let's Install it.\n";
[ ! -d "${HOME}/bin" ] && mkdir -p ${HOME}/bin;
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo;
chmod a+x ~/bin/repo;
echo -e "${SCS} Repo Binary Installed\n${EXE} Adding ~/bin to PATH\n";
echo -e "# set PATH so it includes user's private bin if it exists" >> ~/.profile;
echo -e "if [ -d \"\$HOME/bin\" ] ; then" >> ~/.profile;
echo -e "\tPATH=\"\$HOME/bin:\$PATH\" "; >> ~/.profile;
echo -e "fi"; >> ~/.profile;
. ~/.profile;
echo -e "${SCS} Done. Ready to Init Repo.\n";
fi
echo -e "${CL_WYT}=========================================================${NONE}\n";
echo -e "${EXE} Initializing the ROM Repo\n";
repo init ${REF} ${CDP} -u https://github.com/${RNM}/${MNF} -b ${SBBR};
echo -e "\n${SCS} ${ROM_NAME[$RC]} Repo Initialized\n";
echo -e "${CL_WYT}=========================================================${NONE}\n";
mkdir .repo/local_manifests;
if [ -z "$automate" ]; then
echo -e "${INF} A folder \"local_manifests\" has been created for you.";
echo -e "${INF} Create a Device Specific manifest and Press ENTER to start sync\n";
read ENTER;
echo;
fi
export action_1="init";
sync;
} # init
function sync() # 2
{
[ ! -z "$automate" ] && teh_action 2;
if [ ! -f .repo/manifest.xml ]; then init; elif [ -z "$action_1" ]; then rom_select; fi;
echo -e "\n${EXE} Preparing for Sync\n";
echo -e "${QN} Number of Threads for Sync \n"; gimme_info "jobs";
ST="Number of Threads"; shut_my_mouth JOBS "$ST";
echo -e "${QN} Force Sync needed ${CL_WYT}[y/n]${NONE}\n"; gimme_info "fsync";
ST="Force Sync"; shut_my_mouth F "$ST";
echo -e "${QN} Need some Silence in the Terminal ${CL_WYT}[y/n]${NONE}\n"; gimme_info "ssync";
ST="Silent Sync"; shut_my_mouth S "$ST";
echo -e "${QN} Sync only Current Branch ${CL_WYT}[y/n]${NONE}\n"; gimme_info "syncrt";
ST="Sync Current Branch"; shut_my_mouth C "$ST";
echo -e "${QN} Sync with clone-bundle ${CL_WYT}[y/n]${NONE}\n"; gimme_info "clnbun";
ST="Use clone-bundle"; shut_my_mouth B "$ST";
echo -e "${CL_WYT}=====================================================================${NONE}\n";
#Sync-Options
[[ "$SBS" == "y" ]] && SILENT=-q || SILENT=" ";
[[ "$SBF" == "y" ]] && FORCE=--force-sync || FORCE=" ";
[[ "$SBC" == "y" ]] && SYNC_CRNT=-c || SYNC_CRNT=" ";
[[ "$SBB" == "y" ]] && CLN_BUN=" " || CLN_BUN=--no-clone-bundle;
echo -e "${EXE} Let's Sync!\n";
repo sync -j${SBJOBS:-1} ${SILENT:--q} ${FORCE} ${SYNC_CRNT:--c} ${CLN_BUN}; #2>&1 | tee $STMP;
[[ $(echo "$?") == "0" ]] && the_response COOL Sync || the_response FAIL Sync;
echo -e "\n${SCS} Done.\n";
echo -e "${CL_WYT}=====================================================================${NONE}\n";
[ -z "$automate" ] && quick_menu;
} # sync
function device_info() # D 3,4
{
[[ "${SBRN}" =~ 13|30 ]] && export ROMNIS="${ROMV}"; # Change ROMNIS if Zephyr or Flayr
if [ -d ${CALL_ME_ROOT}/vendor/${ROMNIS}/config ]; then
CNF="vendor/${ROMNIS}/config";
elif [ -d ${CALL_ME_ROOT}/vendor/${ROMNIS}/configs ]; then
CNF="vendor/${ROMNIS}/configs";
else
CNF="vendor/${ROMNIS}";
fi
rom_names "$SBRN"; # Restore ROMNIS
echo -e "${CL_WYT}======================${NONE} ${CL_PRP}Device Info${NONE} ${CL_WYT}======================${NONE}\n";
echo -e "${QN} What's your Device's CodeName \n${INF} Refer Device Tree - All Lowercases\n";
ST="Your Device Name is"; shut_my_mouth DEV "$ST";
echo -e "${QN} Your Device's Company/Vendor \n${INF} All Lowercases\n";
ST="Device's Vendor"; shut_my_mouth CM "$ST";
echo -e "${QN} Build type \n${INF} [userdebug/user/eng]\n";
ST="Build type"; shut_my_mouth BT "$ST";
echo -e "${QN} Choose your Device type among these. Explainations of each file given in README.md\n"; gimme_info "device-type";
TYPES=( common_full_phone common_mini_phone common_full_hybrid_wifionly \
common_full_tablet_lte common_full_tablet_wifionly common_mini_tablet_wifionly common_tablet \
common_full_tv common_mini_tv );
CNT=0;
for TYP in ${TYPES[*]}; do
if [ -f ${CNF}/${TYP}.mk ]; then echo -e "${CNT}. $TYP"; ((CNT++)); fi;
done
echo;
ST="Device Type"; shut_my_mouth DTP "$ST";
[ -z $SBDTP ] && SBDTP="common" || SBDTP="${TYPES[${SBDTP}]}";
echo -e "${CL_WYT}=========================================================${NONE}\n";
} # device_info
function init_bld() # D 3,4
{
echo -e "\n${CL_WYT}===========================================${NONE}";
echo -e "${EXE} Initializing Build Environment\n";
. build/envsetup.sh;
echo -e "\n${CL_WYT}===========================================${NONE}\n";
echo -e "${SCS} Done\n";
} # init_bld
function pre_build() # 3
{
[ ! -z "$automate" ] && teh_action 3;
[ -z "$action_1" ] && rom_select;
init_bld;
device_info;
DEVDIR="device/${SBCM}/${SBDEV}";
function vendor_strat_all()
{
case "$SBRN" in
13|30) cd vendor/${ROMV} ;;
*) cd vendor/${ROMNIS} ;;
esac
echo -e "${CL_WYT}=========================================================${NONE}\n";
function dtree_add()
{ # AOSP-CAF|RRO|OmniROM|Flayr|Zephyr
echo -e "${EXE} Adding Lunch Combo in Device Tree";
[ ! -f vendorsetup.sh ] && touch vendorsetup.sh;
if [[ $(grep -c "${ROMNIS}_${SBDEV}" ${DEVDIR}/vendorsetup.sh ) == "0" ]]; then
echo -e "add_lunch_combo ${ROMNIS}_${SBDEV}-${SBBT:-userdebug}" >> vendorsetup.sh;
else
echo -e "${SCS} Lunch combo already added to vendorsetup.sh\n";
fi
} # dtree_add
echo -e "${EXE} Adding Device to ROM Vendor...";
STRTS=( "${ROMNIS}.devices" "${ROMNIS}-device-targets" vendorsetup.sh );
for STRT in ${STRTS[*]}; do
# Found file && Strat Not Performed
if [ -f "$STRT" ] && [ -z "$STDN" ]; then
if [[ $(grep -c "${SBDEV}" $STRT) == "0" ]]; then
case "$STRT" in
${ROMNIS}.devices)
echo -e "${SBDEV}" >> $STRT ;;
${ROMNIS}-device-targets)
echo -e "${ROMNIS}_${SBDEV}-${SBBT:-userdebug}" >> $STRT ;;
vendorsetup.sh)
echo -e "add_lunch_combo ${ROMNIS}_${SBDEV}-${SBBT:-userdebug}" >> $STRT ;;
esac
else
echo -e "${INF} Device already added to $STRT";
fi
export STDN="y"; # File Found, Strat Performed
fi
done
[ -z "$STDN" ] && dtree_add; # If none of the Strats Worked
echo -e "${SCS} Done.\n";
croot;
echo -e "${CL_WYT}=========================================================${NONE}";
} # vendor_strat
function vendor_strat_kpa() # AOKP-4.4|AICP|PAC-5.1|Krexus-CAF|AOSPA
{
croot;
cd vendor/${ROMNIS}/products;
echo -e "${INF} About Device's Resolution...\n";
if [ ! -z "$automate" ]; then
gimme_info "bootres";
echo -e "${QN} Enter the Desired Highlighted Number\n";
read -p $'\033[1;36m[>]\033[0m ' SBBTR;
else
echo -e "${INF} ${ATBT} Resolution Choosed : ${SBBTR}";
fi
#Vendor-Calls
case "$ROMNIS" in
"aicp")
VENF="${SBDEV}.mk";
echo -e "\t\$(LOCAL_DIR)/${VENF}" >> AndroidProducts.mk;
echo -e "\n# Inherit telephony stuff\n\$(call inherit-product, vendor/${ROMNIS}/configs/telephony.mk)" >> $VENF;
echo -e "\$(call inherit-product, vendor/${ROMNIS}/configs/common.mk)" >> $VENF;
;;
"aokp")
VENF="${SBDEV}.mk";
echo -e "\t\$(LOCAL_DIR)/${VENF}" >> AndroidProducts.mk;
echo -e "\$(call inherit-product, vendor/${ROMNIS}/configs/common.mk)" >> $VENF;
echo -e "\nPRODUCT_COPY_FILES += \ " >> $VENF;
echo -e "\tvendor/${ROMNIS}/prebuilt/bootanimation/bootanimation_${SBBTR}.zip:system/media/bootanimation.zip" >> $VENF;
;;
"krexus")
VENF="${ROMNIS}_${SBDEV}.mk";
echo -e "\$( call inherit-product, vendor/${ROMNIS}/products/common.mk)" >> $VENF;
echo -e "\n\$( call inherit-product, vendor/${ROMNIS}/products/vendorless.mk)" >> $VENF;
;;
"pa")
VENF="${SBDEV}/${ROMNIS}_${SBDEV}.mk";
echo -e "# ${SBCM} ${SBDEV}" >> AndroidProducts.mk
echo -e "\nifeq (${ROMNIS}_${SBDEV},\$(TARGET_PRODUCT))" >> AndroidProducts.mk;
echo -e "\tPRODUCT_MAKEFILES += \$(LOCAL_DIR)/${VENF}\nendif" >> AndroidProducts.mk;
echo -e "\ninclude vendor/${ROMNIS}/main.mk" >> $VENF;
mv ${CALL_ME_ROOT}/${DEVDIR}/*.dependencies ${SBDEV}/pa.dependencies;
;;
"pac")
VENF="${ROMNIS}_${SBDEV}.mk";
echo -e "\$( call inherit-product, vendor/${ROMNIS}/products/pac_common.mk)" >> $VENF;
echo -e "\nPAC_BOOTANIMATION_NAME := ${SBBTR};" >> $VENF;
;;
esac
find_ddc "pb";
echo -e "\n# Inherit from ${DDC}" >> $VENF;
echo -e "\$(call inherit-product, ${DEVDIR}/${DDC})" >> $VENF;
# PRODUCT_NAME is the only ROM-specific Identifier, setting it here is better.
echo -e "\n#ROM Specific Identifier\nPRODUCT_NAME := ${ROMNIS}_${SBDEV}" >> $VENF;
} # vendor_strat_kpa
function find_ddc() # For Finding Default Device Configuration file
{
ROMS=( aicp aokp aosp bliss candy carbon crdroid cyanide cm du orion \
ownrom slim tesla tipsy to validus vanir xenonhd xosp );
for ROM in ${ROMS[*]}; do
# Possible Default Device Configuration (DDC) Files
DDCS=( ${ROM}_${SBDEV}.mk full_${SBDEV}.mk aosp_${SBDEV}.mk ${ROM}.mk );
# Makefiles are arranged according to their priority of Usage. ROM.mk is the most used, ROM_DEVICE.mk is the least used.
# Inherit DDC
for ACTUAL_DDC in ${DDCS[*]}; do
if [ -f ${DEVDIR}/${ACTUAL_DDC} ]; then
case "$1" in
"pb") export DDC="$ACTUAL_DDC" ;;
"intm") # Interactive Makefile not found -vv
if [[ $(grep -c '##### Interactive' ${DEVDIR}/${ACTUAL_DDC}) == "0" ]] \
&& [[ "$ACTUAL_DDC" != "${ROMNIS}.mk" ]]; then # ROM Specific Makefile not Present
export DDC="$ACTUAL_DDC"; # Interactive makefile not present for that particular ROMNIS
continue; # searching for more relevant makefile
else
export DDC="NULL"; # Interactive Makefile already created, under ROMNIS name
break; # What now ? Get out!
fi
;;
esac
fi
done
[[ "$DDC" == "NULL" ]] && break; # It's Done, Get out!
done
} # find_ddc
function interactive_mk()
{
init_bld;
echo -e "\n${EXE} Creating Interactive Makefile for getting Identified by the ROM's BuildSystem...\n";
sleep 2;
function create_imk()
{
cd ${DEVDIR};
INTM="interact.mk";
[ -z "$INTF" ] && INTF="${ROMNIS}.mk";
echo "# ##### Interactive Makefile #####
#
# Licensed under the Apache License, Version 2.0 (the \"License\");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an \"AS IS\" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License." >> ${INTM};
echo -e "\n# Inherit ${ROMNIS} common stuff\n\$(call inherit-product, ${CNF}/${VNF}.mk)" >> ${INTM};
# Inherit Vendor specific files
if [[ $(grep -c 'nfc_enhanced' $DDC) == "1" ]] && [ -f ${CALL_ME_ROOT}/${CNF}/nfc_enhanced.mk ]; then
echo -e "\n# Enhanced NFC\n\$(call inherit-product, ${CNF}/nfc_enhanced.mk)" >> ${INTM};
fi
echo -e "\n# Calling Default Device Configuration File" >> ${INTM};
echo -e "\$(call inherit-product, ${DEVDIR}/${DDC})" >> ${INTM};
# To prevent Missing Vendor Calls in DDC-File
sed -i -e 's/inherit-product, vendor\//inherit-product-if-exists, vendor\//g' $DDC;
# Add User-desired Makefile Calls
echo -e "${QN} Missed some Makefile calls\n${INF} Enter number of Desired Makefile calls\n${INF} Enter 0 if none";
ST="No of Makefile Calls"; shut_my_mouth NMK "$ST";
for (( CNT=0; CNT<"${SBNMK}"; CNT++ )); do
echo -e "\n${QN} Enter Makefile location from Root of BuildSystem";
ST="Makefile"; shut_my_mouth LOC[$CNT] "$ST" array;
if [ -f ${CALL_ME_ROOT}/${SBLOC[$CNT]} ]; then
echo -e "\n${EXE} Adding Makefile `$[ $CNT + 1 ]` ...";
echo -e "\n\$(call inherit-product, ${SBLOC[$CNT]})" >> ${INTM};
else
echo -e "${FLD} Makefile ${SBLOC[$CNT]} not Found. Aborting...";
fi
done
echo -e "\n# ROM Specific Identifier\nPRODUCT_NAME := ${ROMNIS}_${SBDEV}" >> ${INTM};
# Make it Identifiable
mv ${INTM} ${INTF};
echo -e "${EXE} Renaming .dependencies file...\n";
[ ! -f ${ROMNIS}.dependencies ] && mv -f *.dependencies ${ROMNIS}.dependencies;
echo -e "${SCS} Done.";
croot;
} # create_imk
find_ddc "intm";
if [[ "$DDC" != "NULL" ]]; then create_imk; else echo "$NOINT"; fi;
} # interactive_mk
function need_for_int()
{
if [ -f ${CALL_ME_ROOT}/${DEVDIR}/${INTF} ]; then
echo "$NOINT";
else
interactive_mk "$SBRN";
fi
} # need_for_int
echo -e "\n${EXE} ${ROMNIS}-fying Device Tree...\n";
NOINT=$(echo -e "${SCS} Interactive Makefile Unneeded, continuing...");
case "$SBRN" in
4|5|13|16|30) # AOSP-CAF/RRO | Flayr | OmniROM | Zephyr
VNF="common";
INTF="${ROMNIS}_${SBDEV}.mk";
need_for_int;
rm -rf ${DEVDIR}/AndroidProducts.mk;
echo -e "PRODUCT_MAKEFILES := \\ \n\t\$(LOCAL_DIR)/${ROMNIS}_${SBDEV}.mk" >> AndroidProducts.mk;
;;
3) # AOSiP-CAF
if [ ! -f vendor/${ROMNIS}/products ]; then
VNF="common";
INTF="${ROMNIS}.mk";
need_for_int;
else
echo "$NOINT";
fi
;;
2|19) # AOKP-4.4 | PAC-5.1
if [ ! -f vendor/${ROMNIS}/products ]; then
VNF="$SBDTP";
INTF="${ROMNIS}.mk"
need_for_int;
else
echo "$NOINT";
fi
;;
1|14|20) # AICP | Krexus-CAF | AOSPA
echo "$NOINT";
;;
*) # Rest of the ROMs
VNF="$SBDTP";
INTF="${ROMNIS}.mk"
need_for_int;
;;
esac
if [ -d vendor/${ROMNIS}/products ] && [ ! -d vendor/aosip ]; then
if [ ! -f vendor/${ROMNIS}/products/${ROMNIS}_${SBDEV}.mk ||
! -f vendor/${ROMNIS}/products/${SBDEV}.mk ||
! -f vendor/${ROMNIS}/products/${SBDEV}/${ROMNIS}_${SBDEV}.mk ]; then
vendor_strat_kpa; #if found products folder
else
echo -e "\n${SCS} Looks like ${SBDEV} has been already added to ${ROM_FN} vendor. Good to go\n";
fi
else
vendor_strat_all; #if not found
fi
croot;
sleep 2;
export action_1="init" action_2="pre_build";
[ -z "$automate" ] && quick_menu;
} # pre_build
function build() # 4
{
if [ -d .repo ]; then
[ ! -z "$automate" ] && teh_action 4;
[ -z "$action_1" ] && rom_select;
[ -z "$action_2" ] && device_info;
else
echo -e "${FLD} ROM Source Not Found (Synced)\n${FLD} Please perform an init and sync before doing this";
exitScriBt 1;
fi
function hotel_menu()
{
echo -e "${CL_WYT}=========================${NONE} ${CL_LBL}Hotel Menu${NONE} ${CL_WYT}==========================${NONE}";
echo -e " Menu is only for your Device, not for you. No Complaints pls.\n";
echo -e "[*] lunch - Setup Build Environment for the Device";
echo -e "[*] breakfast - Download Device Dependencies and lunch";
echo -e "[*] brunch - breakfast + lunch then Start Build\n";
echo -e "${QN} Type in the Option you want to select\n";
echo -e "${INF} Building for the first time ? select lunch";
echo -e "${CL_WYT}===============================================================${NONE}\n";
ST="Selected Option"; shut_my_mouth SLT "$ST";
case "$SBSLT" in
"lunch") ${SBSLT} ${ROMNIS}_${SBDEV}-${SBBT:-userdebug} ;;
"breakfast") ${SBSLT} ${SBDEV} ${SBBT:-userdebug} ;;
"brunch")
echo -e "\n${EXE} Starting Compilation - ${ROM_FN} for ${SBDEV}\n";
${SBSLT} ${SBDEV};
;;
*) echo -e "${FLD} Invalid Selection.\n"; hotel_menu ;;
esac
echo;
} # hotel_menu
function post_build()
{
NRT_0=`tac $RMTMP | grep -m 1 'No rule to make target\|no known rule to make it'`;
if [[ $(tac $RMTMP | grep -c -m 1 '#### make completed successfully') == "1" ]]; then
echo -e "\n${SCS} Build completed successfully! Cool. Now make it Boot!";
the_response COOL Build;
teh_action 6 COOL;
elif [[ ! -z "$NRT_0" ]]; then
# if [[ ! -z "$DMNJ" ]]; then
# # ninja: error: 'A', needed by 'B', missing and no known rule to make it
# W NRT_1=(`echo "$NRT_0" | awk '{print $3 $6}' | awk -F "'" '{print $2" "$4}'`);
# i else
# P # make[X]: *** No rule to make target 'A', needed by 'B'.
# NRT_1=(`echo "$NRT_0" | awk -F "No rule to make target" '{print $2}' | awk -F "'" '{print $2" "$4}'`);
# fi
if [ ! -z "$automate" ]; then
teh_action 6 FAIL;
the_response FAIL Build;
fi
fi
} # post_build
function build_make()
{
if [[ "$1" != "brunch" ]]; then
START=$(date +"%s");
case "$SBMK" in
"make") BCORES=$(grep -c ^processor /proc/cpuinfo) ;;
*) BCORES="" ;;
esac
if [ $(grep -q "^${ROMNIS}:" "${CALL_ME_ROOT}/build/core/Makefile") ]; then
$SBMK $ROMNIS $BCORES 2>&1 | tee $RMTMP;
elif [ $(grep -q "^bacon:" "${CALL_ME_ROOT}/build/core/Makefile") ]; then
$SBMK bacon $BCORES 2>&1 | tee $RMTMP;
else
$SBMK otapackage $BCORES 2>&1 | tee $RMTMP;
fi
echo;
post_build;
END=$(date +"%s");
SEC=$(($END - $START));
echo -e "${INF} Build took $(($SEC / 3600)) hour(s), $(($SEC / 60 % 60)) minute(s) and $(($SEC % 60)) second(s)." | tee -a rom_compile.txt;
fi
} # build_make
function make_it() # Part of make_module
{
echo -e "${QN} ENTER the Directory where the Module is made from : \n";
read -p $'\033[1;36m[>]\033[0m ' MODDIR;
echo -e "\n${QN} Do you want to push the Module to the Device (Running the Same ROM) ${CL_WYT}[y/n]${NONE} : \n";
read -p $'\033[1;36m[>]\033[0m ' PMOD;
echo;
case "$PMOD" in
[yY]) mmmp -B $MODDIR ;;
[nN]) mmm -B $MODDIR ;;
*) echo -e "${FLD}Invalid Selection.\n"; make_it ;;
esac
} # make_it
function make_module()
{
if [ -z "$1" ]; then
echo -e "\n${QN} Know the Location of the Module : \n";
read -p $'\033[1;36m[>]\033[0m ' KNWLOC;
fi
if [[ "$KNWLOC" == "y" || "$1" == "y" ]]; then
make_it;
else
echo -e "${INF} Do either of these two actions:\n1. Google it (Easier)\n2. Run this command in terminal : sgrep \"LOCAL_MODULE := <Insert_MODULE_NAME_Here> \".\n\n Press ENTER after it's Done..\n";
read ENTER;
make_it;
fi
} # make_module
function build_menu()
{
init_bld;
echo -e "${CL_WYT}=========================================================${NONE}\n";
echo -e "${QN} Select a Build Option:\n";
echo -e "1. Start Building ROM (ZIP output) (Clean Options Available)";
echo -e "2. Make a Particular Module";
echo -e "3. Setup CCACHE for Faster Builds \n";
echo -e "${CL_WYT}=========================================================\n";
ST="Option Selected"; shut_my_mouth BO "$ST";
}
build_menu;
case "$SBBO" in
1)
echo -e "\n${QN} Should i use 'make' or 'mka'\n";
ST="Selected Method"; shut_my_mouth MK "$ST";
echo -e "${QN} Wanna Clean the /out before Building\n${INF} 1 - Remove Staging Dirs | 2 - Full Clean\n";
ST="Option Selected"; shut_my_mouth CL "$ST";
if [[ $(grep -c 'BUILD_ID=M\|BUILD_ID=N' ${CALL_ME_ROOT}/build/core/build_id.mk) == "1" ]]; then
echo -e "${QN} Use Jack Toolchain ${CL_WYT}[y/n]${NONE}\n";
ST="Use Jacky"; shut_my_mouth JK "$ST";
case "$SBJK" in
[yY]) export ANDROID_COMPILE_WITH_JACK=true ;;
[nN]) export ANDROID_COMPILE_WITH_JACK=false ;;
esac
fi
if [[ $(grep -c 'BUILD_ID=N' ${CALL_ME_ROOT}/build/core/build_id.mk) == "1" ]]; then
echo -e "${QN} Use Ninja to build Android ${CL_WYT}[y/n]${NONE}";
ST="Use Ninja"; shut_my_mouth NJ "$ST";
case "$SBNJ" in
[yY])
echo -e "\n${INF} Building Android with Ninja BuildSystem";
export USE_NINJA=true;
;;
[nN])
echo -e "\n${INF} Building Android with the Non-Ninja BuildSystem\n";
export USE_NINJA=false;
unset BUILDING_WITH_NINJA;
;;
*) echo -e "${FLD} Invalid Selection.\n" ;;
esac
fi
case "$SBCL" in
1) lunch ${ROMNIS}_${SBDEV}-${SBBT:-userdebug}; $SBMK installclean ;;
2) lunch ${ROMNIS}_${SBDEV}-${SBBT:-userdebug}; $SBMK clean ;;
*) echo -e "${INF} No Clean Option Selected.\n" ;;
esac
hotel_menu;
build_make "$SBSLT";
;;
2) make_module ;;
3) set_ccvars ;;
*)
echo -e "${FLD} Invalid Selection.\n";
build;
;;
esac
export action_3="build";
} # build
function tools() # 5
{
[ ! -z "$automate" ] && teh_action 5;
function installdeps()
{
echo -e "${EXE} Analyzing Distro";
PACK="/etc/apt/sources.list.d/official-package-repositories.list";
DISTROS=( precise quantal raring saucy trusty utopic vivid wily xenial );
for DIST in ${DISTROS[*]}; do
if [[ $(grep -c "${DIST}" "${PACK}") != "0" ]]; then
export DISTRO="${DIST}";
fi
done
echo -e "\n${EXE} Installing Build Dependencies\n";
# Common Packages
COMMON_PKGS=( git-core git gnupg flex bison gperf build-essential zip curl \
ccache libxml2-utils xsltproc g++-multilib squashfs-tools zlib1g-dev \
pngcrush schedtool libwxgtk2.8-dev python lib32z1-dev lib32z-dev lib32z1 \
libxml2 optipng python-networkx python-markdown make unzip );
case "$DISTRO" in # Distro-Specific Pkgs
"precise"|"quantal")
DISTRO_PKGS=( libc6-dev libncurses5-dev:i386 x11proto-core-dev \
libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
libgl1-mesa-dev mingw32 tofrodos zlib1g-dev:i386 ) ;;
"raring"|"saucy")
DISTRO_PKGS=( zlib1g-dev:i386 libc6-dev lib32ncurses5 \
lib32bz2-1.0 lib32ncurses5-dev x11proto-core-dev \
libx11-dev:i386 libreadline6-dev:i386 \
libgl1-mesa-glx:i386 libgl1-mesa-dev \
mingw32 tofrodos readline-common libreadline6-dev libreadline6 \
lib32readline-gplv2-dev libncurses5-dev lib32readline5 \
lib32readline6 libreadline-dev libreadline6-dev:i386 \
libreadline6:i386 bzip2 libbz2-dev libbz2-1.0 libghc-bzlib-dev \
lib32bz2-dev libsdl1.2-dev libesd0-dev ) ;;
"trusty"|"utopic")
DISTRO_PKGS=( libc6-dev-i386 lib32ncurses5-dev liblz4-tool \
x11proto-core-dev libx11-dev libgl1-mesa-dev maven maven2 ) ;;
"vivid"|"wily")
DISTRO_PKGS=( libesd0-dev liblz4-tool libncurses5-dev \
libsdl1.2-dev libwxgtk2.8-dev lzop maven maven2 \
lib32ncurses5-dev lib32readline6-dev liblz4-tool ) ;;
"xenial")
DISTRO_PKGS=( automake lzop libesd0-dev maven \
liblz4-tool libncurses5-dev libsdl1.2-dev libwxgtk3.0-dev \
lzop lib32ncurses5-dev lib32readline6-dev lib32z1-dev \
zlib1g-dev:i386 libbz2-dev libbz2-1.0 libghc-bzlib-dev ) ;;
esac
# Install 'em all
sudo -p $'\033[1;35m[#]\033[0m ' apt-get install -y ${COMMON_PKGS[*]} ${DISTRO_PKGS[*]};
} # installdeps
function installdeps_arch()
{
# common packages
PKGS="git gnupg flex bison gperf sdl wxgtk squashfs-tools curl ncurses zlib schedtool perl-switch zip unzip libxslt python2-virtualenv bc rsync maven";
PKGS64="$( pacman -Sgq multilib-devel ) lib32-zlib lib32-ncurses lib32-readline";
PKGSJAVA="jdk6 jdk7-openjdk";
PKGS_CONFLICT="gcc gcc-libs";
# sort out already installed pkgs
for item in ${PKGS} ${PKGS64} ${PKGSJAVA}; do
if ! pacman -Qq ${item} &> /dev/null; then
PKGSREQ="${item} ${PKGSREQ}";
fi
done
# if there are required packages, run the installer
if [ ${#PKGSREQ} -ge 4 ]; then
# choose an AUR package manager instead of pacman
for item in yaourt pacaur packer; do
if which ${item} &> /dev/null; then
AURMGR="${item}";
fi
done
if [ -z ${AURMGR} ]; then
echo -e "\n${FLD} no AUR manager found\n";
exitScriBt 1;
fi
# look for conflicting packages and uninstall them
for item in ${PKGS_CONFLICT}; do
if pacman -Qq ${item} &> /dev/null; then
sudo -p $'\033[1;35m[#]\033[0m ' pacman -Rddns --noconfirm ${item};
sleep 3;
fi
done
# install required packages
for item in ${PKGSREQ}; do
${AURMGR} -S --noconfirm $item;
done
else
echo -e "\n${SCS} You already have all required packages\n";
fi
} # installdeps_arch
function java_select()
{
echo -e "${INF} If you have Installed Multiple Versions of Java or Installed Java from Different Providers (OpenJDK / Oracle)";
echo -e "${INF} You may now select the Version of Java which is to be used BY-DEFAULT\n";
echo -e "${CL_WYT}================================================================${NONE}\n";
case "${PKGMGR}" in
"apt")
sudo -p $'\033[1;35m[#]\033[0m ' update-alternatives --config java;
echo -e "\n${CL_WYT}================================================================${NONE}\n";
sudo -p $'\033[1;35m[#]\033[0m ' update-alternatives --config javac;
;;
"pacman")
archlinux-java status;
read -p "${INF} Please enter desired version (ie. \"java-7-openjdk\"): " ARCHJA;
sudo -p $'\033[1;35m[#]\033[0m ' archlinux-java set ${ARCHJA};
;;
esac
echo -e "\n${CL_WYT}================================================================${NONE}";
} # java_select
function java()
{
echo -ne "\033]0;ScriBt : Java $1\007";
echo -e "\n${EXE} Installing OpenJDK-$1 (Java 1.$1.0)";
echo -e "\n${INF} Remove other Versions of Java ${CL_WYT}[y/n]${NONE}? : \n";
read -p $'\033[1;36m[>]\033[0m ' REMOJA;
echo;
case "$REMOJA" in
[yY])
case "${PKGMGR}" in
"apt") sudo -p $'\033[1;35m[#]\033[0m ' apt-get purge openjdk-* icedtea-* icedtea6-* ;;
"pacman") sudo -p $'\033[1;35m[#]\033[0m ' pacman -Rddns $( pacman -Qqs ^jdk ) ;;
esac
echo -e "\n${SCS} Removed Other Versions successfully"
;;
[nN]) echo -e "${EXE} Keeping them Intact" ;;
*)
echo -e "${FLD} Invalid Selection.\n";
java $1;
;;
esac
echo -e "${CL_WYT}==========================================================${NONE}\n";
case "${PKGMGR}" in
"apt") sudo -p $'\033[1;35m[#]\033[0m ' apt-get update -y ;;
"pacman") sudo -p $'\033[1;35m[#]\033[0m ' pacman -Sy ;;
esac
echo -e "\n${CL_WYT}==========================================================${NONE}\n";
case "${PKGMGR}" in
"apt") sudo -p $'\033[1;35m[#]\033[0m ' apt-get install openjdk-$1-jdk -y ;;
"pacman") sudo -p $'\033[1;35m[#]\033[0m ' pacman -S jdk$1-openjdk ;;
esac
echo -e "\n${CL_WYT}==========================================================${NONE}";
if [[ $( java -version > $TMP && grep -c "java version \"1\.$1" $TMP ) == "1" ]]; then
echo -e "${SCS} OpenJDK-$1 or Java 1.$1.0 has been successfully installed";
echo -e "${CL_WYT}==========================================================${NONE}";
fi
} # java
function java_ppa()
{
if [[ ! $(which add-apt-repository) ]]; then
echo -e "${EXE} add-apt-repository not present. Installing it...";
sudo -p $'\033[1;35m[#]\033[0m ' apt-get install software-properties-common;
fi
sudo -p $'\033[1;35m[#]\033[0m ' add-apt-repository ppa:openjdk-r/ppa -y;
sudo -p $'\033[1;35m[#]\033[0m ' apt-get update -y;
sudo -p $'\033[1;35m[#]\033[0m ' apt-get install openjdk-$1-jdk -y;
} # java_ppa
function java_menu()
{
echo -e "${CL_WYT}=============${NONE} ${CL_YEL}JAVA${NONE} Installation ${CL_WYT}============${NONE}\n";
echo -e "1. Install Java";
echo -e "2. Switch Between Java Versions / Providers\n";
echo -e "0. Quick Menu\n";
echo -e "${INF} ScriBt installs Java by OpenJDK";
echo -e "\n${CL_WYT}============================================\n${NONE}";
read -p $'\033[1;36m[>]\033[0m ' JAVAS;
case "$JAVAS" in
0) quick_menu ;;
1)
echo -ne '\033]0;ScriBt : Java\007';
echo -e "\n${QN} Android Version of the ROM you're building";
echo -e "1. Java 1.6.0 (4.4.x Kitkat)";
echo -e "2. Java 1.7.0 (5.x.x Lollipop && 6.x.x Marshmallow)";
echo -e "3. Java 1.8.0 (7.x.x Nougat)\n";
[[ "${PKGMGR}" == "apt" ]] && echo -e "4. Ubuntu 16.04 & Want to install Java 7\n5. Ubuntu 14.04 & Want to install Java 8";
read -p $'\033[1;36m[>]\033[0m ' JAVER;
case "$JAVER" in
1) java 6 ;;
2) java 7 ;;
3) java 8 ;;
4) java_ppa 7 ;;
5) java_ppa 8 ;;
*)
echo -e "\n${FLD} Invalid Selection.\n";
java_menu;
;;
esac # JAVER
;;
2) java_select ;;
*)
echo -e "\n${FLD} Invalid Selection.\n";
java_menu;
;;
esac # JAVAS
} # java_menu
function udev_rules()
{
echo -e "\n${CL_WYT}==========================================================${NONE}\n";
echo -e "${EXE} Updating / Creating Android USB udev rules (51-android)\n";
sudo -p $'\033[1;35m[#]\033[0m ' curl --create-dirs -L -o /etc/udev/rules.d/51-android.rules -O -L https://raw.githubusercontent.com/snowdream/51-android/master/51-android.rules;
sudo -p $'\033[1;35m[#]\033[0m ' chmod a+r /etc/udev/rules.d/51-android.rules;
sudo -p $'\033[1;35m[#]\033[0m ' service udev restart;
echo -e "\n${SCS} Done";
echo -e "\n${CL_WYT}==========================================================${NONE}\n";
} # udev_rules
function make_me_old()
{
MKVR=$(make -v | head -1 | awk '{print $3}');
case "${MKVR}" in
"3.81") echo -e "\n${SCS} make 3.81 has already been installed" ;;
*)
echo "\n${EXE} Installing make 3.81...";
sudo -p $'\033[1;35m[#]\033[0m ' install utils/make /usr/bin/;
;;
esac
[[ "$MKVR" == "3.81" ]] && echo -e "\n${SCS} make 3.81 present";
} # make_me_old
function git_creds()
{
echo -e "\n${INF} Enter the Details with reference to your ${CL_WYT}GitHub account${NONE}\n\n";
sleep 2;
echo -e "${QN} Enter the Username";
echo -e "${INF} Username is the one which appears on the GitHub Account URL\n${INF} Ex. https://github.com/[ACCOUNT_NAME]\n";
read -p $'\033[1;36m[>]\033[0m ' GIT_U;
echo -e "\n${QN} Enter the E-mail ID\n";
read -p $'\033[1;36m[>]\033[0m ' GIT_E;
git config --global user.name "${GIT_U}";
git config --global user.email "${GIT_E}";
echo -e "\n${SCS} Done.\n"
quick_menu;
} # git_creds
function tool_menu()
{
echo -e "\n${CL_WYT}===================${NONE} ${CL_LBL}Tools${NONE} ${CL_WYT}====================${NONE}\n";