Skip to content

Commit

Permalink
**2019.5.11 (201905110)**
Browse files Browse the repository at this point in the history
- build.sh auto-updates update-binary (module_installer.sh)
- capacityOffset and capacitySync features for better control over battery capacity reported by the system
- Cleaner and more intuitive code - readability and maintenance
- coolDownRatio is null by default
- Enhanced daemon efficiency and flexibility
- Export logs to /sdcard/acc-logs-<device>.tar.bz2 with --log --export
- Fallback editors for --config and --log options:nano > vim > vi
- Improved overall performance
- Live upgrade support - users don't need to reboot after installing/upgrading to use the module
- Major fixes and optimizations
- Modular config for simpler and more accurate patching (config with old format will be reset)
- New charging voltage limit range: 3920-4349mV
- Option to disable battery stats auto-reset
- Regenerate power supply log on post-fs-data and during installation/upgrade
- Removed self-upgrade feature (security vulnerability)
- Restore default config with acc --set reset
- Simpler and more modular installer
- Standalone power supply logger
- Swapped "-v" and "-v -" options - "display current charging voltage" and "restore default voltage", respectively
- Temperature values are expressed in actual Celsius degrees
- Updated charging switches database
- Updated documentation
  • Loading branch information
VR-25 committed May 11, 2019
1 parent 7b9944a commit f921e3c
Show file tree
Hide file tree
Showing 30 changed files with 1,723 additions and 1,823 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
** text eol=lf

