-
Notifications
You must be signed in to change notification settings - Fork 125
/
customize.sh
75 lines (55 loc) · 2.01 KB
/
customize.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
#!/sbin/sh
SKIPUNZIP=1
ASH_STANDALONE=1
if [ "$BOOTMODE" ! = true ] ; then
abort "Error: Please install in Magisk Manager, KernelSU Manager or APatch"
fi
if [ "$KSU" = true ] && [ "$KSU_VER_CODE" -lt 10670 ] ; then
abort "Error: Please update your KernelSU"
fi
if [ "$KSU" = true ] && [ "$KSU_VER_CODE" -lt 10683 ] ; then
service_dir="/data/adb/ksu/service.d"
else
service_dir="/data/adb/service.d"
fi
if [ ! -d "$service_dir" ] ; then
mkdir -p $service_dir
fi
unzip -qo "${ZIPFILE}" -x 'META-INF/*' -d $MODPATH
if [ -d /data/adb/box ] ; then
cp /data/adb/box/scripts/box.config /data/adb/box/scripts/box.config.bak
ui_print "- User configuration box.config has been backed up to box.config.bak"
cat /data/adb/box/scripts/box.config >> $MODPATH/box/scripts/box.config
cp -f $MODPATH/box/scripts/* /data/adb/box/scripts/
ui_print "- User configuration box.config has been"
ui_print "- attached to the module box.config,"
ui_print "- please re-edit box.config"
ui_print "- after the update is complete."
awk '!x[$0]++' $MODPATH/box/scripts/box.config > /data/adb/box/scripts/box.config
rm -rf $MODPATH/box
else
mv $MODPATH/box /data/adb/
fi
if [ "$KSU" = true ] ; then
sed -i 's/name=box4magisk/name=box4KernelSU/g' $MODPATH/module.prop
fi
if [ "$APATCH" = true ] ; then
sed -i 's/name=box4magisk/name=box4APatch/g' $MODPATH/module.prop
fi
mkdir -p /data/adb/box/bin/
mkdir -p /data/adb/box/run/
mv -f $MODPATH/box4_service.sh $service_dir/
rm -f customize.sh
set_perm_recursive $MODPATH 0 0 0755 0644
set_perm_recursive /data/adb/box/ 0 0 0755 0644
set_perm_recursive /data/adb/box/scripts/ 0 0 0755 0700
set_perm_recursive /data/adb/box/bin/ 0 0 0755 0700
set_perm $service_dir/box4_service.sh 0 0 0700
# fix "set_perm_recursive /data/adb/box/scripts" not working on some phones.
chmod ugo+x /data/adb/box/scripts/*
for pid in $(pidof inotifyd) ; do
if grep -q box.inotify /proc/${pid}/cmdline ; then
kill ${pid}
fi
done
inotifyd "/data/adb/box/scripts/box.inotify" "$MODPATH" > /dev/null 2>&1 &