forked from PizzaG/A-Team-Addon_Package
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Moto-Common-Setup.sh
executable file
·572 lines (523 loc) · 17.6 KB
/
Moto-Common-Setup.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
#!/bin/bash
#
# Copyright 2019-Present A-Team Digital Solutions
#
# A-Team Moto-Common Setup Script
#
# Date
date=$(date -u +%m%d%Y)
# Print Rom Name To Terminal
echo -ne "\033]0;$(basename $(dirname ${PWD}))\007"
# Copyright & Current Date Stamp
echo ""
echo "Copyright 2019-Present A-Team Digital Solutions"
echo " $date"
echo ""
sleep 10
clear
# Software Info
echo ""
echo "A-Team Moto-Common Setup Script"
echo ""
echo ""
echo "Setup Version: 0.12"
echo "Setup Update: 1-2-2024"
echo ""
echo ""
echo "Current Date: $date"
echo ""
echo ""
sleep 10
# Ensure Final Package Directory Location Exists
echo "Creating Final Rom Directory Location..."
echo ""
echo "1/1..."
echo ""
mkdir $FINAL_ROM_LOCATION >/dev/null 2>&1
echo "Final Rom Location: $FINAL_ROM_LOCATION/YOUR_DEVICE_CODENAME"
echo ""
sleep 5
# Check If Rom Uses Changelog & Hijack It If So For Custom Changelogs
if [ -f vendor/$ROM_BUILD_NAME/tools/changelog ]; then
echo "Rom changelog Found, Hijacking For Custom Changelog Ability..."
echo ""
# Backup Original
echo "Backing Up Original changelog..."
echo ""
echo "1/1..."
echo ""
mv vendor/$ROM_BUILD_NAME/tools/changelog vendor/$ROM_BUILD_NAME/tools/changelog.bak
sleep 5
# Copy Modded
echo "Copying Modified changelog..."
echo ""
echo "1/1..."
echo ""
cp -r $A_TEAM_PACKAGE_LOCATION/Changelog/changelog vendor/$ROM_BUILD_NAME/tools
sleep 5
# Copy Changelog Template Files
echo "Copying Device Specific Changelog Templates..."
echo ""
echo "1/6..."
echo ""
cp -r $A_TEAM_PACKAGE_LOCATION/Changelog/Changelog.txt.Amogus Changelog.txt.Amogus
sleep 5
echo "2/6..."
echo ""
cp -r $A_TEAM_PACKAGE_LOCATION/Changelog/Changelog.txt.Borneo Changelog.txt.Borneo
sleep 5
echo "3/6..."
echo ""
cp -r $A_TEAM_PACKAGE_LOCATION/Changelog/Changelog.txt.Guamna Changelog.txt.Guamna
sleep 5
echo "4/6..."
echo ""
cp -r $A_TEAM_PACKAGE_LOCATION/Changelog/Changelog.txt.Hanoip Changelog.txt.Hanoip
sleep 5
echo "5/6..."
echo ""
cp -r $A_TEAM_PACKAGE_LOCATION/Changelog/Changelog.txt.Milanf Changelog.txt.Milanf
sleep 5
echo "6/6..."
echo ""
cp -r $A_TEAM_PACKAGE_LOCATION/Changelog/Changelog.txt.Osaka Changelog.txt.Osaka
sleep 5
elif [ -f vendor/$ROM_BUILD_NAME/tools/changelog.sh ]; then
echo "Rom changelog.sh Found, Hijacking For Custom Changelog Ability..."
echo ""
# Backup Original
echo "Backing Up Original changelog.sh..."
echo ""
echo "1/1..."
echo ""
mv vendor/$ROM_BUILD_NAME/tools/changelog.sh vendor/$ROM_BUILD_NAME/tools/changelog.sh.bak
sleep 5
# Copy Modded
echo "Copying Modified changelog.sh..."
echo ""
echo "1/1..."
echo ""
cp -r $A_TEAM_PACKAGE_LOCATION/Changelog/changelog.sh vendor/$ROM_BUILD_NAME/tools
sleep 5
# Copy Changelog Template Files
echo "Copying Device Specific Changelog Templates..."
echo ""
echo "1/6..."
echo ""
cp -r $A_TEAM_PACKAGE_LOCATION/Changelog/Changelog.txt.Amogus Changelog.txt.Amogus
sleep 5
echo "2/6..."
echo ""
cp -r $A_TEAM_PACKAGE_LOCATION/Changelog/Changelog.txt.Borneo Changelog.txt.Borneo
sleep 5
echo "3/6..."
echo ""
cp -r $A_TEAM_PACKAGE_LOCATION/Changelog/Changelog.txt.Guamna Changelog.txt.Guamna
sleep 5
echo "4/6..."
echo ""
cp -r $A_TEAM_PACKAGE_LOCATION/Changelog/Changelog.txt.Hanoip Changelog.txt.Hanoip
sleep 5
echo "5/6..."
echo ""
cp -r $A_TEAM_PACKAGE_LOCATION/Changelog/Changelog.txt.Milanf Changelog.txt.Milanf
sleep 5
echo "6/6..."
echo ""
cp -r $A_TEAM_PACKAGE_LOCATION/Changelog/Changelog.txt.Osaka Changelog.txt.Osaka
sleep 5
elif [ -f vendor/$ROM_BUILD_NAME/build/tools/changelog.sh ]; then
echo "Rom changelog.sh Found, Hijacking For Custom Changelog Ability..."
echo ""
# Backup Original
echo "Backing Up Original changelog.sh..."
echo ""
echo "1/1..."
echo ""
mv vendor/$ROM_BUILD_NAME/build/tools/changelog.sh vendor/$ROM_BUILD_NAME/build/tools/changelog.sh.bak
sleep 5
# Copy Modded
echo "Copying Modified changelog.sh..."
echo ""
echo "1/1..."
echo ""
cp -r $A_TEAM_PACKAGE_LOCATION/Changelog/changelog.sh vendor/$ROM_BUILD_NAME/build/tools
sleep 5
# Copy Changelog Template Files
echo "Copying Device Specific Changelog Templates..."
echo ""
echo "1/6..."
echo ""
cp -r $A_TEAM_PACKAGE_LOCATION/Changelog/Changelog.txt.Amogus Changelog.txt.Amogus
sleep 5
echo "2/6..."
echo ""
cp -r $A_TEAM_PACKAGE_LOCATION/Changelog/Changelog.txt.Borneo Changelog.txt.Borneo
sleep 5
echo "3/6..."
echo ""
cp -r $A_TEAM_PACKAGE_LOCATION/Changelog/Changelog.txt.Guamna Changelog.txt.Guamna
sleep 5
echo "4/6..."
echo ""
cp -r $A_TEAM_PACKAGE_LOCATION/Changelog/Changelog.txt.Hanoip Changelog.txt.Hanoip
sleep 5
echo "5/6..."
echo ""
cp -r $A_TEAM_PACKAGE_LOCATION/Changelog/Changelog.txt.Milanf Changelog.txt.Milanf
sleep 5
echo "6/6..."
echo ""
cp -r $A_TEAM_PACKAGE_LOCATION/Changelog/Changelog.txt.Osaka Changelog.txt.Osaka
sleep 5
fi
# General Moto-Common Setup
echo "Copying A-Team Rom Addon Package To Device Tree..."
echo ""
echo "1/1..."
echo ""
cp -r $A_TEAM_PACKAGE_LOCATION/device/motorola/A-Team device/motorola
sleep 5
echo "Copying A-Team Telegram Bot Folder To Rom Root..."
echo ""
echo "1/2..."
echo ""
mkdir Telegram_Bots
echo "2/2..."
echo ""
cp -r $A_TEAM_PACKAGE_LOCATION/Telegram_Bots/* Telegram_Bots
sleep 5
## Patch CommonConfig.mk
echo "Patching CommonConfig.mk..."
echo ""
echo "1/1..."
echo ""
sed -i '/BUILD_BROKEN_ELF_PREBUILT_PRODUCT_COPY_FILES := true/ a BUILD_BROKEN_DUP_RULES := true' device/motorola/common/CommonConfig.mk
sleep 5
## Patch common.mk
echo "Patching common.mk..."
echo ""
echo "1/1..."
echo ""
sed -i '/# limitations under the License./ a\\ \nA_TEAM_PATH := device/motorola/A-Team\n\n# A-Team Custom Installer / Mods\nifeq ($(CUSTOM_INSTALLER), true)\n$(call inherit-product, $(A_TEAM_PATH)/A-Team.mk)\nPRODUCT_SOONG_NAMESPACES += \\\n [A-Team_Installer]\nendif' device/motorola/targets/include/common.mk
sleep 5
# Patch Vendor Android.mk For Custom APN Selection
echo "Patching Android.mk..."
echo ""
echo "1/2..."
echo ""
sed -i 's\DEFAULT_APNS_FILE := vendor/'$ROM_BUILD_NAME'/prebuilt/common/etc/apns-conf.xml\# Custom APN Mechanism\g' vendor/$ROM_BUILD_NAME/prebuilt/common/Android.mk
sleep 5
echo "2/2..."
echo ""
sed -i '/# Custom APN Mechanism/ a ifeq ($(CUSTOM_APN), true)\nDEFAULT_APNS_FILE := device/motorola/A-Team/Custom_APN/apns-conf.xml\nelse\nDEFAULT_APNS_FILE := vendor/$(ROM_BUILD_NAME)/prebuilt/common/etc/apns-conf.xml\nendif' vendor/$ROM_BUILD_NAME/prebuilt/common/Android.mk
sleep 5
echo "Copying & Setting Up Modified Common Device Tree Files..."
echo ""
echo "1/7..."
echo ""
cp -r $A_TEAM_PACKAGE_LOCATION/device/motorola/sm4250-common device/motorola
sleep 5
echo "2/7..."
echo ""
cp -r $A_TEAM_PACKAGE_LOCATION/device/motorola/sm4350-common device/motorola
sleep 5
echo "3/7..."
echo ""
cp -r $A_TEAM_PACKAGE_LOCATION/device/motorola/sm6150-common device/motorola
sleep 5
echo "4/7..."
echo ""
cp -r $A_TEAM_PACKAGE_LOCATION/device/motorola/targets/include/kernel/source.mk device/motorola/targets/include/kernel
sleep 5
echo "5/7..."
echo ""
rm -rf device/motorola/targets/scripts
sleep 5
echo "6/7..."
echo ""
cp -r $A_TEAM_PACKAGE_LOCATION/device/motorola/targets/scripts device/motorola/targets
sleep 5
echo "7/7..."
echo ""
cp -r $A_TEAM_PACKAGE_LOCATION/device/motorola/targets/Update_Rom_Symlinks.sh device/motorola/targets
sleep 5
# A-Team Internal System/Vendor Version Mismatch Error Patch Check
echo "Checking If Rom Needs Internal System/Vendor Version Mismatch Error Patch..."
echo ""
if [ -f frameworks/base/core/java/android/os/Build.java.orig ]; then
echo "A-Team Patch 1 Already Applied, Skipping..."
echo ""
sleep 5
elif [ -f frameworks/base/core/java/android/os/Build.java.rej ]; then
echo "A-Team Patch 1 Already Applied, Skipping..."
echo ""
sleep 5
else
echo "Rom Needs Internal System/Vendor Version Mismatch Error Patch, Patching..."
echo ""
echo "1/1..."
echo ""
patch -u -b frameworks/base/core/java/android/os/Build.java -i device/$DT_MANUFACTURER/A-Team/Build.java.patch
sleep 5
echo ""
fi
# Check If Rom .mk File Exists, Copy If So & Then Run Symlink Script
if [ -f $A_TEAM_PACKAGE_LOCATION/device/$DT_MANUFACTURER/targets/rom/$ROM_BUILD_NAME.mk ]; then
echo "Checking If Rom .mk File Exists..."
echo ""
sleep 5
echo "Rom .mk File Found👍..."
echo ""
sleep 5
# Copy Rom .mk File
echo "Copying Rom .mk File To Location..."
echo ""
echo "1/1..."
echo ""
cp -r $A_TEAM_PACKAGE_LOCATION/device/$DT_MANUFACTURER/targets/rom/$ROM_BUILD_NAME.mk device/$DT_MANUFACTURER/targets/rom
sleep 5
####################
# Update Moto-Common Device Symlinks
cd device/$DT_MANUFACTURER/targets
./Update_Rom_Symlinks.sh
cd ../../../
####################
else
echo "Rom .mk File Not Found"
echo "You Will Need To Create It Manually"
echo "Then Run Update_Rom_Symlinks.sh Patch In Targets Folder"
echo ""
sleep 5
fi
# Amogus Setup
##########################################################################################################
# Move Files To Location
echo "Copying Amogus Files Into Device Tree..."
echo ""
echo "1/2..."
echo ""
cp -r $A_TEAM_PACKAGE_LOCATION/device/motorola/amogus/rootdir device/motorola/amogus
sleep 5
echo "2/2..."
echo ""
cp -r $A_TEAM_PACKAGE_LOCATION/device/motorola/amogus/rro_overlays device/motorola/amogus
sleep 5
# Patch BoardConfig.mk
echo "Patching Amogus BoardConfig.mk In Device Tree..."
echo ""
echo "1/4..."
echo ""
sed -i 's/BOARD_EROFS_PCLUSTER_SIZE := 262144/#BOARD_EROFS_PCLUSTER_SIZE := 262144/g' device/motorola/amogus/BoardConfig.mk
sleep 5
echo "2/4..."
echo ""
sed -i 's/BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE := erofs/BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE := ext4/g' device/motorola/amogus/BoardConfig.mk
sleep 5
echo "3/4..."
echo ""
sed -i 's/BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := erofs/BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4/g' device/motorola/amogus/BoardConfig.mk
sleep 5
echo "4/4..."
echo ""
sed -i 's/ BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE := erofs/ BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE := ext4/g' device/motorola/amogus/BoardConfig.mk
sleep 5
# Patch device.mk
echo "Patching Amogus device.mk In Device Tree..."
echo ""
echo "1/2..."
echo ""
sed -i 's/PRODUCT_MODEL := moto g(8) family/PRODUCT_MODEL := Moto G8 Family/g' device/motorola/amogus/device.mk
sleep 5
echo "2/2..."
echo ""
sed -i '/ amogus_folders/ a\\ \n# Disable Adaptive Brightness\nPRODUCT_PACKAGES += amogusSettingsProviderOverlay' device/motorola/amogus/device.mk
sleep 5
# Backup & Copy amogus_defconfig File
echo "Backing Up Original amogus_defconfig In Device Tree..."
echo ""
echo "1/1..."
echo ""
mv kernel/motorola/msm-4.14/arch/arm64/configs/vendor/amogus_defconfig kernel/motorola/msm-4.14/arch/arm64/configs/vendor/amogus_defconfig.bak
sleep 5
echo "Copying Modified amogus_defconfig Into Device Tree..."
echo ""
echo "1/1..."
echo ""
cp -r $A_TEAM_PACKAGE_LOCATION/kernel/motorola/msm-4.14/arch/arm64/configs/vendor/amogus_defconfig kernel/motorola/msm-4.14/arch/arm64/configs/vendor
sleep 5
# Borneo Setup
##########################################################################################################
# Move Files To Location
echo "Copying Borneo Files Into Device Tree..."
echo ""
echo "1/1..."
echo ""
cp -r $A_TEAM_PACKAGE_LOCATION/device/motorola/borneo/rro_overlays device/motorola/borneo
sleep 5
# Patch device.mk
echo "Patching Borneo device.mk In Device Tree..."
echo ""
echo "1/2..."
echo ""
sed -i 's\PRODUCT_MODEL := moto g power 2021\PRODUCT_MODEL := Moto G Power 2021 / G9 Power\g' device/motorola/borneo/device.mk
sleep 5
echo "2/2..."
echo ""
sed -i '/ ro.sf.lcd_density=280/ a\\ \n# Disable Adaptive Brightness\nPRODUCT_PACKAGES += borneoSettingsProviderOverlay' device/motorola/borneo/device.mk
sleep 5
# Backup & Copy borneo_defconfig File
echo "Backing Up Original borneo_defconfig In Device Tree..."
echo ""
echo "1/1..."
echo ""
mv kernel/motorola/msm-4.19-borneo/arch/arm64/configs/vendor/borneo_defconfig kernel/motorola/msm-4.19-borneo/arch/arm64/configs/vendor/borneo_defconfig.bak
sleep 5
echo "Copying Modified borneo_defconfig Into Device Tree..."
echo ""
echo "1/1..."
echo ""
cp -r $A_TEAM_PACKAGE_LOCATION/kernel/motorola/msm-4.19-borneo/arch/arm64/configs/vendor/borneo_defconfig kernel/motorola/msm-4.19-borneo/arch/arm64/configs/vendor
sleep 5
# Guamna Setup
##########################################################################################################
# Move Files To Location
echo "Copying Guamna Files Into Device Tree..."
echo ""
echo "1/1..."
echo ""
cp -r $A_TEAM_PACKAGE_LOCATION/device/motorola/guamna/rro_overlays device/motorola/guamna
sleep 5
# Patch device.mk
echo "Patching Guamna device.mk In Device Tree..."
echo ""
echo "1/2..."
echo ""
sed -i 's\PRODUCT_MODEL := moto g play 2021\PRODUCT_MODEL := Moto G Play 2021 / G9 / G9 Play\g' device/motorola/guamna/device.mk
sleep 5
echo "2/2..."
echo ""
sed -i '/ com.qti.sensormodule.mot_guam_s5k3l6_ofilm.bin/ a\\ \n# Disable Adaptive Brightness\nPRODUCT_PACKAGES += guamnaSettingsProviderOverlay' device/motorola/guamna/device.mk
sleep 5
# Backup & Copy guamna_defconfig File
echo "Backing Up Original guamna_defconfig In Device Tree..."
echo ""
echo "1/1..."
echo ""
mv kernel/motorola/msm-4.19/arch/arm64/configs/vendor/guamna_defconfig kernel/motorola/msm-4.19/arch/arm64/configs/vendor/guamna_defconfig.bak
sleep 5
echo "Copying Modified guamna_defconfig Into Device Tree..."
echo ""
echo "1/1..."
echo ""
cp -r $A_TEAM_PACKAGE_LOCATION/kernel/motorola/msm-4.19/arch/arm64/configs/vendor/guamna_defconfig kernel/motorola/msm-4.19/arch/arm64/configs/vendor
sleep 5
# Hanoip Setup
##########################################################################################################
# Move Files To Location
echo "Copying Hanoip Files Into Device Tree..."
echo ""
echo "1/1..."
echo ""
cp -r $A_TEAM_PACKAGE_LOCATION/device/motorola/hanoip/rro_overlays device/motorola/hanoip
sleep 5
# Patch device.mk
echo "Patching Hanoip device.mk In Device Tree..."
echo ""
echo "1/2..."
echo ""
sed -i 's\PRODUCT_MODEL := moto g(60)\PRODUCT_MODEL := Moto G40 Fusion / Moto G60\g' device/motorola/hanoip/device.mk
sleep 5
echo "2/2..."
echo ""
sed -i '/DEVICE_CHARACTERISTICS += hfr/ a\\ \n# Disable Adaptive Brightness\nPRODUCT_PACKAGES += hanoipSettingsProviderOverlay' device/motorola/hanoip/device.mk
sleep 5
# Backup & Copy hanoip_defconfig File
echo "Backing Up Original hanoip_defconfig In Device Tree..."
echo ""
echo "1/1..."
echo ""
mv kernel/motorola/msm-4.14-hanoip/arch/arm64/configs/vendor/hanoip_defconfig kernel/motorola/msm-4.14-hanoip/arch/arm64/configs/vendor/hanoip_defconfig.bak
sleep 5
echo "Copying Modified hanoip_defconfig Into Device Tree..."
echo ""
echo "1/1..."
echo ""
cp -r $A_TEAM_PACKAGE_LOCATION/kernel/motorola/msm-4.14-hanoip/arch/arm64/configs/vendor/hanoip_defconfig kernel/motorola/msm-4.14-hanoip/arch/arm64/configs/vendor
sleep 5
# Milanf Setup
##########################################################################################################
# Move Files To Location
echo "Copying Milanf Files Into Device Tree..."
echo ""
echo "1/1..."
echo ""
cp -r $A_TEAM_PACKAGE_LOCATION/device/motorola/milanf/rro_overlays device/motorola/milanf
sleep 5
# Patch device.mk
echo "Patching Milanf device.mk In Device Tree..."
echo ""
echo "1/2..."
echo ""
sed -i 's/PRODUCT_MODEL := moto g stylus 5g 2022/PRODUCT_MODEL := Moto G Stylus 5G 2022/g' device/motorola/milanf/device.mk
sleep 5
echo "2/2..."
echo ""
sed -i '/DEVICE_CHARACTERISTICS += hfr/ a\\ \n# Disable Adaptive Brightness\nPRODUCT_PACKAGES += milanfSettingsProviderOverlay' device/motorola/milanf/device.mk
sleep 5
# Backup & Copy milanf_defconfig File
echo "Backing Up Original milanf_defconfig In Device Tree..."
echo ""
echo "1/1..."
echo ""
mv kernel/motorola/msm-5.4/arch/arm64/configs/vendor/milanf_defconfig kernel/motorola/msm-5.4/arch/arm64/configs/vendor/milanf_defconfig.bak
sleep 5
echo "Copying Modified milanf_defconfig Into Device Tree..."
echo ""
echo "1/1..."
echo ""
cp -r $A_TEAM_PACKAGE_LOCATION/kernel/motorola/msm-5.4/arch/arm64/configs/vendor/milanf_defconfig kernel/motorola/msm-5.4/arch/arm64/configs/vendor
sleep 5
# Osaka Setup
##########################################################################################################
# Move Files To Location
echo "Copying Osaka Files Into Device Tree..."
echo ""
echo "1/1..."
echo ""
cp -r $A_TEAM_PACKAGE_LOCATION/device/motorola/osaka/rro_overlays device/motorola/osaka
sleep 5
# Patch device.mk
echo "Patching Osaka device.mk In Device Tree..."
echo ""
echo "1/2..."
echo ""
sed -i 's/PRODUCT_MODEL := moto g stylus 5g 2021/PRODUCT_MODEL := Moto G Stylus 5G 2021/g' device/motorola/osaka/device.mk
sleep 5
echo "2/2..."
echo ""
sed -i '/ ro.sf.lcd_density=420/ a\\ \n# Disable Adaptive Brightness\nPRODUCT_PACKAGES += osakaSettingsProviderOverlay' device/motorola/osaka/device.mk
sleep 5
# Backup & Copy osaka_defconfig File
echo "Backing Up Original osaka_defconfig In Device Tree..."
echo ""
echo "1/1..."
echo ""
mv kernel/motorola/msm-5.4/arch/arm64/configs/vendor/osaka_defconfig kernel/motorola/msm-5.4/arch/arm64/configs/vendor/osaka_defconfig.bak
sleep 5
echo "Copying Modified osaka_defconfig Into Device Tree..."
echo ""
echo "1/1..."
echo ""
cp -r $A_TEAM_PACKAGE_LOCATION/kernel/motorola/msm-5.4/arch/arm64/configs/vendor/osaka_defconfig kernel/motorola/msm-5.4/arch/arm64/configs/vendor
sleep 5
##########################################################################################################
echo ""
echo "A-Team Moto-Common Setup Complete, Please Enjoy!!"
echo ""
echo ""
echo "PRESS ENTER TO CONTINUE"
read
clear
rm -rf Moto-Common-Setup.sh
./Moto-Common-Build.sh