# Denote all files that are truly binary and should not be modified.
bin/** binary
common/MODPATH/bin/** binary
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
.releases
.rsc
_builds
_resources
.directory
*.kate-swp
119 changes: 63 additions & 56 deletions META-INF/com/google/android/update-binary
Original file line number Diff line number Diff line change
@@ -1,54 +1,47 @@
#!/sbin/sh
##########################################################################################
#
# Magisk Module Template Install Script
# by topjohnwu
#
##########################################################################################

TMPDIR=/dev/tmp
INSTALLER=$TMPDIR/install
# Always mount under tmp
MOUNTPATH=$TMPDIR/magisk_img
MOUNTPATH=/dev/magisk_img

# Default permissions
umask 022

# Initial cleanup
rm -rf $TMPDIR 2>/dev/null
mkdir -p $INSTALLER
mkdir -p $TMPDIR

# echo before loading util_functions
ui_print() { echo "$1"; }

require_new_magisk() { ###
unzip -o "$ZIP" config.sh module.prop -d $INSTALLER >&2
. $INSTALLER/config.sh
install_system
require_new_magisk() {
ui_print "***********************************"
ui_print " Please install the latest Magisk! "
ui_print "***********************************"
exit 1
}

imageless_magisk() {
[ $MAGISK_VER_CODE -gt 18100 ]
return $?
}

##########################################################################################
# Environment
##########################################################################################

OUTFD=$2
ZIP="$3" ###
ZIPFILE=$3

mount /data 2>/dev/null

# Load utility functions
if [ -f /data/adb/magisk/util_functions.sh ]; then
. /data/adb/magisk/util_functions.sh
elif [ -f /data/magisk/util_functions.sh ]; then
NVBASE=/data
. /data/magisk/util_functions.sh
NVBASE=/data/adb
else
require_new_magisk
fi

# Use alternative image if in BOOTMODE
$BOOTMODE && IMG=$NVBASE/magisk_merge.img

# Preperation for flashable zips
setup_flashable

Expand All @@ -58,9 +51,6 @@ mount_partitions
# Detect version and architecture
api_level_arch_detect

# You can get the Android API version from $API, the CPU architecture from $ARCH
# Useful if you are creating Android version / platform dependent mods

# Setup busybox and binaries
$BOOTMODE && boot_actions || recovery_actions

Expand All @@ -69,22 +59,28 @@ $BOOTMODE && boot_actions || recovery_actions
##########################################################################################

# Extract common files
unzip -o "$ZIP" module.prop config.sh 'common/*' -d $INSTALLER >&2
unzip -oj "$ZIPFILE" module.prop install.sh uninstall.sh 'common/*' -d $TMPDIR >&2

[ ! -f $INSTALLER/config.sh ] && abort "! Unable to extract zip file!"
# Load configurations
. $INSTALLER/config.sh
[ ! -f $TMPDIR/install.sh ] && abort "! Unable to extract zip file!"
# Load install script
. $TMPDIR/install.sh

# Check the installed magisk version
MIN_VER=`grep_prop minMagisk $INSTALLER/module.prop`
[ ! -z $MAGISK_VER_CODE -a $MAGISK_VER_CODE -ge $MIN_VER ] || require_new_magisk
MODID=`grep_prop id $INSTALLER/module.prop`
MODPATH=$MOUNTPATH/$MODID
if imageless_magisk; then
$BOOTMODE && MODDIRNAME=modules_update || MODDIRNAME=modules
MODULEROOT=$NVBASE/$MODDIRNAME
else
$BOOTMODE && IMGNAME=magisk_merge.img || IMGNAME=magisk.img
IMG=$NVBASE/$IMGNAME
request_zip_size_check "$ZIPFILE"
mount_magisk_img
MODULEROOT=$MOUNTPATH
fi

MODID=`grep_prop id $TMPDIR/module.prop`
MODPATH=$MODULEROOT/$MODID

# Print mod name
print_modname

# Please leave this message in your flashable zip for credits :)
ui_print "******************************"
ui_print "Powered by Magisk (@topjohnwu)"
ui_print "******************************"
Expand All @@ -93,38 +89,51 @@ ui_print "******************************"
# Install
##########################################################################################

# Get the variable reqSizeM. Use your own method to determine reqSizeM if needed
request_zip_size_check "$ZIP"
# Create mod paths
rm -rf $MODPATH 2>/dev/null
mkdir -p $MODPATH

# This function will mount $IMG to $MOUNTPATH, and resize the image based on $reqSizeM
mount_magisk_img
on_install

install_module ###
# Remove placeholder
rm -f $MODPATH/system/placeholder 2>/dev/null

# Handle replace folders
for TARGET in $REPLACE; do
mktouch $MODPATH$TARGET/.replace
done
# Custom uninstaller
[ -f $TMPDIR/uninstall.sh ] && cp -af $TMPDIR/uninstall.sh $MODPATH/uninstall.sh

# Auto Mount
$AUTOMOUNT && touch $MODPATH/auto_mount
if imageless_magisk; then
$SKIPMOUNT && touch $MODPATH/skip_mount
else
$SKIPMOUNT || touch $MODPATH/auto_mount
fi

# prop files
$PROPFILE && cp -af $INSTALLER/common/system.prop $MODPATH/system.prop
$PROPFILE && cp -af $TMPDIR/system.prop $MODPATH/system.prop

# Module info
cp -af $INSTALLER/module.prop $MODPATH/module.prop
cp -af $TMPDIR/module.prop $MODPATH/module.prop
if $BOOTMODE; then
# Update info for Magisk Manager
mktouch /sbin/.core/img/$MODID/update
cp -af $INSTALLER/module.prop /sbin/.core/img/$MODID/module.prop
if imageless_magisk; then
mktouch $NVBASE/modules/$MODID/update
cp -af $TMPDIR/module.prop $NVBASE/modules/$MODID/module.prop
else
mktouch /sbin/.magisk/img/$MODID/update
cp -af $TMPDIR/module.prop /sbin/.magisk/img/$MODID/module.prop
fi
fi

# post-fs-data mode scripts
$POSTFSDATA && cp -af $INSTALLER/common/post-fs-data.sh $MODPATH/post-fs-data.sh
$POSTFSDATA && cp -af $TMPDIR/post-fs-data.sh $MODPATH/post-fs-data.sh

# service mode scripts
$LATESTARTSERVICE && cp -af $INSTALLER/common/service.sh $MODPATH/service.sh
$LATESTARTSERVICE && cp -af $TMPDIR/service.sh $MODPATH/service.sh

# Handle replace folders
for TARGET in $REPLACE; do
mktouch $MODPATH$TARGET/.replace
done

ui_print "- Setting permissions"
set_permissions
Expand All @@ -133,12 +142,10 @@ set_permissions
# Finalizing
##########################################################################################

# Unmount magisk image and shrink if possible
unmount_magisk_img

cd /
imageless_magisk || unmount_magisk_img
$BOOTMODE || recovery_cleanup
rm -rf $TMPDIR
rm -rf $TMPDIR $MOUNTPATH

ui_print "- Done"
version_info ###
exit 0
Loading

0 comments on commit f921e3c

Please sign in to comment.