-
Notifications
You must be signed in to change notification settings - Fork 2
/
install.sh
executable file
·100 lines (82 loc) · 3.07 KB
/
install.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
##########################################################################################
#
# Magisk Module Installer Script
#
##########################################################################################
##########################################################################################
#
# Instructions:
#
# 1. Place your files into system folder (delete the placeholder file)
# 2. Fill in your module's info into module.prop
# 3. Configure and implement callbacks in this file
# 4. If you need boot scripts, add them into common/post-fs-data.sh or common/service.sh
# 5. Add your additional or modified system properties into common/system.prop
#
##########################################################################################
##########################################################################################
# Config Flags
##########################################################################################
# Set to true if you do *NOT* want Magisk to mount
# any files for you. Most modules would NOT want
# to set this flag to true
SKIPMOUNT=false
# Set to true if you need to load system.prop
PROPFILE=true
# Set to true if you need post-fs-data script
POSTFSDATA=false
# Set to true if you need late_start service script
LATESTARTSERVICE=true
# Set what you want to display when installing your module
print_modname() {
ui_print " "
ui_print " ********************************************"
ui_print " * ida server *"
ui_print " ********************************************"
ui_print " "
}
# Copy/extract your module files into $MODPATH in on_install.
on_install() {
case $ARCH in
arm64) F_ARCH=$ARCH ;;
arm) F_ARCH=$ARCH ;;
x64) F_ARCH=x86_64 ;;
x86) F_ARCH=$ARCH ;;
*)
ui_print "Unsupported architecture: $ARCH"
abort
;;
esac
ui_print "- Detected architecture: $F_ARCH"
ui_print "- Extracting module files"
F_TARGETDIR="$MODPATH/system/bin"
MAGISK_BIN="/data/adb/magisk/busybox"
KERNELSU_BIN="/data/adb/ksu/bin/busybox"
APATCH_BIN="/data/adb/ap/bin/busybox"
if [ -f "$MAGISK_BIN" ]; then
echo "- ${MAGISK_BIN} found"
UNZIP="${MAGISK_BIN} unzip"
elif [ -f "$KERNELSU_BIN" ]; then
echo "- ${KERNELSU_BIN} found"
UNZIP="${KERNELSU_BIN} unzip"
elif [ -f "$APATCH_BIN" ]; then
echo "- ${APATCH_BIN} found"
UNZIP="${APATCH_BIN} unzip"
else
echo "- No busybox found,Use system unzip"
UNZIP="/system/bin/unzip"
fi
mkdir -p "$F_TARGETDIR"
$UNZIP -qq -o "$ZIPFILE" "files/android_server-$F_ARCH" -j -d "$F_TARGETDIR"
mv "$F_TARGETDIR/android_server-$F_ARCH" "$F_TARGETDIR/idserver"
}
# Only some special files require specific permissions
# This function will be called after on_install is done
# The default permissions should be good enough for most cases
set_permissions() {
# The following is the default rule, DO NOT remove
set_perm_recursive $MODPATH 0 0 0755 0644
# Custom permissions
set_perm $MODPATH/system/bin/idserver 0 2000 0755 u:object_r:system_file:s0
}
# You can add more functions to assist your custom script code