-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for flashing via recovery
This will install BCR directly into the system partition. With this installation method, Magisk is not involved at all. Fixes: #128 Signed-off-by: Andrew Gunnerson <[email protected]>
- Loading branch information
1 parent
d595702
commit 4f03a2a
Showing
2 changed files
with
31 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,40 @@ | ||
#!/sbin/sh | ||
|
||
################# | ||
# Initialization | ||
################# | ||
OUTFD=${2} | ||
ZIPFILE=${3} | ||
|
||
umask 022 | ||
|
||
# echo before loading util_functions | ||
ui_print() { echo "$1"; } | ||
|
||
require_new_magisk() { | ||
ui_print "*******************************" | ||
ui_print " Please install Magisk v20.4+! " | ||
ui_print "*******************************" | ||
exit 1 | ||
ui_print() { | ||
printf "ui_print %s\nui_print\n" "${*}" > /proc/self/fd/"${OUTFD}" | ||
} | ||
|
||
######################### | ||
# Load util_functions.sh | ||
######################### | ||
if [ -f /sbin/recovery ]; then | ||
# Installing via recovery. Always do a direct install. | ||
set -exu | ||
|
||
ui_print 'Mounting system' | ||
if mount /system_root; then | ||
root_dir=/system_root | ||
else | ||
mount /system | ||
root_dir=/ | ||
fi | ||
|
||
ui_print 'Extracting files' | ||
|
||
# Just overwriting isn't sufficient because the apk filenames are different | ||
# between debug and release builds | ||
app_id=$(unzip -p "${ZIPFILE}" module.prop | grep '^id=' | cut -d= -f2) | ||
rm -rf "${root_dir}/system/priv-app/${app_id}" | ||
|
||
OUTFD=$2 | ||
ZIPFILE=$3 | ||
unzip -o "${ZIPFILE}" 'system/*' -d "${root_dir}" | ||
|
||
mount /data 2>/dev/null | ||
ui_print 'Done!' | ||
else | ||
# Installing via Magisk Manager. | ||
|
||
[ -f /data/adb/magisk/util_functions.sh ] || require_new_magisk | ||
. /data/adb/magisk/util_functions.sh | ||
[ $MAGISK_VER_CODE -lt 20400 ] && require_new_magisk | ||
. /data/adb/magisk/util_functions.sh | ||
|
||
install_module | ||
exit 0 | ||
install_module | ||
fi |