-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathscript
45 lines (36 loc) · 1.29 KB
/
script
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
#!/system/bin/sh
# Terminal Magisk Mod Template
# by veez21 @ xda-developers
# Magisk Module ID **
ID="YOUR MODULE ID"
# Detect root
_name=$(basename $0)
ls /data >/dev/null 2>&1 || { echo "$ID needs to run as root!"; echo "type 'su' then '$_name'"; exit 1; }
# Magisk Mod Directory
[ -d "/sbin/.magisk" ] && MOUNTPATH="/sbin/.magisk/modules" || MOUNTPATH="$(find /dev -mindepth 2 -maxdepth 2 -type d -name ".magisk")/modules"
MODDIR="$MOUNTPATH/$ID"
[ ! -d $MODDIR ] && { echo "Module not detected!"; exit 1; }
# Set path to your busybox if applicable
_bb=
# Load mod-util.sh
. $MODDIR/mod-util.sh || exit $?
# Set Log Files
mount -o remount,rw /cache 2>/dev/null
mount -o rw,remount /cache 2>/dev/null
# > Logs should go in this file
LOG=/data/local/tmp/$ID.log
oldLOG=/data/local/tmp/$ID-old.log
# > Verbose output goes here
VERLOG=/data/local/tmp/$ID-verbose.log
oldVERLOG=/data/local/tmp/$ID-verbose-old.log
stdoutLOG=$MODDIR/logs/$ID-STDOUT.log
oldstdoutLOG=$MODDIR/logs/$ID-STDOUT-old.log
# Start Logging verbosely
mv -f $VERLOG $oldVERLOG 2>/dev/null; mv -f $LOG $oldLOG 2>/dev/null; mv -f $stdoutLOG $oldstdoutLOG 2>/dev/null
# exec 3>&1
# exec 1>$stdoutLOG
set -x 2>$VERLOG
# Main
# > You can start your MOD here.
# > You can add functions, variables & etc.
# > Rather than editing the default vars above.