Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

customize.sh #925

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 30 additions & 19 deletions MagiskModBase/customize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,25 +101,36 @@ activateModuleLSPD()

testKernelSU()
{
if [[ $(ksud -V 2>&1 | grep "not found" | wc -c) -eq 0 ]]; then #KSU installed
if [[ $(pm list packages | grep $PKGNAME | wc -c) -eq 0 ]]; then #PixelXpert NOT installed yet
ui_print ''
ui_print '*******************************'
ui_print 'KernelSU binaries found!'
ui_print ''
ui_print ' CAUTION!:'
ui_print 'Before installation, you MUST disable'
ui_print '"Unmount modules by default"'
ui_print 'Otherwise, your device will fall into BOOTLOOP!'
ui_print ''
ui_print 'Do you wish to continue?'
ui_print 'Volume Up: Continue'
ui_print 'Volume Down: Abort'
if [[ "$(getevent -l | grep -m 1 KEY_VOLUME)" == *"VOLUMEDOWN"* ]]; then
abort 'Installation cancelled'
fi;
fi;
fi;
if [[ $(ksud -V 2>&1 | grep "not found" | wc -c) -eq 0 ]]; then #KSU installed
if [[ $(pm list packages | grep $PKGNAME | wc -c) -eq 0 ]]; then #PixelXpert NOT installed yet
ui_print ''
ui_print '*******************************'
ui_print 'KernelSU binaries found!'
ui_print ''
ui_print ' CAUTION!: '
ui_print 'Before installation, you MUST disable'
ui_print '"Unmount modules by default"'
ui_print 'Otherwise, your device will fall into BOOTLOOP!'
ui_print ''
ui_print 'Do you wish to continue?'
ui_print 'Volume Up: Continue'
ui_print 'Volume Down: Abort'

# Wait for volume key input
echo "Waiting for volume key input..."

# Check for Volume Down
if getevent -l -c 1 /dev/input/eventX | grep -q "KEY_VOLUMEDOWN"; then
abort 'Installation cancelled'
fi

# Check for Volume Up
if getevent -l -c 1 /dev/input/eventX | grep -q "KEY_VOLUMEUP"; then
echo "Continuing installation..."
# Continue with installation
fi
fi
fi
}

testKernelSU
Expand Down