Skip to content

Commit 6e4bed9

Browse files
committed
scripts/servcie: save rehook mode
1 parent 0d3e7c2 commit 6e4bed9

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

module/service.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ MODDIR=${0%/*}
44
KPNDIR="/data/adb/kp-next"
55
PATH="$MODDIR/bin:$PATH"
66
CONFIG="$KPNDIR/package_config"
7+
REHOOK="$(cat $KPNDIR/rehook)"
78
key="$(cat $KPNDIR/key | base64 -d)"
89

910
if [ -z "$key" ] || [ -z "$(kpatch $key hello)" ]; then
@@ -16,6 +17,8 @@ for kpm in $KPNDIR/kpm/*.kpm; do
1617
kpatch "$key" kpm load "$kpm" || rm -f "$kpm"
1718
done
1819

20+
[ -n "$REHOOK" ] && [ "$REHOOK" -ge 0 ] && [ "$REHOOK" -le 2 ] && kpatch "$key" rehook $REHOOK
21+
1922
until [ "$(getprop sys.boot_completed)" = "1" ]; do
2023
sleep 1
2124
done

webui/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,10 @@ async function updateRehookStatus() {
131131
}
132132

133133
function setRehookMode(mode) {
134-
exec(`kpatch ${escapeShell(superkey)} rehook ${mode}`, { env: { PATH: `${modDir}/bin` } }).then((result) => {
134+
exec(`
135+
kpatch ${escapeShell(superkey)} rehook ${mode} && echo ${mode} > ${persistDir}/rehook`,
136+
{ env: { PATH: `${modDir}/bin:$PATH` } }
137+
).then((result) => {
135138
if (result.errno !== 0) {
136139
toast(getString('msg_error', result.stderr));
137140
return;

0 commit comments

Comments
 (0)