diff --git a/META-INF/com/google/android/update-binary b/META-INF/com/google/android/update-binary index 72ac2e5..acc501e 100644 --- a/META-INF/com/google/android/update-binary +++ b/META-INF/com/google/android/update-binary @@ -13,7 +13,7 @@ SKIPUNZIP=1 echo id=acc umask 0077 -data_dir=/sdcard/Download/$id +data_dir=/sdcard/vr25/$id # log @@ -121,14 +121,11 @@ fi # check/change parent installation directory - ! $magisk || installDir=$magiskModDir - -[ -d $installDir ] || installDir=/data/adb - +[ $installDir != /data/adb/vr25 ] || mkdir -p $installDir [ -d $installDir ] || { - printf "(!) $installDir/ not found\n" - exit 1 + installDir=/data/adb/vr25 + mkdir -p $installDir } @@ -141,9 +138,14 @@ GPLv3+ # migrate #legacy data -mv -f /data/adb/${id}-data/* /data/adb/${id}-data/.* \ - $data_dir/ 2>/dev/null || : -rm -rf $data_dir/info /data/adb/${id}-data/ 2>/dev/null || : +if [ -d /data/adb/${id}-data ]; then + mv -f /data/adb/${id}-data/* /data/adb/${id}-data/.* \ + $data_dir/ 2>/dev/null || : +else + mv -f /sdcard/Download/$id/* /sdcard/Download/$id/.* \ + $data_dir/ 2>/dev/null || : +fi +rm -rf $data_dir/info 2>/dev/null || : /system/bin/sh $srcDir/$id/uninstall.sh install @@ -188,7 +190,7 @@ if $acca; then sleep 60 - [ -e /data/data/mattecarra.${id}app/files/$id ] || rm \$0 /data/adb/$id /data/adb/modules/$id 2>/dev/null + [ -e /data/data/mattecarra.${id}app/files/$id ] || rm -rf \$0 /data/adb/vr25/$id /data/adb/modules/$id 2>/dev/null exit 0" | sed 's/^ //' > /data/adb/service.d/${id}-cleanup.sh chmod 0700 /data/adb/service.d/${id}-cleanup.sh @@ -196,7 +198,10 @@ if $acca; then fi -[ $installDir = /data/adb/$id ] || ln -s $installDir /data/adb/ +[ $installDir = /data/adb/vr25/$id ] || { + mkdir -p /data/adb/vr25 + ln -s $installDir /data/adb/vr25/ +} # install binaries @@ -258,10 +263,10 @@ echo " [ $installDir = /data/adb ] && echo " -(i) Non-Magisk users can enable $id auto-start by running /data/adb/$id/service.sh, a copy of, or a link to it - with init.d or an app that emulates it." +(i) Non-Magisk users can enable $id auto-start by running /data/adb/vr25/$id/service.sh, a copy of, or a link to it - with init.d or an app that emulates it." # initialize $id -/data/adb/$id/service.sh --init +/data/adb/vr25/$id/service.sh --init exit 0 diff --git a/README.md b/README.md index a90019d..3084829 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ Always read/reread this reference prior to installing/upgrading this software. While no cats have been harmed, the author assumes no responsibility for anything that might break due to the use/misuse of it. -To prevent fraud, do NOT mirror any link associated with this project; do NOT share builds (zips/tarballs)! Share official links instead. +To prevent fraud, do NOT mirror any link associated with this project; do NOT share builds (tarballs/zips)! Share official links instead. --- @@ -52,10 +52,10 @@ By choosing to use/misuse it, you agree to do so at your own risk! - [Must read - how to prolong lithium ion batteries lifespan](https://batteryuniversity.com/index.php/learn/article/how_to_prolong_lithium_based_batteries/) - Android or Android based OS -- Any root method (e.g., [Magisk](https://github.com/topjohnwu/Magisk/)) +- Any root solution (e.g., [Magisk](https://github.com/topjohnwu/Magisk/)) - [Busybox\*](https://github.com/search?o=desc&q=busybox+android&s=updated&type=Repositories/) (only if not rooted with Magisk) -- [curl](https://github.com/search?o=desc&q=curl+android&s=updated&type=Repositories/) (for fbind --upgrade, optional) -- Non-Magisk users can enable acc auto-start by running /data/adb/$id/service.sh, a copy of, or a link to it - with init.d or an app that emulates it +- [curl](https://github.com/search?o=desc&q=curl+android&s=updated&type=Repositories/) (for acc --upgrade, optional) +- Non-Magisk users can enable acc auto-start by running /data/adb/vr25/acc/service.sh, a copy of, or a link to it - with init.d or an app that emulates it. - Terminal emulator - Text editor (optional) @@ -95,11 +95,11 @@ Settings can be overwhelming. Start with what you understand. The default configuration has you covered. Don't ever feel like you have to configure everything. You probably shouldn't anyway - unless you really know what you're doing. -Uninstall: run `acc --uninstall` or flash\* `/sdcard/Download/acc/acc-uninstaller.zip`. +Uninstall: run `acc --uninstall` or flash\* `/sdcard/vr25/acc/acc-uninstaller.zip`. ACC runs in some recovery environments as well. Unless the zip is flashed again, manual initialization is required. -The initialization command is `/data/adb/acc/service.sh`. +The initialization command is `/data/adb/vr25/acc/service.sh`. --- @@ -424,7 +424,7 @@ It's a wizard you'll either love or hate. If you feel uncomfortable with the command line, skip this section and use the [ACC App](https://github.com/MatteCarra/AccA/releases/) to manage ACC. -Alternatively, you can use a `text editor` to modify `/sdcard/Download/acc/config.txt`. +Alternatively, you can use a `text editor` to modify `/sdcard/vr25/acc/config.txt`. Restart the [daemon](https://en.wikipedia.org/wiki/Daemon_(computing)) afterwards, by running `accd`. The config file itself has configuration instructions. These instructions are the same found in the `DEFAULT CONFIG` section, above. @@ -495,7 +495,7 @@ Options e.g., acc -F (lauches a zip flashing wizard) acc -F "file1" "file2" "fileN" ... (install multiple zips) - acc -F "/sdcard/Download/Magisk-v20.0(20000).zip" + acc -F "/sdcard/vr25/Magisk-v20.0(20000).zip" -i|--info [case insentive egrep regex (default: ".")] Show battery info e.g., @@ -512,7 +512,7 @@ Options -la Same as -l -a - -l|--log -e|--export Export all logs to /sdcard/Download/acc/logs/acc-logs-$deviceName.tar.bz2 + -l|--log -e|--export Export all logs to /sdcard/vr25/acc/logs/acc-logs-$deviceName.tar.bz2 e.g., acc -l -e -le Same as -l -e @@ -562,7 +562,7 @@ Options -s|--set r|--reset Restore default config e.g., acc -s r - rm /sdcard/Download/acc/config.txt (failsafe) + rm /sdcard/vr25/acc/config.txt (failsafe) -sr Same as above @@ -590,7 +590,7 @@ Options acc -t battery/charging_enabled 1 0 acc -t /proc/mtk_battery_cmd/current_cmd 0::0 0::1 /proc/mtk_battery_cmd/en_power_path 1 0 ("::" is a placeholder for " ") - -t|--test [file] Test charging switches from a file (default: /data/data/com.termux/files/usr/tmp/ch-switches) + -t|--test [file] Test charging switches from a file (default: /dev/.acc/ch-switches) This will also report whether "battery idle" mode is supported e.g., acc -t (test known switches) @@ -681,7 +681,7 @@ Note: after updating charging_switch or shutdown_capacity, accd has to be restar ``` 1) Check whether ACC is installed (exit code 0) -"which acc" +"/dev/acca --version" 2) Download the installer (https://raw.githubusercontent.com/VR-25/acc/master/install-online.sh) - e.g., @@ -733,7 +733,7 @@ Most of the time, though, it's just a matter of plugging the phone before turnin Battery level must be below pause_capacity. Once booted, one can run `acc --uninstall` (or `acc -U`) to remove ACC. -From recovery, one can flash `/sdcard/Download/acc/acc-uninstaller.zip` or run `mount /system; /data/adb/acc/uninstall.sh`. +From recovery, one can flash `/sdcard/vr25/acc/acc-uninstaller.zip` or run `mount /system; /data/adb/vr25/acc/uninstall.sh`. ### Charging Switch @@ -780,7 +780,7 @@ The phone will only draw the max it can take. ### Diagnostics/Logs -Volatile logs (gone on reboot) are stored in `/dev/.acc/`, persistent logs - `/sdcard/Download/acc/logs/`. +Volatile logs (gone on reboot) are stored in `/dev/.acc/`, persistent logs - `/sdcard/vr25/acc/logs/`. `acc -le` exports all acc logs, plus Magisk's and extras to `/sdcard/acc-$device_codename.tar.bz2`. The logs do not contain any personal information and are never automatically sent to the developer. @@ -791,7 +791,7 @@ Automatic exporting (local) happens under specific conditions (refer back to `SE This can save you a lot of time and grief. -`acc --set --reset`, `acc -sr` or `rm /sdcard/Download/acc/config.txt` (failsafe) +`acc --set --reset`, `acc -sr` or `rm /sdcard/vr25/acc/config.txt` (failsafe) ### Slow Charging @@ -807,7 +807,7 @@ At least one of the following may be the cause: --- ## POWER SUPPLY LOG (HELP NEEDED) -Please run `acc -le` and upload `/sdcard/Download/acc/logs/power_supply-*.log` to [my dropbox](https://www.dropbox.com/request/WYVDyCc0GkKQ8U5mLNlH/) (no account/sign-up required). +Please run `acc -le` and upload `/sdcard/vr25/acc/logs/power_supply-*.log` to [my dropbox](https://www.dropbox.com/request/WYVDyCc0GkKQ8U5mLNlH/) (no account/sign-up required). This file contains invaluable power supply information, such as battery details and available charging control files. A public database is being built for mutual benefit. Your cooperation is greatly appreciated. @@ -876,7 +876,7 @@ There are no negative consequences when it doesn't. Open issues on GitHub or contact the developer on Facebook, Telegram (preferred) or XDA (links below). Always provide as much information as possible. -Attach `/sdcard/Download/acc/logs/acc-logs-*tar.bz2` - generated by `acc -le` _right after_ the problem occurs. +Attach `/sdcard/vr25/acc/logs/acc-logs-*tar.bz2` - generated by `acc -le` _right after_ the problem occurs. Refer back to `TROUBLESHOOTING > Diagnostics/Logs` for additional details. @@ -997,6 +997,21 @@ A common workaround is having `resume_capacity = pause_capacity - 1`. e.g., resu --- ## LATEST CHANGES + +**v2020.10.1 (202010010)** + +- Fixed automatic charging switch management issues. +- Fixed ghost charging problem related to cooldown and capacity_sync/capacity_freeze2. +- General optimizations +- Persistent data is now saved in /sdcard/vr25/acc/. +- Workaround for EdXposed's service.sh bug + +Release Notes + +- Confirmed: the MIUI bootloop issue is gone. +- If you face any other issue, run `rm /sdcard/vr25/acc/config.txt; accd` to reset the config and restart accd. + + **v2020.9.24 (202009240)** - Cooldown no longer interferes with capacity_sync. diff --git a/TODO.txt b/TODO.txt index 845418d..046e7db 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,6 +1 @@ remove #legacy - -check #wip - run_xtimes() - -change data_dir and execDir? diff --git a/acc/acc.sh b/acc/acc.sh index 023fa06..306fd35 100644 --- a/acc/acc.sh +++ b/acc/acc.sh @@ -140,7 +140,7 @@ set_prop_() { ! ${verbose:-true} || echo isAccd=false -execDir=/data/adb/acc +execDir=/data/adb/vr25/acc defaultConfig=$execDir/default-config.txt # load generic functions diff --git a/acc/acca.sh b/acc/acca.sh index 783cc4b..e6df222 100644 --- a/acc/acca.sh +++ b/acc/acca.sh @@ -21,11 +21,11 @@ daemon_ctrl() { set -eu -cd /data/adb/acc/ +cd /data/adb/vr25/acc/ export TMPDIR=/dev/.acc verbose=false . ./setup-busybox.sh -config=/sdcard/Download/acc/config.txt +config=/sdcard/vr25/acc/config.txt defaultConfig=$PWD/default-config.txt mkdir -p ${config%/*} 2>/dev/null || : @@ -57,7 +57,7 @@ case "$@" in && grep -q '^POWER_SUPPLY_STATUS=' $batt \ && batt=${batt%/*} && break done 2>/dev/null || : - . /data/adb/acc/batt-info.sh + . /data/adb/vr25/acc/batt-info.sh batt_info "${2-}" exit 0 ;; diff --git a/acc/accd.sh b/acc/accd.sh index b6fb8bf..7b08130 100644 --- a/acc/accd.sh +++ b/acc/accd.sh @@ -12,7 +12,7 @@ pgrep zygote > /dev/null && { && test .$(getprop sys.boot_completed) = .1 \ && dumpsys battery > /dev/null 2>&1 do - sleep 300 # to prevent conflicts with fbind + sleep 30 done } @@ -128,7 +128,7 @@ if [ -f $TMPDIR/.config-ver ] && ! $init; then ### if is_charging; then # disable charging under - test $(cat $batt/temp 2>/dev/null || cat $batt/batt_temp) -ge $(( ${temperature[1]} * 10 )) \ + test $(cat $batt/temp $batt/batt_temp 2>/dev/null) -ge $(( ${temperature[1]} * 10 )) \ && maxTempPause=true || maxTempPause=false if $maxTempPause || test $(cat $batt/capacity) -ge ${capacity[3]}; then disable_charging @@ -141,11 +141,11 @@ if [ -f $TMPDIR/.config-ver ] && ! $init; then ### fi # cooldown cycle - while [[ -n "${cooldownRatio[0]-}" || -n "${cooldownCustom[0]-}" ]] \ + while [ -n "${cooldownRatio[0]-}${cooldownCustom[0]-}" ] \ && [ $(cat $batt/capacity) -lt ${capacity[3]} ] \ && is_charging do - if [ $(cat $batt/temp 2>/dev/null || cat $batt/batt_temp) -ge $(( ${temperature[0]} * 10 )) ] \ + if [ $(cat $batt/temp $batt/batt_temp 2>/dev/null) -ge $(( ${temperature[0]} * 10 )) ] \ || [ $(cat $batt/capacity) -ge ${capacity[1]} ] \ || [ $(sed s/-// ${cooldownCustom[0]:-cooldownCustom} 2>/dev/null || echo 0) -ge ${cooldownCustom[1]:-1} ] then @@ -178,7 +178,7 @@ if [ -f $TMPDIR/.config-ver ] && ! $init; then ### # enable charging under [ ! $(cat $batt/capacity) -le ${capacity[2]} ] || { - [ ! $(cat $batt/temp 2>/dev/null || cat $batt/batt_temp) -lt $(( ${temperature[1]} * 10 )) ] \ + [ ! $(cat $batt/temp $batt/batt_temp 2>/dev/null) -lt $(( ${temperature[1]} * 10 )) ] \ || enable_charging } @@ -202,6 +202,7 @@ if [ -f $TMPDIR/.config-ver ] && ! $init; then ### sync_capacity() { + local isCharging_=$isCharging ! $capacitySync || { ! $cooldown || isCharging=true if $isCharging; then @@ -211,6 +212,7 @@ if [ -f $TMPDIR/.config-ver ] && ! $init; then ### dumpsys battery unplug \ && dumpsys battery set status $dischgStatusCode || : fi + isCharging=$isCharging_ if ${capacity[4]} && [ $(cat $batt/capacity) -ge 2 ]; then dumpsys battery set level $(cat $batt/capacity) || : fi @@ -256,7 +258,7 @@ else # log - data_dir=/sdcard/Download/$id + data_dir=/sdcard/vr25/$id mkdir -p $TMPDIR $data_dir/logs exec > $data_dir/logs/init.log 2>&1 set -x diff --git a/acc/logf.sh b/acc/logf.sh index 3c0e0b7..5a904a6 100644 --- a/acc/logf.sh +++ b/acc/logf.sh @@ -22,7 +22,7 @@ logf() { [ -f $file ] && cp $file ./ && break done - data_dir=/sdcard/Download/acc + data_dir=/sdcard/vr25/acc mkdir -p $data_dir cp $data_dir/logs/* ./ 2>/dev/null diff --git a/acc/misc-functions.sh b/acc/misc-functions.sh index d752dba..d35aaac 100644 --- a/acc/misc-functions.sh +++ b/acc/misc-functions.sh @@ -56,17 +56,19 @@ cycle_switches() { && run_xtimes "echo \$$1 > ${chargingSwitch[3]}" || : } - [ "$1" != off ] || { + if [ "$1" = on ]; then + not_charging || break + else if sleep_sd not_charging ${2-}; then - # enforce working charging switch(es) + # set working charging switch(es) . $execDir/write-config.sh + break else # reset switch/group that fails to disable charging run_xtimes "echo ${chargingSwitch[1]//::/ } > ${chargingSwitch[0]} || :; echo ${chargingSwitch[4]//::/ } > ${chargingSwitch[3]:-/dev/null} || :" 2>/dev/null - break fi - } + fi } done < $TMPDIR/ch-switches } @@ -247,9 +249,6 @@ print_wait_plug() { run_xtimes() { - eval "$@" - return $? - #wip local count=0 for count in $(seq ${ctrlFileWrites[0]}); do eval "$@" @@ -293,10 +292,10 @@ id=acc umask 0077 switchDelay=7 loopDelay=(5 10) -execDir=/data/adb/acc +execDir=/data/adb/vr25/acc ctrlFileWrites=(3 0.3) export TMPDIR=/dev/.acc -config=/sdcard/Download/$id/config.txt +config=/sdcard/vr25/$id/config.txt config_=$config [ -f $TMPDIR/.ghost-charging ] \ diff --git a/acc/post-fs-data.sh b/acc/post-fs-data.sh new file mode 100644 index 0000000..1cbbf0b --- /dev/null +++ b/acc/post-fs-data.sh @@ -0,0 +1,7 @@ +#!/system/bin/sh +# Workaround for EdXposed's service.sh bug + +id=acc +ls -d /data/adb/modules/riru_edxposed_* > /dev/null 2>&1 \ + && exec /data/adb/vr25/$id/service.sh +exit 0 diff --git a/acc/power-supply-logger.sh b/acc/power-supply-logger.sh index 7f47a03..a097a3f 100644 --- a/acc/power-supply-logger.sh +++ b/acc/power-supply-logger.sh @@ -38,8 +38,8 @@ gather_ps_data() { export TMPDIR=/dev/.acc -execDir=/data/adb/acc -logsDir=/sdcard/Download/acc/logs +execDir=/data/adb/vr25/acc +logsDir=/sdcard/vr25/acc/logs print_wait 2>/dev/null || echo "(i) Alright, this may take a minute or so..." diff --git a/acc/service.sh b/acc/service.sh index f7462a9..5921278 100644 --- a/acc/service.sh +++ b/acc/service.sh @@ -8,7 +8,7 @@ id=acc TMPDIR=/dev/.$id -execDir=/data/adb/$id +execDir=/data/adb/vr25/$id umask 0077 mkdir -p $TMPDIR diff --git a/acc/set-ch-curr.sh b/acc/set-ch-curr.sh index c140921..b3bb7d1 100644 --- a/acc/set-ch-curr.sh +++ b/acc/set-ch-curr.sh @@ -1,7 +1,7 @@ set_ch_curr() { ${verbose:-true} || { - execDir=/data/adb/acc + execDir=/data/adb/vr25/acc exxit() { exit $?; } . $execDir/misc-functions.sh cd $execDir diff --git a/acc/set-ch-volt.sh b/acc/set-ch-volt.sh index af39c16..2c205ec 100644 --- a/acc/set-ch-volt.sh +++ b/acc/set-ch-volt.sh @@ -2,7 +2,7 @@ set_ch_volt() { if [ -n "${1-}" ]; then ${verbose:-true} || { - execDir=/data/adb/acc + execDir=/data/adb/vr25/acc exxit() { exit $?; } . $execDir/misc-functions.sh cd $execDir diff --git a/acc/strings.sh b/acc/strings.sh index 8947168..b3e17c1 100644 --- a/acc/strings.sh +++ b/acc/strings.sh @@ -148,7 +148,7 @@ Options e.g., acc -F (lauches a zip flashing wizard) acc -F "file1" "file2" "fileN" ... (install multiple zips) - acc -F "/sdcard/Download/Magisk-v20.0(20000).zip" + acc -F "/sdcard/vr25/Magisk-v20.0(20000).zip" -i|--info [case insentive egrep regex (default: ".")] Show battery info e.g., @@ -165,7 +165,7 @@ Options -la Same as -l -a - -l|--log -e|--export Export all logs to /sdcard/Download/acc/logs/acc-logs-\$deviceName.tar.bz2 + -l|--log -e|--export Export all logs to /sdcard/vr25/acc/logs/acc-logs-\$deviceName.tar.bz2 e.g., acc -l -e -le Same as -l -e @@ -215,7 +215,7 @@ Options -s|--set r|--reset Restore default config e.g., acc -s r - rm /sdcard/Download/acc/config.txt (failsafe) + rm /sdcard/vr25/acc/config.txt (failsafe) -sr Same as above @@ -243,7 +243,7 @@ Options acc -t battery/charging_enabled 1 0 acc -t /proc/mtk_battery_cmd/current_cmd 0::0 0::1 /proc/mtk_battery_cmd/en_power_path 1 0 ("::" is a placeholder for " ") - -t|--test [file] Test charging switches from a file (default: $TMPDIR/ch-switches) + -t|--test [file] Test charging switches from a file (default: /dev/.acc/ch-switches) This will also report whether "battery idle" mode is supported e.g., acc -t (test known switches) diff --git a/acc/uninstall.sh b/acc/uninstall.sh index 8179a64..5ba2a98 100644 --- a/acc/uninstall.sh +++ b/acc/uninstall.sh @@ -37,7 +37,7 @@ esac exec 2>/dev/null # terminate/kill $id processes -mkdir -p $TMPDIR/$id +mkdir -p $TMPDIR (flock -n 0 || { read pid kill $pid @@ -54,20 +54,22 @@ pgrep -f "/($id|${id}a) (-|--)[det]|/${id}d" > /dev/null && { #legacy } # uninstall $id ### -rm -rf $(readlink -f /data/adb/$id) \ - /data/adb/$id \ +rm -rf /data/adb/vr25/$id \ /data/adb/modules/$id \ /data/adb/service.d/${id}-*.sh \ /data/data/mattecarra.accapp/files/$id \ - /data/data/com.termux/files/home/.termux/boot/${id}-init.sh \ - $(test "${1:-}" = install || echo "/sdcard/Download/$id") + $(test "${1:-}" = install || echo "/sdcard/vr25/$id") #legacy -rm /data/adb/${id}-data \ +rm -rf $(readlink -f /data/adb/$id) \ + /data/adb/$id \ + /data/adb/${id}-data \ $(readlink -f /sbin/.$id/$id) \ /sdcard/${id}-logs-*.tar.* \ /sdcard/${id}-uninstaller.zip \ /sdcard/.${id}-config-backup.txt \ - /sdcard/Download/$id/*.tar.* 2>/dev/null + /sdcard/Download/$id \ + /sdcard/vr25/$id/.acc-config-backup.txt \ + /data/data/com.termux/files/home/.termux/boot/${id}-init.sh 2>/dev/null exit 0 diff --git a/bin/acc-uninstaller.zip b/bin/acc-uninstaller.zip index ca6d0a2..ce579b8 100644 Binary files a/bin/acc-uninstaller.zip and b/bin/acc-uninstaller.zip differ diff --git a/customize.sh b/customize.sh index 72ac2e5..acc501e 100644 --- a/customize.sh +++ b/customize.sh @@ -13,7 +13,7 @@ SKIPUNZIP=1 echo id=acc umask 0077 -data_dir=/sdcard/Download/$id +data_dir=/sdcard/vr25/$id # log @@ -121,14 +121,11 @@ fi # check/change parent installation directory - ! $magisk || installDir=$magiskModDir - -[ -d $installDir ] || installDir=/data/adb - +[ $installDir != /data/adb/vr25 ] || mkdir -p $installDir [ -d $installDir ] || { - printf "(!) $installDir/ not found\n" - exit 1 + installDir=/data/adb/vr25 + mkdir -p $installDir } @@ -141,9 +138,14 @@ GPLv3+ # migrate #legacy data -mv -f /data/adb/${id}-data/* /data/adb/${id}-data/.* \ - $data_dir/ 2>/dev/null || : -rm -rf $data_dir/info /data/adb/${id}-data/ 2>/dev/null || : +if [ -d /data/adb/${id}-data ]; then + mv -f /data/adb/${id}-data/* /data/adb/${id}-data/.* \ + $data_dir/ 2>/dev/null || : +else + mv -f /sdcard/Download/$id/* /sdcard/Download/$id/.* \ + $data_dir/ 2>/dev/null || : +fi +rm -rf $data_dir/info 2>/dev/null || : /system/bin/sh $srcDir/$id/uninstall.sh install @@ -188,7 +190,7 @@ if $acca; then sleep 60 - [ -e /data/data/mattecarra.${id}app/files/$id ] || rm \$0 /data/adb/$id /data/adb/modules/$id 2>/dev/null + [ -e /data/data/mattecarra.${id}app/files/$id ] || rm -rf \$0 /data/adb/vr25/$id /data/adb/modules/$id 2>/dev/null exit 0" | sed 's/^ //' > /data/adb/service.d/${id}-cleanup.sh chmod 0700 /data/adb/service.d/${id}-cleanup.sh @@ -196,7 +198,10 @@ if $acca; then fi -[ $installDir = /data/adb/$id ] || ln -s $installDir /data/adb/ +[ $installDir = /data/adb/vr25/$id ] || { + mkdir -p /data/adb/vr25 + ln -s $installDir /data/adb/vr25/ +} # install binaries @@ -258,10 +263,10 @@ echo " [ $installDir = /data/adb ] && echo " -(i) Non-Magisk users can enable $id auto-start by running /data/adb/$id/service.sh, a copy of, or a link to it - with init.d or an app that emulates it." +(i) Non-Magisk users can enable $id auto-start by running /data/adb/vr25/$id/service.sh, a copy of, or a link to it - with init.d or an app that emulates it." # initialize $id -/data/adb/$id/service.sh --init +/data/adb/vr25/$id/service.sh --init exit 0 diff --git a/install-online.sh b/install-online.sh index bb13380..803a462 100644 --- a/install-online.sh +++ b/install-online.sh @@ -15,7 +15,7 @@ set +x echo id=acc umask 0077 -data_dir=/sdcard/Download/$id +data_dir=/sdcard/vr25/$id # log [ -z "${LINENO-}" ] || export PS4='$LINENO: ' @@ -79,7 +79,7 @@ reference=$(echo "$*" | sed -E 's/%.*%|-c|--changelog|-f|--force|-k|--insecure|- tarball=https://github.com/VR-25/$id/archive/${reference}.tar.gz -installedVersion=$(get_ver /data/adb/$id/module.prop 2>/dev/null || :) +installedVersion=$(get_ver /data/adb/vr25/$id/module.prop 2>/dev/null || :) onlineVersion=$(curl -L $insecure https://raw.githubusercontent.com/VR-25/$id/${reference}/module.prop | get_ver) diff --git a/install-tarball.sh b/install-tarball.sh index 4ccd2fc..7388a8c 100644 --- a/install-tarball.sh +++ b/install-tarball.sh @@ -5,7 +5,7 @@ id=acc umask 0077 -data_dir=/sdcard/Download/${1:-$id} +data_dir=/sdcard/vr25/${1:-$id} # log [ -z "${LINENO-}" ] || export PS4='$LINENO: ' @@ -76,9 +76,9 @@ case "$PWD" in *mattecarra.accapp*) get_ver() { sed -n '/^versionCode=/s/.*=//p' $1/module.prop 2>/dev/null || echo 0; } bundled_ver=$(get_ver ${1:-$id}[-_]*) - regular_ver=$(get_ver /data/adb/$id) + regular_ver=$(get_ver /data/adb/vr25/$id) if [ $bundled_ver -le $regular_ver ] && [ $regular_ver -ne 0 ]; then - ln -s $(readlink -f /data/adb/$id) . + ln -s $(readlink -f /data/adb/vr25/$id) . (cd ./${1:-$id}/; ln -fs service.sh ${1:-$id}-init.sh) exit 0 fi 2>/dev/null || : diff --git a/install.sh b/install.sh index 72ac2e5..acc501e 100644 --- a/install.sh +++ b/install.sh @@ -13,7 +13,7 @@ SKIPUNZIP=1 echo id=acc umask 0077 -data_dir=/sdcard/Download/$id +data_dir=/sdcard/vr25/$id # log @@ -121,14 +121,11 @@ fi # check/change parent installation directory - ! $magisk || installDir=$magiskModDir - -[ -d $installDir ] || installDir=/data/adb - +[ $installDir != /data/adb/vr25 ] || mkdir -p $installDir [ -d $installDir ] || { - printf "(!) $installDir/ not found\n" - exit 1 + installDir=/data/adb/vr25 + mkdir -p $installDir } @@ -141,9 +138,14 @@ GPLv3+ # migrate #legacy data -mv -f /data/adb/${id}-data/* /data/adb/${id}-data/.* \ - $data_dir/ 2>/dev/null || : -rm -rf $data_dir/info /data/adb/${id}-data/ 2>/dev/null || : +if [ -d /data/adb/${id}-data ]; then + mv -f /data/adb/${id}-data/* /data/adb/${id}-data/.* \ + $data_dir/ 2>/dev/null || : +else + mv -f /sdcard/Download/$id/* /sdcard/Download/$id/.* \ + $data_dir/ 2>/dev/null || : +fi +rm -rf $data_dir/info 2>/dev/null || : /system/bin/sh $srcDir/$id/uninstall.sh install @@ -188,7 +190,7 @@ if $acca; then sleep 60 - [ -e /data/data/mattecarra.${id}app/files/$id ] || rm \$0 /data/adb/$id /data/adb/modules/$id 2>/dev/null + [ -e /data/data/mattecarra.${id}app/files/$id ] || rm -rf \$0 /data/adb/vr25/$id /data/adb/modules/$id 2>/dev/null exit 0" | sed 's/^ //' > /data/adb/service.d/${id}-cleanup.sh chmod 0700 /data/adb/service.d/${id}-cleanup.sh @@ -196,7 +198,10 @@ if $acca; then fi -[ $installDir = /data/adb/$id ] || ln -s $installDir /data/adb/ +[ $installDir = /data/adb/vr25/$id ] || { + mkdir -p /data/adb/vr25 + ln -s $installDir /data/adb/vr25/ +} # install binaries @@ -258,10 +263,10 @@ echo " [ $installDir = /data/adb ] && echo " -(i) Non-Magisk users can enable $id auto-start by running /data/adb/$id/service.sh, a copy of, or a link to it - with init.d or an app that emulates it." +(i) Non-Magisk users can enable $id auto-start by running /data/adb/vr25/$id/service.sh, a copy of, or a link to it - with init.d or an app that emulates it." # initialize $id -/data/adb/$id/service.sh --init +/data/adb/vr25/$id/service.sh --init exit 0 diff --git a/module.prop b/module.prop index 6ac482d..a84d1b5 100644 --- a/module.prop +++ b/module.prop @@ -1,6 +1,6 @@ id=acc name=Advanced Charging Controller (ACC) -version=v2020.9.24 -versionCode=202009240 +version=v2020.10.1 +versionCode=202010010 author=VR25 -description=ACC is an Android software. It's primarily intended for extending battery service life. In a nutshell, this is achieved through limiting charging current, temperature and voltage. Any root solution is supported. The installation is always "systemless", whether or not the system is rooted with Magisk. If you're reading this from Magisk Manager > Downloads, tap here to open the documentation. Once there, if you're lazy, jump to the quick start section. +description=ACC is an Android software mainly intended for extending battery service life. In a nutshell, this is achieved through limiting charging current, temperature and voltage. Any root solution is supported. The installation is always "systemless", whether or not the system is rooted with Magisk. If you're reading this from Magisk Manager > Downloads, tap here to open the documentation. Once there, if you feel lazy, scroll down to the quick start section.