Skip to content

Commit 0e8f198

Browse files
committed
scripts: fix exit number
1 parent 5128610 commit 0e8f198

3 files changed

Lines changed: 19 additions & 18 deletions

File tree

module/boot_patch.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ echo "- Unpacking boot image"
4747
magiskboot unpack "$BOOTIMAGE" >/dev/null 2>&1
4848
if [ $? -ne 0 ]; then
4949
>&2 echo "- Unpack error: $?"
50-
exit $?
50+
exit 1
5151
fi
5252
fi
5353

5454
if [ ! $(kptools -i kernel -f | grep CONFIG_KALLSYMS=y) ]; then
5555
echo "- Patcher has Aborted!"
5656
echo "- APatch requires CONFIG_KALLSYMS to be Enabled."
5757
echo "- But your kernel seems NOT enabled it."
58-
exit 0
58+
exit 1
5959
fi
6060

6161
if [ $(kptools -i kernel -l | grep patched=false) ]; then
@@ -74,7 +74,7 @@ set +x
7474

7575
if [ $patch_rc -ne 0 ]; then
7676
>&2 echo "- Patch kernel error: $patch_rc"
77-
exit $?
77+
exit 1
7878
fi
7979

8080
echo "- Repacking boot image"
@@ -88,7 +88,7 @@ fi
8888

8989
if [ $? -ne 0 ]; then
9090
>&2 echo "- Repack error: $?"
91-
exit $?
91+
exit 1
9292
fi
9393

9494
if [ "$FLASH_TO_DEVICE" = "true" ]; then
@@ -98,7 +98,7 @@ if [ "$FLASH_TO_DEVICE" = "true" ]; then
9898
flash_image new-boot.img "$BOOTIMAGE"
9999
if [ $? -ne 0 ]; then
100100
>&2 echo "- Flash error: $?"
101-
exit $?
101+
exit 1
102102
fi
103103
fi
104104

module/boot_unpatch.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ echo "- Unpacking boot image"
2929
magiskboot unpack "$BOOTIMAGE" >/dev/null 2>&1
3030
if [ $? -ne 0 ]; then
3131
>&2 echo "- Unpack error: $?"
32-
exit $?
32+
exit 1
3333
fi
3434
fi
3535

@@ -43,13 +43,13 @@ if [ ! $(kptools -i kernel -l | grep patched=false) ]; then
4343
kptools -u --image kernel.ori --out kernel
4444
if [ $? -ne 0 ]; then
4545
>&2 echo "- Unpatch error: $?"
46-
exit $?
46+
exit 1
4747
fi
4848
echo "- Repacking boot image"
4949
magiskboot repack "$BOOTIMAGE" >/dev/null 2>&1
5050
if [ $? -ne 0 ]; then
5151
>&2 echo "- Repack error: $?"
52-
exit $?
52+
exit 1
5353
fi
5454
fi
5555

@@ -64,7 +64,7 @@ if [ -f "new-boot.img" ]; then
6464

6565
if [ $? -ne 0 ]; then
6666
>&2 echo "- Flash error: $?"
67-
exit $?
67+
exit 1
6868
fi
6969
fi
7070

webui/page/patch.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,11 @@ async function embedKPM() {
324324
function patch(type) {
325325
const superkeyVal = document.querySelector('#superkey md-outlined-text-field').value;
326326
const terminal = document.querySelector('#patch-terminal');
327+
const pageContent = terminal.closest('.page-content');
328+
const onOutput = (data) => {
329+
terminal.innerHTML += `<div>${data}</div>`;
330+
pageContent.scrollTo({ top: pageContent.scrollHeight, behavior: 'smooth' });
331+
};
327332

328333
if (!bootDev) {
329334
terminal.textContent = 'Error: No boot image found.';
@@ -359,21 +364,17 @@ function patch(type) {
359364
args.push(`${modDir}/boot_unpatch.sh`, bootDev);
360365
}
361366

362-
const process = spawn(`busybox`, args,
367+
const process = spawn(
368+
`busybox`,
369+
args,
363370
{
364371
cwd: `${modDir}/tmp`,
365372
env: {
366373
PATH: `${modDir}/bin:/data/adb/ksu/bin:/data/adb/magisk:$PATH`,
367374
ASH_STANDALONE: '1'
368375
}
369-
});
370-
371-
const pageContent = terminal.closest('.page-content');
372-
const onOutput = (data) => {
373-
terminal.innerHTML += `<div>${data}</div>`;
374-
pageContent.scrollTo({ top: pageContent.scrollHeight, behavior: 'smooth' });
375-
};
376-
376+
}
377+
);
377378
process.stdout.on('data', onOutput);
378379
process.stderr.on('data', onOutput);
379380
process.on('exit', (code) => {

0 commit comments

Comments
 (0)