Skip to content

Commit b49c7e3

Browse files
committed
fix: optimize hot install from webui
1 parent e645b54 commit b49c7e3

3 files changed

Lines changed: 11 additions & 4 deletions

File tree

module/post-fs-data.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ fi
2323
[ "$KSU" = "true" ] && MANAGER="KSU"
2424
[ ! "$APATCH" = "true" ] && [ ! "$KSU" = "true" ] && MANAGER="MAGISK"
2525
echo "MANAGER=$MANAGER" > "$MODPATH/common/manager.sh"
26-
chmod 755 "$MODPATH/common/manager.sh"
26+
chmod 755 "$MODPATH/common/manager.sh" || true

module/service.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,4 @@ mkdir -p "$MODPATH/common/tmp"
7474

7575
sh "$MODPATH/common/get_extra.sh" --xposed >/dev/null 2>&1
7676

77-
[ -f "$MODPATH/action.sh" ] && rm -rf "/data/adb/modules/TA_utl"
77+
[ ! -f "$MODPATH/action.sh" ] || rm -rf "/data/adb/modules/TA_utl"

webui/scripts/about.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { linkRedirect, basePath, showPrompt } from './main.js';
22
import { getString } from './language.js';
3-
import { spawn } from 'kernelsu-alt';
3+
import { spawn, exec } from 'kernelsu-alt';
44

55
const aboutDialog = document.getElementById('about-dialog');
66
const closeAbout = document.getElementById('close-about');
@@ -135,17 +135,24 @@ function downloadUpdate(link) {
135135
*/
136136
function installUpdate() {
137137
showPrompt(getString("prompt_installing"));
138+
let stdout = "";
138139
const output = spawn('sh', [`${basePath}/common/get_extra.sh`, '--install-update'],
139140
{ env: { PATH: "$PATH:/data/adb/ap/bin:/data/adb/ksu/bin:/data/adb/magisk" } });
141+
output.stdout.on('data', (data) => stdout += data);
140142
output.stderr.on('data', (data) => {
141143
console.error('Error during installation:', data);
142144
});
143145
output.on('exit', (code) => {
146+
if (stdout.includes('No need to reboot')) {
147+
exec(`rm -f ${basePath}/module.prop`).then(() => {
148+
window.location.reload();
149+
});
150+
}
144151
if (code === 0) {
145152
showPrompt(getString("prompt_installed"));
146153
} else {
147154
showPrompt(getString("prompt_install_fail"), false);
148155
}
149156
isDownloading = false;
150157
});
151-
}
158+
}

0 commit comments

Comments
 (0)