-
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathpost-fs-data.sh
More file actions
80 lines (63 loc) · 1.6 KB
/
post-fs-data.sh
File metadata and controls
80 lines (63 loc) · 1.6 KB
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
mount -o rw,remount /data
MODPATH=${0%/*}
# log
exec 2>$MODPATH/debug-pfsd.log
set -x
# var
API=`getprop ro.build.version.sdk`
ABI=`getprop ro.product.cpu.abi`
if [ ! -d $MODPATH/vendor ]\
|| [ -L $MODPATH/vendor ]; then
MODSYSTEM=/system
fi
# run
. $MODPATH/copy.sh
. $MODPATH/.aml.sh
# permission
if [ "$API" -ge 26 ]; then
DIRS=`find $MODPATH/vendor\
$MODPATH/system/vendor -type d`
for DIR in $DIRS; do
chown 0.2000 $DIR
done
chcon -R u:object_r:vendor_configs_file:s0 $MODPATH/system/odm/etc
chcon -R u:object_r:vendor_file:s0 $MODPATH$MODSYSTEM/vendor
chcon -R u:object_r:vendor_configs_file:s0 $MODPATH$MODSYSTEM/vendor/etc
chcon -R u:object_r:vendor_configs_file:s0 $MODPATH$MODSYSTEM/vendor/odm/etc
fi
# function
mount_odm() {
DIR=$MODPATH/system/odm
FILES=`find $DIR -type f -name $AUD`
for FILE in $FILES; do
DES=/odm`echo $FILE | sed "s|$DIR||g"`
if [ -f $DES ]; then
umount $DES
mount -o bind $FILE $DES
fi
done
}
mount_my_product() {
DIR=$MODPATH/system/my_product
FILES=`find $DIR -type f -name $AUD`
for FILE in $FILES; do
DES=/my_product`echo $FILE | sed "s|$DIR||g"`
if [ -f $DES ]; then
umount $DES
mount -o bind $FILE $DES
fi
done
}
# mount
if [ -d /odm ] && [ "`realpath /odm/etc`" == /odm/etc ]\
&& ! grep /odm /data/adb/magisk/magisk\
&& ! grep /odm /data/adb/magisk/magisk64\
&& ! grep /odm /data/adb/magisk/magisk32; then
mount_odm
fi
if [ -d /my_product ]\
&& ! grep /my_product /data/adb/magisk/magisk\
&& ! grep /my_product /data/adb/magisk/magisk64\
&& ! grep /my_product /data/adb/magisk/magisk32; then
mount_my_product
fi