diff options
Diffstat (limited to 'META-INF/com/google/android/update-binary')
-rwxr-xr-x | META-INF/com/google/android/update-binary | 94 |
1 files changed, 66 insertions, 28 deletions
diff --git a/META-INF/com/google/android/update-binary b/META-INF/com/google/android/update-binary index aa8492b..e8d240d 100755 --- a/META-INF/com/google/android/update-binary +++ b/META-INF/com/google/android/update-binary @@ -140,6 +140,24 @@ abort() { fi; exit 1; } +dump_moduleinfo() { +cat <<EOF > $1; +name=AK3 Helper Module +version=$($bb awk '{ print $3 }' $home/vertmp) $($bb grep -oE '#.[0-9]' $home/vertmp) +versionCode=1 +author=AnyKernel3 +description=$kernel_string +EOF +} +dump_moduleremover() { +cat <<EOF > $1; +#!/system/bin/sh +MODDIR=\${0%/*}; +if [ "\$(cat /proc/version)" != "\$(cat \$MODDIR/version)" ]; then + rm -rf \$MODDIR; +fi; +EOF +} show_progress 1.34 4; ui_print " "; @@ -174,7 +192,8 @@ if [ -f banner ]; then ui_print " " " "; fi; -ui_print "$(file_getprop anykernel.sh kernel.string)"; +kernel_string="$(file_getprop anykernel.sh kernel.string)"; +ui_print "$kernel_string"; if [ -f version ]; then ui_print " "; ui_printfile version; @@ -310,35 +329,54 @@ if [ $? != 0 ]; then fi; if [ "$(file_getprop anykernel.sh do.modules)" == 1 ]; then - ui_print " " "Pushing modules..."; - $bb mount -o rw,remount -t auto /system; - $bb mount -o rw,remount -t auto /vendor 2>/dev/null; - cd $home/modules; - for module in $(find . -name '*.ko'); do - modtarget=$(echo $module | $bb cut -c2-); - if [ ! -e $modtarget ]; then - case $module in - */vendor/*) modcon=vendor;; - *) modcon=system;; - esac; - fi; - if is_mounted $modtarget; then - $bb mount -o rw,remount -t auto $modtarget; + if [ "$(file_getprop anykernel.sh do.systemless)" == 1 ]; then + cd $home/modules; + ui_print " " "Creating kernel helper Magisk module..."; + if [ -d /data/adb/magisk -a -f $home/split_img/.magisk ]; then + umask 022; + moddir=/data/adb/modules/ak3-helper; + rm -rf $moddir; + mkdir -p system $moddir; + ($bb mv -f product system; + $bb mv -f vendor system) 2>/dev/null; + $bb cp -rLf * $moddir; + dump_moduleinfo $moddir/module.prop; + dump_moduleremover $moddir/post-fs-data.sh; + cp -f $home/vertmp $moddir/version; + else + ui_print "Magisk installation not found. Skipped!"; fi; - mkdir -p $(dirname $modtarget); - $bb cp -rLf $module $modtarget; - $bb chown 0:0 $modtarget; - $bb chmod 644 $modtarget; - if [ "$modcon" ]; then - chcon "u:object_r:${modcon}_file:s0" $modtarget; - fi; - if is_mounted $modtarget; then - $bb mount -o ro,remount -t auto $modtarget; - fi; - done; + else + cd $home/modules; + ui_print " " "Pushing modules..."; + $bb mount -o rw,remount -t auto /system; + $bb mount -o rw,remount -t auto /vendor 2>/dev/null; + for module in $(find . -name '*.ko'); do + modtarget=$(echo $module | $bb cut -c2-); + if [ ! -e $modtarget ]; then + case $module in + */vendor/*) modcon=vendor;; + *) modcon=system;; + esac; + fi; + if is_mounted $modtarget; then + $bb mount -o rw,remount -t auto $modtarget; + fi; + mkdir -p $(dirname $modtarget); + $bb cp -rLf $module $modtarget; + $bb chown 0:0 $modtarget; + $bb chmod 644 $modtarget; + if [ "$modcon" ]; then + chcon "u:object_r:${modcon}_file:s0" $modtarget; + fi; + if is_mounted $modtarget; then + $bb mount -o ro,remount -t auto $modtarget; + fi; + done; + $bb mount -o ro,remount -t auto /system; + $bb mount -o ro,remount -t auto /vendor 2>/dev/null; + fi; cd $home; - $bb mount -o ro,remount -t auto /system; - $bb mount -o ro,remount -t auto /vendor 2>/dev/null; fi; debugging; |