diff --git a/META-INF/com/google/android/update-binary b/META-INF/com/google/android/update-binary index 65333e8..db1deba 100644 --- a/META-INF/com/google/android/update-binary +++ b/META-INF/com/google/android/update-binary @@ -13,13 +13,14 @@ SKIPUNZIP=1 echo id=acc umask 0077 +data_dir=/sdcard/Download/$id # log [ -z "${LINENO-}" ] || export PS4='$LINENO: ' -mkdir -p /data/adb/${id}-data/logs -chmod -R 0700 /data/adb/${id}-data/logs -exec 2>/data/adb/${id}-data/logs/install.log +mkdir -p $data_dir/logs +chmod -R 0700 $data_dir/logs +exec 2>$data_dir/logs/install.log set -x @@ -102,11 +103,10 @@ srcDir=${srcDir/#"${0##*/}"/"."} name=$(get_prop name) author=$(get_prop author) version=$(get_prop version) -userDir=/sdcard/Download/$id magiskModDir=/data/adb/modules versionCode=$(get_prop versionCode) : ${installDir:=/data/data/mattecarra.${id}app/files} ### -config=/data/adb/${id}-data/config.txt +config=$data_dir/config.txt [ -d $magiskModDir ] && magisk=true || magisk=false @@ -141,12 +141,17 @@ GPLv3+ (i) Installing in $installDir/$id/..." +# 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 || : + + /system/bin/sh $srcDir/$id/uninstall.sh install cp -R $srcDir/$id/ $installDir/ installDir=$(readlink -f $installDir/$id) cp $srcDir/module.prop $installDir/ -mkdir -p $userDir -cp -f $srcDir/README.md $userDir/ +cp -f $srcDir/README.md $data_dir/ ### @@ -195,12 +200,8 @@ fi [ $installDir = /data/adb/$id ] || ln -s $installDir /data/adb/ -# restore config backup -[ -f $config ] || cp $userDir/.${id}-config-backup.txt $config 2>/dev/null || : - - # install binaries -cp -f $srcDir/bin/${id}-uninstaller.zip $userDir/ +cp -f $srcDir/bin/${id}-uninstaller.zip $data_dir/ # Termux, fix shebang @@ -214,7 +215,6 @@ cp -f $srcDir/bin/${id}-uninstaller.zip $userDir/ # set perms -set_perms_recursive ${config%/*} case $installDir in /data/*/files/*$id) pkg=${installDir%/files/*$id} diff --git a/README.md b/README.md index bc0e3e8..60f1f93 100644 --- a/README.md +++ b/README.md @@ -516,7 +516,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 `/data/adb/acc-data/config.txt`. +Alternatively, you can use a `text editor` to modify `/sdcard/Download/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. @@ -654,7 +654,7 @@ Options -s|--set r|--reset Restore default config e.g., acc -s r - rm /data/adb/acc-data/config.txt (failsafe) + rm /sdcard/Download/acc/config.txt (failsafe) -sr Same as above @@ -738,12 +738,13 @@ Exit Codes Tips Commands can be chained for extended functionality. - e.g., acc -e 30m && acc -d 6h && acc -e 85 && accd (recharge for 30 minutes, pause charging for 6 hours, recharge to 85% capacity and restart the daemon) + e.g., charge for 30 minutes, pause charging for 6 hours, charge to 85% and restart the daemon + acc -e 30m && acc -d 6h && acc -e 85 && accd Bedtime settings... acc -s /dev/.my-night-config.txt pc=45 rc=43 mcc=500 mcv=3920 && sleep $((60*60*7)) && accd - "For the next 7 hours, keep battery capacity between 43-45%, limit charging current to 500 mA and voltage to 3920 millivolts" - - For convenience, this can be written to a file and ran as "sh /path/to/file". + - For convenience, this can be written to a file and ran as "su -c sh /path/to/file". Refer to acc -r (or --readme) for the full documentation (recommended) @@ -829,7 +830,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, you can flash `/sdcard/Download/acc/acc-uninstaller.zip` or run `mount /system; /data/adb/acc/uninstall.sh`. +From recovery, one can flash `/sdcard/Download/acc/acc-uninstaller.zip` or run `mount /system; /data/adb/acc/uninstall.sh`. ### Charging Switch @@ -868,11 +869,16 @@ That said, the existence of potential voltage/current control file doesn't neces \* Root is not enough. Kernel level permissions forbid write access to certain interfaces. +Sometimes, restoring the default current may not work without a system reboot. +A workaround is setting an absurdly high current value (e.g., 9000 mA). +Don't worry about frying things. +The phone will only draw the max it can take. + ### Diagnostics/Logs Volatile logs (gone on reboot) are stored in `/dev/.acc/`. -Persistent logs: `/data/adb/acc-data/logs/`. +Persistent logs: `/sdcard/Download/acc/logs/`. `/dev/.acc-removed` is created by the uninstaller. The storage location is volatile. @@ -894,7 +900,7 @@ Some users may have to set `switch_delay=15` (or higher) or `charging_switch="/p This can save you a lot of time and grief. -`acc --set --reset`, `acc -sr` or `rm /data/adb/acc-data/config.txt` (failsafe) +`acc --set --reset`, `acc -sr` or `rm /sdcard/Download/acc/config.txt` (failsafe) ### Slow Charging @@ -910,7 +916,7 @@ At least one of the following may be the cause: --- ## POWER SUPPLY LOG (HELP NEEDED) -Please run `acc -le` and upload `/data/adb/acc-data/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/Download/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. @@ -999,7 +1005,7 @@ The default command is "vibrate " Let's assume you want the phone to say _Warning! Battery is low. System will shutdown soon._ To set that up, paste and run the following on a terminal, as root: -`echo -e "\nautoShutdownAlertCmd=('! pgrep -f acc-tts.sh || echo \"Warning! Battery is low. System will shutdown soon.\" > /data/data/com.termux/files/home/acc-fifo')" >> /data/adb/acc-data/config.txt` +`echo -e "\nautoShutdownAlertCmd=('! pgrep -f acc-tts.sh || echo \"Warning! Battery is low. System will shutdown soon.\" > /data/data/com.termux/files/home/acc-fifo')" >> /sdcard/Download/acc/config.txt` That's it. @@ -1135,26 +1141,19 @@ A common workaround is having `resume_capacity = pause_capacity - 1`. e.g., resu --- ## LATEST CHANGES -**v2020.9.01 (202009010)** -- Fixed bug with handling `-u|--upgrade` option. -**v2020.8.24 (202008240)** -- Prevent phone off according to `shutdown_capacity`, if phone was power-on less than 15 minutes ago. +**v2020.9.14 (202009140)** -**v2020.8.6 (202008060)** -- Adaptive --info and --print (config) outputs -- Copy README.md to /sdcard/Download/acc/. -- Fixed "capacity_sync freezes when ghost charging is detected". +- Ensure releae-lock.sh does not cause unwanted acc/d termination. - General fixes & optimizations -- If supported, prepend "$LINENO: " to log lines. -- MTK troubleshooting info (readme > troubleshooting) -- Updated framework (in sync with fbind) - -**v2020.7.26 (202007260)** -- General cleanup and optimizations -- Moved acc files in /sdcard/ to /sdcard/Download/acc/. -- Removed acc-init.sh in favor of service.sh. - -**v2020.7.25 (202007250)** -- Updated documentation -- Workaround for network issues +- mv /data/adb/acc-data /sdcard/Download/acc +- Reapply voltage limits on plug. + +Release Notes + - All persistent acc data is now stored in /sdcard/Download/acc/. + - "mx4pro" users, please send me a new log archive after installing this version. + - Nothing was done in regards to the "MIUI 12" bootloop issue. The root cause is still unknown. + +Unannounced Releases (@romanegunkov) + - v2020.9.01 (202009010): Fixed --upgrade bug. + - v2020.8.24 (202008240): Prevent auto shutdown if system has been running for less than 15 minutes. diff --git a/TODO.txt b/TODO.txt index 0ad52c0..2b747f8 100644 --- a/TODO.txt +++ b/TODO.txt @@ -3,3 +3,19 @@ remove #legacy add custom config for some mtk devices sd=15 switch + +acca should show capacity from dumpsys to prevent confusion + +70% bug, samsung r3q (SM-A908B) + + +potentially fixed + + issues with charge to X once? + + accd killing itself; can't restart + probably caused by set -e and release-lock.sh + + capacity sync issues + + shutdown capacity being set to -1 diff --git a/acc/acc.sh b/acc/acc.sh index b2d3fd2..21f7646 100644 --- a/acc/acc.sh +++ b/acc/acc.sh @@ -131,7 +131,6 @@ exxit() { } echo } - rm /dev/.acc-config 2>/dev/null cd / exit $exitCode } @@ -191,7 +190,7 @@ if ${verbose:-true} && [ -f $execDir/translations/$language/strings.sh ]; then fi grep -q .. $execDir/translations/$language/README.md 2>/dev/null \ && readMe=$execDir/translations/$language/README.md \ - || readMe=$userDir/README.md + || readMe=${config%/*}/README.md # aliases/shortcuts @@ -263,7 +262,7 @@ case "${1-}" in resume_capacity=$(( pause_capacity - 5 )) run_cmd_on_pause="exec /dev/accd" - cp -f $config $TMPDIR/.acc-f-config + grep -Ev '^$|^#' $config > $TMPDIR/.acc-f-config config=$TMPDIR/.acc-f-config . $execDir/write-config.sh print_charging_enabled_until ${2:-100}% @@ -380,8 +379,8 @@ case "${1-}" in . $execDir/acquire-lock.sh - cp $config /dev/.acc-config - config=/dev/.acc-config + grep -Ev '^$|^#' $config > $TMPDIR/.config + config=$TMPDIR/.config fd3=true exec 3>&1 diff --git a/acc/acca.sh b/acc/acca.sh index 236fc80..783cc4b 100644 --- a/acc/acca.sh +++ b/acc/acca.sh @@ -25,17 +25,12 @@ cd /data/adb/acc/ export TMPDIR=/dev/.acc verbose=false . ./setup-busybox.sh -userDir=/sdcard/Download/acc -config=/data/adb/acc-data/config.txt +config=/sdcard/Download/acc/config.txt defaultConfig=$PWD/default-config.txt -mkdir -p ${config%/*} $userDir || : +mkdir -p ${config%/*} 2>/dev/null || : [ -f $config ] || cp $defaultConfig $config -# config backup -! test $config -nt $userDir/.acc-config-backup.txt \ - || cp -f $config $userDir/.acc-config-backup.txt - # custom config path case "${1-}" in */*) diff --git a/acc/accd.sh b/acc/accd.sh index ec02499..7757ba3 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 10 + sleep 30 done } @@ -35,8 +35,8 @@ if [ -f $TMPDIR/.config-ver ] && ! $init; then ### trap - EXIT vibrate() { :; } { dumpsys battery reset & - cp $config /dev/.${id}-config - config=/dev/.${id}-config + grep -Ev '^$|^#' $config > $TMPDIR/.config + config=$TMPDIR/.config enable_charging & apply_on_boot default & apply_on_plug default & @@ -340,8 +340,9 @@ else # log - mkdir -p $TMPDIR /data/adb/${id}-data/logs - exec > /data/adb/${id}-data/logs/init.log 2>&1 + data_dir=/sdcard/Download/$id + mkdir -p $TMPDIR $data_dir/logs + exec > $data_dir/logs/init.log 2>&1 set -x @@ -432,7 +433,7 @@ else while read file; do chmod u+r $file 2>/dev/null || continue defaultValue=$(cat $file) - ampFactor=$(sed -n 's/^ampFactor=//p' /data/adb/${id}-data/config.txt 2>/dev/null) + ampFactor=$(sed -n 's/^ampFactor=//p' $data_dir/config.txt 2>/dev/null) [ -n "$ampFactor" -o $defaultValue -ne 0 ] && { if [ "${ampFactor:-1}" -eq 1000 -o $defaultValue -lt 10000 ]; then # milliamps diff --git a/acc/logf.sh b/acc/logf.sh index 4bf65e5..5485416 100644 --- a/acc/logf.sh +++ b/acc/logf.sh @@ -28,12 +28,12 @@ logf() { batt_info > $TMPDIR/acc-i.txt) dumpsys battery > dumpsys-battery.txt - userDir=/sdcard/Download/acc - mkdir -p $userDir - tar -c *.log *.txt | bzip2 -9 > $userDir/acc-logs-$device.tar.bz2 + data_dir=/sdcard/Download/acc + mkdir -p $data_dir + tar -c *.log *.txt | bzip2 -9 > $data_dir/acc-logs-$device.tar.bz2 rm *.txt magisk.log in*.log power*.log m*accapp.log 2>/dev/null - echo "(i) $userDir/acc-logs-$device.tar.bz2" + echo "(i) $data_dir/acc-logs-$device.tar.bz2" else if [[ "${1:-x}" = -*a* ]]; then diff --git a/acc/misc-functions.sh b/acc/misc-functions.sh index 3bb5473..bfc1de6 100644 --- a/acc/misc-functions.sh +++ b/acc/misc-functions.sh @@ -21,7 +21,7 @@ apply_on_boot() { apply_on_plug() { local entry="" file="" value="" default="" arg=${1:-value} - for entry in "${applyOnPlug[@]-}" "${maxChargingCurrent[@]-}"; do + for entry in "${applyOnPlug[@]-}" "${maxChargingCurrent[@]-}" "${maxChargingVoltage[@]-}"; do set -- ${entry//::/ } file=${1-} value=${2-} @@ -246,13 +246,9 @@ enable_charging() { misc_stuff() { set -eu - mkdir -p ${config%/*} $userDir || : + mkdir -p ${config%/*} 2>/dev/null || : [ -f $config ] || cp $execDir/default-config.txt $config - # config backup - ! test $config -nt $userDir/.acc-config-backup.txt \ - || cp -f $config $userDir/.acc-config-backup.txt - # custom config path case "${1-}" in */*) @@ -326,8 +322,7 @@ id=acc umask 0077 execDir=/data/adb/acc export TMPDIR=/dev/.acc -userDir=/sdcard/Download/$id -config=/data/adb/acc-data/config.txt +config=/sdcard/Download/$id/config.txt config_=$config [ -f $TMPDIR/.ghost-charging ] \ diff --git a/acc/power-supply-logger.sh b/acc/power-supply-logger.sh index da6b898..7f47a03 100644 --- a/acc/power-supply-logger.sh +++ b/acc/power-supply-logger.sh @@ -39,7 +39,7 @@ gather_ps_data() { export TMPDIR=/dev/.acc execDir=/data/adb/acc -logsDir=/data/adb/acc-data/logs +logsDir=/sdcard/Download/acc/logs print_wait 2>/dev/null || echo "(i) Alright, this may take a minute or so..." diff --git a/acc/release-lock.sh b/acc/release-lock.sh index 5277736..19f141c 100644 --- a/acc/release-lock.sh +++ b/acc/release-lock.sh @@ -1,9 +1,9 @@ #!/system/bin/sh id=acc (pid= -set +o sh 2>/dev/null || : +set +euo sh 2>/dev/null || : flock -n 0 || { read pid kill $pid timeout 15 flock 0 || kill -KILL $pid -}) <>$TMPDIR/${id}.lock +}) <>$TMPDIR/${id}.lock || : diff --git a/acc/select.sh b/acc/select.sh index 7213a91..fae957e 100644 --- a/acc/select.sh +++ b/acc/select.sh @@ -6,7 +6,6 @@ # . $0 # select_ # -# "#" is an argument for read -n (optional). # ${PS3:-#?} is used. diff --git a/acc/strings.sh b/acc/strings.sh index 23ace25..f1d03b3 100644 --- a/acc/strings.sh +++ b/acc/strings.sh @@ -215,7 +215,7 @@ Options -s|--set r|--reset Restore default config e.g., acc -s r - rm /data/adb/acc-data/config.txt (failsafe) + rm /sdcard/Download/acc/config.txt (failsafe) -sr Same as above @@ -299,12 +299,13 @@ Exit Codes Tips Commands can be chained for extended functionality. - e.g., acc -e 30m && acc -d 6h && acc -e 85 && accd (recharge for 30 minutes, pause charging for 6 hours, recharge to 85% capacity and restart the daemon) + e.g., charge for 30 minutes, pause charging for 6 hours, charge to 85% and restart the daemon + acc -e 30m && acc -d 6h && acc -e 85 && accd Bedtime settings... acc -s /dev/.my-night-config.txt pc=45 rc=43 mcc=500 mcv=3920 && sleep \$((60*60*7)) && accd - "For the next 7 hours, keep battery capacity between 43-45%, limit charging current to 500 mA and voltage to 3920 millivolts" - - For convenience, this can be written to a file and ran as "sh /path/to/file". + - For convenience, this can be written to a file and ran as "su -c sh /path/to/file". Refer to acc -r (or --readme) for the full documentation (recommended) EOF diff --git a/acc/uninstall.sh b/acc/uninstall.sh index f25745e..977f4d5 100644 --- a/acc/uninstall.sh +++ b/acc/uninstall.sh @@ -44,7 +44,7 @@ mkdir -p $TMPDIR/$id timeout 15 flock 0 || kill -KILL $pid }) <>$TMPDIR/${id}.lock ### -pgrep -f "/($id|${id}a) (-|--)[det]|/${id}d" > /dev/null && { # legacy +pgrep -f "/($id|${id}a) (-|--)[det]|/${id}d" > /dev/null && { #legacy pkill -f "/($id|${id}a) (-|--)[det]|/${id}d" for count in $(seq 15); do sleep 1 @@ -60,10 +60,11 @@ rm -rf $(readlink -f /data/adb/$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 "/data/adb/${id}-data /sdcard/Download/$id") + $(test "${1:-}" = install || echo "/sdcard/Download/$id") #legacy -rm $(readlink -f /sbin/.$id/$id) \ +rm /data/adb/${id}-data \ + $(readlink -f /sbin/.$id/$id) \ /data/media/0/${id}-logs-*.tar.* \ /data/media/0/${id}-uninstaller.zip \ /data/media/0/.${id}-config-backup.txt 2>/dev/null diff --git a/bin/acc-uninstaller.zip b/bin/acc-uninstaller.zip index d6bcd3b..06e16f6 100644 Binary files a/bin/acc-uninstaller.zip and b/bin/acc-uninstaller.zip differ diff --git a/customize.sh b/customize.sh index 65333e8..db1deba 100644 --- a/customize.sh +++ b/customize.sh @@ -13,13 +13,14 @@ SKIPUNZIP=1 echo id=acc umask 0077 +data_dir=/sdcard/Download/$id # log [ -z "${LINENO-}" ] || export PS4='$LINENO: ' -mkdir -p /data/adb/${id}-data/logs -chmod -R 0700 /data/adb/${id}-data/logs -exec 2>/data/adb/${id}-data/logs/install.log +mkdir -p $data_dir/logs +chmod -R 0700 $data_dir/logs +exec 2>$data_dir/logs/install.log set -x @@ -102,11 +103,10 @@ srcDir=${srcDir/#"${0##*/}"/"."} name=$(get_prop name) author=$(get_prop author) version=$(get_prop version) -userDir=/sdcard/Download/$id magiskModDir=/data/adb/modules versionCode=$(get_prop versionCode) : ${installDir:=/data/data/mattecarra.${id}app/files} ### -config=/data/adb/${id}-data/config.txt +config=$data_dir/config.txt [ -d $magiskModDir ] && magisk=true || magisk=false @@ -141,12 +141,17 @@ GPLv3+ (i) Installing in $installDir/$id/..." +# 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 || : + + /system/bin/sh $srcDir/$id/uninstall.sh install cp -R $srcDir/$id/ $installDir/ installDir=$(readlink -f $installDir/$id) cp $srcDir/module.prop $installDir/ -mkdir -p $userDir -cp -f $srcDir/README.md $userDir/ +cp -f $srcDir/README.md $data_dir/ ### @@ -195,12 +200,8 @@ fi [ $installDir = /data/adb/$id ] || ln -s $installDir /data/adb/ -# restore config backup -[ -f $config ] || cp $userDir/.${id}-config-backup.txt $config 2>/dev/null || : - - # install binaries -cp -f $srcDir/bin/${id}-uninstaller.zip $userDir/ +cp -f $srcDir/bin/${id}-uninstaller.zip $data_dir/ # Termux, fix shebang @@ -214,7 +215,6 @@ cp -f $srcDir/bin/${id}-uninstaller.zip $userDir/ # set perms -set_perms_recursive ${config%/*} case $installDir in /data/*/files/*$id) pkg=${installDir%/files/*$id} diff --git a/install-online.sh b/install-online.sh index 106d4dc..bb13380 100644 --- a/install-online.sh +++ b/install-online.sh @@ -15,11 +15,12 @@ set +x echo id=acc umask 0077 +data_dir=/sdcard/Download/$id # log [ -z "${LINENO-}" ] || export PS4='$LINENO: ' -mkdir -p /data/adb/${id}-data/logs -exec 2>/data/adb/${id}-data/logs/install-online.sh.log +mkdir -p $data_dir/logs +exec 2>$data_dir/logs/install-online.sh.log set -x trap 'e=$?; echo; exit $e' EXIT diff --git a/install-tarball.sh b/install-tarball.sh index 9b14ae2..4ccd2fc 100644 --- a/install-tarball.sh +++ b/install-tarball.sh @@ -5,11 +5,12 @@ id=acc umask 0077 +data_dir=/sdcard/Download/${1:-$id} # log [ -z "${LINENO-}" ] || export PS4='$LINENO: ' -mkdir -p /data/adb/${1:-$id}-data/logs -exec 2>/data/adb/${1:-$id}-data/logs/install-tarball.sh.log +mkdir -p $data_dir/logs +exec 2>$data_dir/logs/install-tarball.sh.log set -x # set up busybox @@ -55,7 +56,7 @@ copy_log() { umask 077 mkdir -p logs - cp -af /data/adb/${1:-$id}-data/logs/install.log logs/${1:-$id}-install.log 2>/dev/null || return 0 + cp -af $data_dir/logs/install.log logs/${1:-$id}-install.log 2>/dev/null || return 0 pkg=$(cd ..; pwd) pkg=${pkg##/data*/} diff --git a/install.sh b/install.sh index 65333e8..db1deba 100644 --- a/install.sh +++ b/install.sh @@ -13,13 +13,14 @@ SKIPUNZIP=1 echo id=acc umask 0077 +data_dir=/sdcard/Download/$id # log [ -z "${LINENO-}" ] || export PS4='$LINENO: ' -mkdir -p /data/adb/${id}-data/logs -chmod -R 0700 /data/adb/${id}-data/logs -exec 2>/data/adb/${id}-data/logs/install.log +mkdir -p $data_dir/logs +chmod -R 0700 $data_dir/logs +exec 2>$data_dir/logs/install.log set -x @@ -102,11 +103,10 @@ srcDir=${srcDir/#"${0##*/}"/"."} name=$(get_prop name) author=$(get_prop author) version=$(get_prop version) -userDir=/sdcard/Download/$id magiskModDir=/data/adb/modules versionCode=$(get_prop versionCode) : ${installDir:=/data/data/mattecarra.${id}app/files} ### -config=/data/adb/${id}-data/config.txt +config=$data_dir/config.txt [ -d $magiskModDir ] && magisk=true || magisk=false @@ -141,12 +141,17 @@ GPLv3+ (i) Installing in $installDir/$id/..." +# 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 || : + + /system/bin/sh $srcDir/$id/uninstall.sh install cp -R $srcDir/$id/ $installDir/ installDir=$(readlink -f $installDir/$id) cp $srcDir/module.prop $installDir/ -mkdir -p $userDir -cp -f $srcDir/README.md $userDir/ +cp -f $srcDir/README.md $data_dir/ ### @@ -195,12 +200,8 @@ fi [ $installDir = /data/adb/$id ] || ln -s $installDir /data/adb/ -# restore config backup -[ -f $config ] || cp $userDir/.${id}-config-backup.txt $config 2>/dev/null || : - - # install binaries -cp -f $srcDir/bin/${id}-uninstaller.zip $userDir/ +cp -f $srcDir/bin/${id}-uninstaller.zip $data_dir/ # Termux, fix shebang @@ -214,7 +215,6 @@ cp -f $srcDir/bin/${id}-uninstaller.zip $userDir/ # set perms -set_perms_recursive ${config%/*} case $installDir in /data/*/files/*$id) pkg=${installDir%/files/*$id} diff --git a/module.prop b/module.prop index 4c223ce..a2986eb 100644 --- a/module.prop +++ b/module.prop @@ -1,6 +1,6 @@ id=acc name=Advanced Charging Controller (ACC) -version=v2020.9.01 -versionCode=202009010 +version=v2020.9.14 +versionCode=202009140 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.