-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathcustomize.sh
More file actions
173 lines (143 loc) · 3.4 KB
/
customize.sh
File metadata and controls
173 lines (143 loc) · 3.4 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
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
# space
ui_print " "
# var
UID=`id -u`
[ ! "$UID" ] && UID=0
# log
if [ "$BOOTMODE" != true ]; then
FILE=/data/media/"$UID"/$MODID\_recovery.log
ui_print "- Log will be saved at $FILE"
exec 2>$FILE
ui_print " "
fi
# optionals
OPTIONALS=/data/media/"$UID"/optionals.prop
if [ ! -f $OPTIONALS ]; then
touch $OPTIONALS
fi
# debug
if [ "`grep_prop debug.log $OPTIONALS`" == 1 ]; then
ui_print "- The install log will contain detailed information"
set -x
ui_print " "
fi
# recovery
if [ "$BOOTMODE" != true ]; then
MODPATH_UPDATE=`echo $MODPATH | sed 's|modules/|modules_update/|g'`
rm -f $MODPATH/update
rm -rf $MODPATH_UPDATE
fi
# run
. $MODPATH/function.sh
# info
MODVER=`grep_prop version $MODPATH/module.prop`
MODVERCODE=`grep_prop versionCode $MODPATH/module.prop`
ui_print " ID=$MODID"
ui_print " Version=$MODVER"
ui_print " VersionCode=$MODVERCODE"
if [ "$KSU" == true ]; then
ui_print " KSUVersion=$KSU_VER"
ui_print " KSUVersionCode=$KSU_VER_CODE"
ui_print " KSUKernelVersionCode=$KSU_KERNEL_VER_CODE"
else
ui_print " MagiskVersion=$MAGISK_VER"
ui_print " MagiskVersionCode=$MAGISK_VER_CODE"
fi
ui_print " "
# sdk
NUM=23
if [ "$API" -lt $NUM ]; then
ui_print "! Unsupported SDK $API. You have to upgrade your"
ui_print " Android version at least SDK $NUM to use this module."
abort
else
ui_print "- SDK $API"
ui_print " "
fi
# recovery
mount_partitions_in_recovery
# magisk
magisk_setup
# path
SYSTEM=`realpath $MIRROR/system`
VENDOR=`realpath $MIRROR/vendor`
PRODUCT=`realpath $MIRROR/product`
SYSTEM_EXT=`realpath $MIRROR/system_ext`
ODM=`realpath $MIRROR/odm`
MY_PRODUCT=`realpath $MIRROR/my_product`
# cleaning
ui_print "- Cleaning..."
PKGS=`cat $MODPATH/package.txt`
if [ "$BOOTMODE" == true ]; then
for PKG in $PKGS; do
FILE=`find /data/app -name *$PKG*`
if [ "$FILE" ]; then
RES=`pm uninstall $PKG 2>/dev/null`
fi
done
fi
rm -rf $MODPATH/unused
remove_sepolicy_rule
ui_print " "
# function
cleanup() {
if [ -f $DIR/uninstall.sh ]; then
sh $DIR/uninstall.sh
fi
DIR=/data/adb/modules_update/$MODID
if [ -f $DIR/uninstall.sh ]; then
sh $DIR/uninstall.sh
fi
}
# cleanup
DIR=/data/adb/modules/$MODID
FILE=$DIR/module.prop
PREVMODNAME=`grep_prop name $FILE`
if [ "`grep_prop data.cleanup $OPTIONALS`" == 1 ]; then
sed -i 's|^data.cleanup=1|data.cleanup=0|g' $OPTIONALS
ui_print "- Cleaning-up $MODID data..."
cleanup
ui_print " "
elif [ -d $DIR ]\
&& [ "$PREVMODNAME" != "$MODNAME" ]; then
ui_print "- Different module name is detected"
ui_print " Cleaning-up $MODID data..."
cleanup
ui_print " "
fi
# function
file_check_system() {
for FILE in $FILES; do
DESS="$SYSTEM$FILE $SYSTEM_EXT$FILE"
for DES in $DESS; do
if [ -f $DES ]; then
ui_print "- Detected"
ui_print "$DES"
rm -f $MODPATH/system*$FILE
ui_print " "
fi
done
done
}
# check
FILES="/*/MotoSignatureApp/MotoSignatureApp.apk
/*/MotorolaSettingsProvider/MotorolaSettingsProvider.apk
/framework/com.motorola.frameworks.core.addon.jar
/framework/com.motorola.motosignature.jar
/framework/moto-checkin.jar
/framework/moto-settings.jar
/framework/moto.jar"
file_check_system
# function
hide_oat() {
for APP in $APPS; do
REPLACE="$REPLACE
`find $MODPATH/system -type d -name $APP | sed "s|$MODPATH||g"`/oat"
done
}
# hide
APPS="`ls $MODPATH/system/priv-app`
`ls $MODPATH/system/app`"
hide_oat
# unmount
unmount_mirror