-
Notifications
You must be signed in to change notification settings - Fork 5
/
mHideGP.sh
executable file
·636 lines (534 loc) · 20.5 KB
/
mHideGP.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
#!/bin/bash
# Pull prop settings from device/image files
# ipdev @ xda-developers
# Originally (and still) written to grab needed/useful props for use with MagiskHidePropsConfig module
# by Didgeridoohan @ xda-developers
# https://forum.xda-developers.com/apps/magisk/module-magiskhide-props-config-t3789228
# To pull props from a boot or recovery image file requires unpacking the image.
# This script relies on Android Image Kitchen (AIK)
# by osm0sis @ xda-developers
# https://forum.xda-developers.com/showthread.php?t=2073775
# To use a boot or recovery image file. (Android, Linux and MacOS)
# Install AIK
# Copy the boot or recovery image files into the AIK directory
# Copy mHideGP.sh into the AIK directory
# Unpack a boot/recovery image
# Run mHideGP.sh
# Run the cleanup script
#
# If used with another method, make sure to make changes in the script accordingly.
# To use on a stock device. (Android)
# Note: This will generate a getprops.prop file along with the mhp file.
# Copy this script to the device.
# Run from adb shell (or a terminal app) using the sh command.
# sh mHideGP.sh
# Run from a file manager that is able to execute a script file.
# Note: May or may not work depending on file manager..
# To use with a prop file. (Android, Linux and MacOS)
# Copy this script and a build.prop, default.prop, prop.default or getprop.props
# file into the same directory.
# Run mHideGP.sh
#
# Set main variables
DATE=$(date '+%Y%m%d')
# DATE=$(date '+%Y%m%d_%H%M')
TDIR=$(pwd)
SCRIPT=mHideGP.sh
# Set main functions
set_target_directory() {
if [ ! -f "$SCRIPT" ]; then
TDIR=$(lsof 2>/dev/null | grep -o '[^ ]*$' | grep -m1 "$SCRIPT" | sed 's/\/'"$SCRIPT"'//g');
cd $TDIR;
fi
}
exit_0() {
if [[ ! -z $ANDROID ]]; then
return 0; exit 0;
else
exit 0;
fi
}
# exit_1() {
# if [[ ! -z $ANDROID ]]; then
# return 1; exit 1;
# else
# exit 1;
# fi
# }
# Set additional functions
check_for_sdk() {
if [ "$SDK" = "" ]; then
echo " "
echo " No SDK level found. "
echo " You may need to use a recovery.img instead. " >&2
echo " "
fi
}
backup() {
if [ -f "$MHGP" ]; then
FLTM=$(date -r "$MHGP" '+%H%M')
BACKUPFILE=$(printf "$MHGP" | sed 's/.sh/.'"$FLTM"'/g')
mv "$MHGP" "$BACKUPFILE"
fi
}
set_prop_file() {
prop_file=ABORT
if [ -f ramdisk/prop.default ]; then
prop_file=ramdisk/prop.default
elif [ -f ramdisk/default.prop ]; then
prop_file=ramdisk/default.prop
elif [ -f build.prop ]; then
prop_file=build.prop
elif [ -f prop.default ]; then
prop_file=prop.default
elif [ -f default.prop ]; then
prop_file=default.prop
elif [ -f getprop.props ]; then
prop_file=getprop.props
elif [ "$ANDROID" = "TRUE" ]; then
getprop | sed 's/\]: \[/=/g; s/\[//g; s/\]//g' > getprop.props
if [ -f getprop.props ]; then
prop_file=getprop.props
fi;
fi;
}
check_prop_file() {
if [ "$prop_file" = "ABORT" ]; then
echo " "
echo " No prop file found. " >&2
echo " Aborting ... "
echo " "
exit 1;
fi
}
ignore_prop_file() {
if [ ! "$BRAND" ]; then
echo " "
echo " Device Brand was not found. " >&2
echo " This prop file is ignored. " >&2
echo " Aborting ... "
echo " "
exit 1;
fi;
if [ ! "$MODL" ]; then
echo " "
echo " Device Model was not found. " >&2
echo " This prop file is ignored. " >&2
echo " Aborting ... "
echo " "
exit 1;
fi;
}
rename_prop_files() {
if [ -f build.prop ]; then
# echo ""
mv build.prop "$APFN"-build.prop
echo " build.prop file has been renamed to "$APFN"-build.prop"
echo " Keep it or delete it as you wish.."
fi
if [ -f prop.default ]; then
# echo ""
mv prop.default "$APFN"-prop.default
echo " prop.default file has been renamed as "$APFN"-prop.default"
echo " Keep it or delete it as you wish.."
fi
if [ -f default.prop ]; then
# echo ""
mv default.prop "$APFN"-default.prop
echo " default.prop file has been renamed as "$APFN"-default.prop"
echo " Keep it or delete it as you wish.."
fi
if [ -f getprop.props ]; then
# echo ""
mv getprop.props "$APFN"-getprop.props
echo " getprop.props file has been renamed as "$APFN"-getprop.props"
echo " Keep it or delete it as you wish.."
fi
}
get_prop_info() {
grep ro.oxygen.version $prop_file
# grep ro.build.date $prop_file
grep ro.bootimage.build.fingerprint $prop_file
grep ro.build.description $prop_file
grep ro.build.fingerprint $prop_file
grep ro.build.version.oplusrom $prop_file
grep ro.build.version.release $prop_file
grep ro.build.version.sdk $prop_file
grep ro.display.series $prop_file
grep ro.product.device $prop_file
grep ro.product.brand $prop_file
grep ro.product.manufacturer $prop_file
grep ro.product.model $prop_file
grep ro.product.name $prop_file
grep ro.system.build.fingerprint $prop_file
grep ro.product.system $prop_file
grep ro.build.product $prop_file
# grep ro.build.version.incremental $prop_file
grep ro.vendor.build.fingerprint $prop_file
grep ro.vendor.build.security_patch $prop_file
# grep ro.vendor.build $prop_file
grep ro.product.vendor $prop_file
grep ro.odm.build.fingerprint $prop_file
grep ro.product.odm $prop_file
grep ro.product.build.fingerprint $prop_file
grep ro.product.product $prop_file
grep ro.boot.hardware.sku $prop_file
}
get_prop_secure() {
grep ro.oem_unlock_supported $prop_file
grep ro.adb.secure $prop_file
grep ro.debuggable $prop_file
grep ro.secure $prop_file
grep ro.build.tags $prop_file
grep ro.build.type $prop_file
grep ro.system.build.tags $prop_file
grep ro.system.build.type $prop_file
grep ro.vendor.build.tags $prop_file
grep ro.vendor.build.type $prop_file
grep ro.odm.build.tags $prop_file
grep ro.odm.build.type $prop_file
grep ro.product.build.tags $prop_file
grep ro.product.build.type $prop_file
}
# get_prop_device() {
# # grep PROP $prop_file
# }
add_notes() {
echo "\"" >> $MHGP
echo "######" >> $MHGP
echo "## The above \" was added to close custom printslist list early." >> $MHGP
echo "## Just to clean it up a little. Lines below will not display on screen." >> $MHGP
echo "## Due to updates in Magisk and/or mHide module." >> $MHGP
echo "## The rest of the file is now block commented to hide/clean it up further." >> $MHGP
echo "######" >> $MHGP
echo "#" >> $MHGP
echo "#" >> $MHGP
}
add_device_title() {
if [ "$BRAND" = "Google" ] || [ "$BRAND" = "google" ]; then
echo "# "$MODL" [Build Date - "$BDATE"]" >> $MHGP
elif [ "$BRAND" = "OnePlus" ] || [ "$BRAND" = "oneplus" ]; then
if grep -q ro.display.series $prop_file; then
echo "# "$OPDSPLY" ["$OPMDL"] [Build Date - "$BDATE"]" >> $MHGP
else
echo "# "$DEVICE" ["$OPMDL"] [Build Date - "$BDATE"]" >> $MHGP
fi;
elif [ "$DMDL" = "Redmi" ] || [ "$DMDL" = "redmi" ]; then
echo "# "$MODL" [Build Date - "$BDATE"]" >> $MHGP
elif [ "$BRAND" = "SAMSUNG" ] || [ "$BRAND" = "samsung" ]; then
echo "# Samsung "$MODL" [Build Date - "$BDATE"]" >> $MHGP
else
echo "# "$BRAND" "$MODL" [Build Date - "$BDATE"]" >> $MHGP
fi;
}
# Determine if running on an Android device.
[ -f /system/bin/sh ] || [ -f /system/bin/toybox ] || [ -f /system/bin/toolbox ] && ANDROID=TRUE;
# Reset and move to the target directory if needed.
set_target_directory
# Set prop file to use.
set_prop_file
# Make sure prop file set.
check_prop_file
# Set variables
SDATE=$(grep -m1 ro.build.version.security_patch= $prop_file | cut -f2 -d '=');
# aOS=$(grep -m1 ro.build.version.release= $prop_file | cut -f2 -d '=');
SDK=$(grep -m1 ro.build.version.sdk= $prop_file | cut -f2 -d '=');
BUTC=$(grep -m1 ro.build.date.utc= $prop_file | cut -f2 -d '=');
# Add sed to remove double space in some build dates.
BDATE=$(grep -m1 ro.build.date= $prop_file | sed 's/ / /g' | cut -f2,3,6 -d ' ');
# Work around SDK31 and SDK32 sharing the 12 release tag.
if [ "$SDK" = "32" ]; then
aOS=12L;
else
aOS=$(grep -m1 ro.build.version.release= $prop_file | cut -f2 -d '=');
fi
# Set variable names to variables. (Depends on the device and/or API/SDK/NDK version.)
# if grep -q ro.product.name= $prop_file; then
# NAME=$(grep -m1 ro.product.name= $prop_file | cut -f2 -d '=');
# else
# NAME=$(grep -m1 ro.product.vendor.name= $prop_file | cut -f2 -d '=');
# fi
if grep -q ro.build.fingerprint= $prop_file; then
BPRINT=$(grep -m1 ro.build.fingerprint= $prop_file | cut -f2 -d '=');
elif grep -q ro.bootimage.build.fingerprint= $prop_file; then
BPRINT=$(grep -m1 ro.bootimage.build.fingerprint= $prop_file | cut -f2 -d '=');
else
BPRINT=$(grep -m1 ro.system.build.fingerprint= $prop_file | cut -f2 -d '=');
fi
if grep -q ro.product.model= $prop_file; then
MODL=$(grep -m1 ro.product.model= $prop_file | cut -f2 -d '=');
elif grep -q ro.product.vendor.model= $prop_file; then
MODL=$(grep -m1 ro.product.vendor.model= $prop_file | cut -f2 -d '=');
else
MODL=$(grep -m1 ro.product.system.model= $prop_file | cut -f2 -d '=');
fi
if grep -q ro.product.manufacturer= $prop_file; then
MANF=$(grep -m1 ro.product.manufacturer= $prop_file | cut -f2 -d '=');
elif grep -q ro.product.vendor.manufacturer= $prop_file; then
MANF=$(grep -m1 ro.product.vendor.manufacturer= $prop_file | cut -f2 -d '=');
else
MANF=$(grep -m1 ro.product.system.manufacturer= $prop_file | cut -f2 -d '=');
fi
if grep -q ro.product.brand= $prop_file; then
BRAND=$(grep -m1 ro.product.brand= $prop_file | cut -f2 -d '=');
elif grep -q ro.product.system.brand= $prop_file; then
BRAND=$(grep -m1 ro.product.system.brand= $prop_file | cut -f2 -d '=');
else
BRAND=$(grep -m1 ro.product.vendor.brand= $prop_file | cut -f2 -d '=');
fi
if grep -q ro.product.device= $prop_file; then
DEVICE=$(grep -m1 ro.product.device= $prop_file | cut -f2 -d '=');
elif grep -q ro.product.product.device= $prop_file; then
DEVICE=$(grep -m1 ro.product.product.device= $prop_file | cut -f2 -d '=');
elif grep -q ro.product.system.device= $prop_file; then
DEVICE=$(grep -m1 ro.product.system.device= $prop_file | cut -f2 -d '=');
elif grep -q ro.product.vendor.device= $prop_file; then
DEVICE=$(grep -m1 ro.product.vendor.device= $prop_file | cut -f2 -d '=');
else
DEVICE=$(grep -m1 ro.build.product= $prop_file | cut -f2 -d '=');
fi
if grep -q ro.display.series= $prop_file; then
DSPLY=$(grep -m1 ro.display.series= $prop_file | cut -f2 -d '=');
fi
# Set DMDL (Device Model) currently only used for Poco and Redmi.
if grep -q ro.product.model= $prop_file; then
DMDL=$(grep -m1 ro.product.model= $prop_file | cut -f2 -d '=' | cut -f1 -d' ');
elif grep -q ro.product.vendor.model= $prop_file; then
DMDL=$(grep -m1 ro.product.vendor.model= $prop_file | cut -f2 -d '=' | cut -f1 -d' ');
else
DMDL=$(grep -m1 ro.product.system.model= $prop_file | cut -f2 -d '=' | cut -f1 -d' ');
fi
# Check and ignore if certain values can not be determined.
## Still need to work on this.
## Maybe set main MHGP values (and/or MHGP file name values) to unknown when not found so an alternative MHGP file can still be generated?
ignore_prop_file
# Brand/Device specific
if [ $BRAND = "OnePlus" ] || [ $BRAND = "oneplus" ]; then
if grep -q ro.display.series= $prop_file; then
OPDSPLY=$(grep -m1 ro.display.series= $prop_file | cut -f2 -d '=');
fi;
if grep -q ro.product.model= $prop_file; then
OPMDL=$(grep -m1 ro.product.model= $prop_file | cut -f2 -d '=' | cut -f2 -d " ");
elif grep -q ro.product.system.model= $prop_file; then
OPMDL=$(grep -m1 ro.product.system.model= $prop_file | cut -f2 -d '=' | cut -f2 -d " ");
else
OPMDL=$(grep -m1 ro.product.vendor.model= $prop_file | cut -f2 -d '=' | cut -f2 -d " ");
fi;
fi;
# Set variables for use in naming the $MHGP file.
# Remove spaces and change all to lowercase so the mhp_ file(s) should list in the correct order
# when using the concat script.
if grep -q ro.product.device= $prop_file; then
LDEVICE=$(grep -m1 ro.product.device= $prop_file | cut -f2 -d '=' | tr [:upper:] [:lower:]);
elif grep -q ro.product.system.device= $prop_file; then
LDEVICE=$(grep -m1 ro.product.system.device= $prop_file | cut -f2 -d '=' | tr [:upper:] [:lower:]);
elif grep -q ro.product.vendor.device= $prop_file; then
LDEVICE=$(grep -m1 ro.product.vendor.device= $prop_file | cut -f2 -d '=' | tr [:upper:] [:lower:]);
else
LDEVICE=$(grep -m1 ro.build.product= $prop_file | cut -f2 -d '=' | tr [:upper:] [:lower:]);
fi
# if grep -q ro.product.name $prop_file; then
# LNAM=$(grep -m1 ro.product.name= $prop_file | cut -f2 -d '=' | tr [:upper:] [:lower:]);
# else
# LNAM=$(grep -m1 ro.product.vendor.name= $prop_file | cut -f2 -d '=' | tr [:upper:] [:lower:]);
# fi
if grep -q ro.product.model= $prop_file; then
LMODL=$(grep -m1 ro.product.model= $prop_file | cut -f2 -d '=' | sed 's/ /_/g' | tr [:upper:] [:lower:]);
elif grep -q ro.product.vendor.model= $prop_file; then
LMODL=$(grep -m1 ro.product.vendor.model= $prop_file | cut -f2 -d '=' | sed 's/ /_/g' | tr [:upper:] [:lower:]);
else
LMODL=$(grep -m1 ro.product.system.model= $prop_file | cut -f2 -d '=' | sed 's/ /_/g' | tr [:upper:] [:lower:]);
fi
if grep -q ro.product.brand= $prop_file; then
LBRND=$(grep -m1 ro.product.brand= $prop_file | cut -f2 -d '=' | tr [:upper:] [:lower:]);
elif grep -q ro.product.system.brand= $prop_file; then
LBRND=$(grep -m1 ro.product.system.brand= $prop_file | cut -f2 -d '=' | tr [:upper:] [:lower:]);
else
LBRND=$(grep -m1 ro.product.vendor.brand= $prop_file | cut -f2 -d '=' | tr [:upper:] [:lower:]);
fi
if grep -q ro.display.series= $prop_file; then
LDSPLY=$(grep -m1 ro.display.series= $prop_file | cut -f2 -d '=' | sed 's/ /_/g' | tr [:upper:] [:lower:]);
fi
if grep -q ro.product.manufacture= $prop_file; then
LMAN=$(grep -m1 ro.product.manufacture= $prop_file | cut -f2 -d '=' | tr [:upper:] [:lower:]);
elif grep -q ro.product.vendor.manufacturer= $prop_file; then
LMAN=$(grep -m1 ro.product.vendor.manufacturer= $prop_file | cut -f2 -d '=' | tr [:upper:] [:lower:]);
else
LMAN=$(grep -m1 ro.product.system.manufacturer= $prop_file | cut -f2 -d '=' | tr [:upper:] [:lower:]);
fi
# Set MHGP file name.
# Generic
MHGP="$TDIR"/mhp_"$LBRND"_"$LMODL"_"$BUTC".sh
# Google
if [ "$BRAND" = "Google" ] || [ "$BRAND" = "google" ]; then
MHGP="$TDIR"/mhp_"$LMODL"_"$BUTC".sh
fi;
# OnePlus
if [ "$BRAND" = "OnePlus" ] || [ "$BRAND" = "oneplus" ]; then
MHGP="$TDIR"/mhp_"$LDEVICE"_"$BUTC".sh
fi;
# Poco
if [ "$DMDL" = "POCO" ] || [ "$DMDL" = "poco" ]; then
MHGP="$TDIR"/mhp_"$LMODL"_"$BUTC".sh
fi;
# Redmi
if [ "$DMDL" = "Redmi" ] || [ "$DMDL" = "redmi" ]; then
MHGP="$TDIR"/mhp_"$LMODL"_"$BUTC".sh
fi;
# Set name to use for additional prop files in the current directory.
# Generic
APFN="$LBRND"_"$LMODL"_"$BUTC"
# Google
if [ "$BRAND" = "Google" ] || [ "$BRAND" = "google" ]; then
APFN="$LMODL"_"$BUTC"
fi;
# OnePlus
if [ "$BRAND" = "OnePlus" ] || [ "$BRAND" = "oneplus" ]; then
APFN="$LDEVICE"_"$BUTC"
fi;
# Poco
if [ "$DMDL" = "POCO" ] || [ "$DMDL" = "poco" ]; then
APFN="$LMODL"_"$BUTC"
fi;
# Redmi
if [ "$DMDL" = "Redmi" ] || [ "$DMDL" = "redmi" ]; then
APFN="$LMODL"_"$BUTC"
fi;
# Set MagiskHide Props Config fingerprint.
# Generic
MPRINT="$BRAND"" ""$MODL"" "\("$aOS"\):"$MANF":"$MODL"="$BPRINT"__"$SDATE"
# Essential
if [ "$BRAND" = "Essential" ] || [ "$BRAND" = "essential" ]; then
MPRINT=Essential" ""$MODL"" "\("$aOS"\):"$MANF":"$MODL"="$BPRINT"__"$SDATE"
fi;
# Google
if [ "$BRAND" = "Google" ] || [ "$BRAND" = "google" ]; then
MPRINT="$MODL"" "\("$aOS"\):"$MANF":"$MODL"="$BPRINT"__"$SDATE"
fi;
# OnePlus
if [ "$BRAND" = "OnePlus" ] || [ "$BRAND" = "oneplus" ]; then
if grep -q ro.display.series $prop_file; then
MPRINT="$DSPLY"" "\["$OPMDL"\]" "\("$aOS"\):"$MANF":"$MODL"="$BPRINT"__"$SDATE"
else
MPRINT="$DEVICE"" "\["$OPMDL"\]" "\("$aOS"\):"$MANF":"$MODL"="$BPRINT"__"$SDATE"
fi;
fi;
# LG
if [ "$BRAND" = "lge" ] || [ "$BRAND" = "LGE" ]; then
MPRINT=LG" "\["$MODL"\]" "\("$aOS"\):"$MANF":"$MODL"="$BPRINT"__"$SDATE"
fi;
# Poco
if [ "$DMDL" = "POCO" ] || [ "$DMDL" = "poco" ]; then
MPRINT="$MODL"" "\("$aOS"\):"$MANF":"$MODL"="$BPRINT"__"$SDATE"
fi;
# Redmi
if [ "$DMDL" = "Redmi" ] || [ "$DMDL" = "redmi" ]; then
MPRINT="$MODL"" "\("$aOS"\):"$MANF":"$MODL"="$BPRINT"__"$SDATE"
fi;
# Samsung
if [ "$BRAND" = "SAMSUNG" ] || [ "$BRAND" = "samsung" ]; then
MPRINT=Samsung" "\["$MODL"\]" "\("$aOS"\):"$MANF":"$MODL"="$BPRINT"__"$SDATE"
fi;
# Experimental -- Not sure if I will keep this or integrate it better
# Set MagiskHide Props Config fingerprint from certified.list
if [ -f certified.list ]; then
if grep -q "$DEVICE" certified.list; then
CERTBRAND=$(grep "$MODL" certified.list | grep "$DEVICE" | tr -d '\n' | cut -f1);
CERTNAME=$(grep "$MODL" certified.list | grep "$DEVICE" | tr -d '\n' | cut -f2);
CERTMRKNAME=$(grep "$MODL" certified.list | grep "$DEVICE" | tr -d '\n' | cut -f2 | cut -f1 -d' ');
fi;
if [ $BRAND = "Xiaomi" ] || [ $BRAND = "xiaomi" ]; then
CERTBRAND=$(grep "$MODL" certified.list | grep "$DEVICE" | grep Xiaomi | tr -d '\n' | cut -f1);
CERTNAME=$(grep "$MODL" certified.list | grep "$DEVICE" | grep Xiaomi | tr -d '\n' | cut -f2);
CERTMRKNAME=$(grep "$MODL" certified.list | grep "$DEVICE" | grep Xiaomi | tr -d '\n' | cut -f2 | cut -f1 -d' ');
if [ "$CERTBRAND" = "" ]; then
CERTBRAND=$(grep "$MODL" certified.list | grep "$DEVICE" | tr -d '\n' | cut -f1);
CERTNAME=$(grep "$MODL" certified.list | grep "$DEVICE" | tr -d '\n' | cut -f2);
CERTMRKNAME=$(grep "$MODL" certified.list | grep "$DEVICE" | tr -d '\n' | cut -f2 | cut -f1 -d' ');
fi;
fi;
if [ "$CERTBRAND" = "Google" ] || [ "$CERTBRAND" = "POCO" ] || [ "$CERTBRAND" = "Redmi" ]; then
MPRINT="$CERTNAME"" "\("$aOS"\):"$MANF":"$MODL"="$BPRINT"__"$SDATE"
elif [ "$CERTMRKNAME" = "Nexus" ] || [ "$CERTMRKNAME" = "POCO" ] || [ "$CERTMRKNAME" = "Redmi" ]; then
MPRINT="$CERTNAME"" "\("$aOS"\):"$MANF":"$MODL"="$BPRINT"__"$SDATE"
elif [ "$CERTBRAND" = "LGE" ] || [ "$CERTBRAND" = "LGU+" ]; then
MPRINT=LG" ""$CERTNAME"" "\["$MODL"\]" "\("$aOS"\):"$MANF":"$MODL"="$BPRINT"__"$SDATE"
elif [ "$CERTBRAND" = "OnePlus" ]; then
MPRINT="$CERTNAME"" "\["$OPMDL"\]" "\("$aOS"\):"$MANF":"$MODL"="$BPRINT"__"$SDATE"
elif [ "$CERTBRAND" = "Samsung" ]; then
MPRINT="$CERTBRAND"" ""$CERTNAME"" "\["$MODL"\]" "\("$aOS"\):"$MANF":"$MODL"="$BPRINT"__"$SDATE"
else
MPRINT="$CERTBRAND"" ""$CERTNAME"" "\("$aOS"\):"$MANF":"$MODL"="$BPRINT"__"$SDATE"
fi;
fi;
# Check for SDK version.
check_for_sdk
## Still need to improve note about using recovery.img instead of boot.img on older devices
## and/or newer devices that do not contain a ramdisk in the boot image.
## Newer devices that include a vendor_boot.img, recovery is in the vendor_boot image.
###### Finally here we go...
# Backup if needed.
backup
# Add mHide fingerprint to $MHGP file.
# echo $MPRINT | tee -a $MHGP
echo $MPRINT | sed 's/__$//g' | tee -a $MHGP
# Add a few notes to $MHGP file.
add_notes
# Extra echo just to clean up screen output.
echo ""
# Add a title line to the props file.
add_device_title
# Experimental -- Not sure if I will keep this or integrate it better
# Needs more cleanup due to shared variations in the certified list
# Retail Branding Marketing Name Device Model
# Add tag from certified list
if [ -f certified.list ]; then
if grep -q "$DEVICE" certified.list; then
echo "#" | tee -a $MHGP
echo "# Device is on certified list" | tee -a $MHGP
grep "$MODL" certified.list | grep "$DEVICE" | tr '\t' '>' | sed 's/>/ /g; s/^/# /g' | tee -a $MHGP
echo "#" | tee -a $MHGP
fi;
fi;
# grep fingerprint and security date | sed command to add beginning comment [# ] | tee -a to add it to $MHGP
if grep -q ro.build.fingerprint $prop_file; then
grep ro.build.fingerprint $prop_file | sed 's/^/# /g' | tee -a $MHGP
elif grep -q ro.bootimage.build.fingerprint $prop_file; then
grep ro.bootimage.build.fingerprint $prop_file | sed 's/^/# /g' | tee -a $MHGP
else
grep ro.system.build.fingerprint $prop_file | sed 's/^/# /g' | tee -a $MHGP
fi;
grep ro.build.version.security_patch $prop_file | sed 's/^/# /g' | tee -a $MHGP
echo "#" | tee -a $MHGP
#
echo ""
# Add beginning comment [# ] and remove the obsolete note line(s) in the $MHGP file
get_prop_info | sed 's/^/# /g' | sed '/obsolete/d' | tee -a $MHGP
echo "#" | tee -a $MHGP
# get_prop_secure | sed 's/^/# /g' | tee -a $MHGP
# echo "#" | tee -a $MHGP
# Add note about prop file used to $MHGP
echo "# # Pulled from "$prop_file"" >> $MHGP
# echo "#" >> $MHGP
# Cleanup
# Rename additional prop files if needed.
if [ -f build.prop ] || [ -f default.prop ] || [ -f prop.default ] || [ -f getprop.props ]; then
echo ""; echo " If an additional prop file is found or used, it will be renamed.";
rename_prop_files
fi
# Note backup
if [ -f "$BACKUPFILE" ]; then
echo ""; echo " Your previous "$MHGP" file was renamed to "$BACKUPFILE""; # echo "";
fi
# Correct permissions if needed
if [[ -z $ANDROID ]]; then
chmod 0664 "$MHGP"
if [ -f "$BACKUPFILE" ]; then
chmod 0664 "$BACKUPFILE"
fi;
fi;
# Finish script
echo ""; echo " Done."; echo "";
echo " New mHideGP prop file saved as "$MHGP""; echo "";
#
exit_0;