Skip to content

Commit

Permalink
**2020.4.4-dev (202004040)**
Browse files Browse the repository at this point in the history
- acc -(e|d): do not do unnecessary work
- acc -f: fixed capacity limit bypass
- acc -F: general fixes and optimizations
- accs: acc foreground service, works exactly as accd, but remains attached to the terminal
- "acc -t --" is now "acc -t"
- ACC/service trigger vibrations on certain events (charging enabled/disabled, errors, auto-shutdown warnings and acc -C 100% reached); vibration patterns are customizable
- Auto-reset broken/invalid config
- Enhanced acc -C compatibility
- Fixed busybox setup issues on devices not rooted with Magisk
- Misc fixes
- Major optimizations
- Updated documentation
  • Loading branch information
VR-25 committed Apr 4, 2020
1 parent 4efbfca commit 24f11c6
Show file tree
Hide file tree
Showing 31 changed files with 793 additions and 633 deletions.
13 changes: 13 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: VR25 # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: VR25 # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: https://paypal.me/vr25xda/ # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

60 changes: 39 additions & 21 deletions META-INF/com/google/android/update-binary
Original file line number Diff line number Diff line change
@@ -1,26 +1,40 @@
#!/system/bin/sh
# $id Installer/Upgrader
# ACC Installer/Upgrader
# Copyright (c) 2019-2020, VR25 (xda-developers)
# License: GPLv3+
#
# devs: triple hashtags (###) mark custom code


set +x

# override the official Magisk module installer
SKIPUNZIP=1


echo
id=acc
umask 077


# log
mkdir -p /data/adb/${id}-data/logs
chmod -R 700 /data/adb/${id}-data/logs
exec 2>/data/adb/${id}-data/logs/install.log
set -x

trap 'e=$?; echo; exit $e' EXIT

exxit() {
local e=$?
set +eo pipefail
rm -rf /dev/.${id}-install
[ $e -ne 0 ] && echo || {
rm /sbin/.$id/.ghost-charging ###
/sbin/acca --daemon > /dev/null || /sbin/accd ### workaround, Magisk 20.4+
}
exit $e
} 2>/dev/null

trap exxit EXIT


# set up busybox
#BB#
Expand All @@ -34,16 +48,16 @@ else
chmod 700 /dev/.busybox
case $PATH in
/dev/.busybox:*) :;;
*) PATH=/dev/busybox:$PATH;;
*) PATH=/dev/.busybox:$PATH;;
esac
[ -x /dev/.busybox/busybox ] || {
if [ -f /data/adb/magisk/busybox ]; then
[ -x /data/adb/magisk/busybox ] || chmod 700 /data/adb/magisk/busybox
[ -x /data/adb/magisk/busybox ] || chmod 700 /data/adb/magisk/busybox
/data/adb/magisk/busybox --install -s /dev/.busybox
elif which busybox > /dev/null; then
busybox --install -s /dev/.busybox
elif [ -f /data/adb/busybox ]; then
[ -x /data/adb/busybox ] || chmod 700 /data/adb/busybox
[ -x /data/adb/busybox ] || chmod 700 /data/adb/busybox
/data/adb/busybox --install -s /dev/.busybox
else
echo "(!) Install busybox or simply place it in /data/adb/"
Expand All @@ -53,12 +67,14 @@ else
fi
#/BB#


# root check
[ $(id -u) -ne 0 ] && {
echo "(!) $0 must run as root (su)"
exit 4
}


get_prop() { sed -n "s|^$1=||p" ${2:-$srcDir/module.prop}; }

set_perms() {
Expand All @@ -70,31 +86,35 @@ set_perms() {
}

set_perms_recursive() {
local owner=${2:-0} target=""
local owner=${2-0} target=""
find $1 2>/dev/null | while read target; do set_perms $target $owner; done
}

set -euo pipefail 2>/dev/null || :


# set source code directory
[ -f $PWD/${0##*/} ] && srcDir=$PWD || srcDir=${0%/*}
srcDir=${srcDir/#"${0##*/}"/"."}

# unzip flashable zip if source code is unavailable

# extract flashable zip if source code is unavailable
[ -f $srcDir/module.prop ] || {
srcDir=/dev/.tmp
srcDir=/dev/.${id}-install
rm -rf $srcDir 2>/dev/null || :
mkdir $srcDir
unzip ${ZIP:-${3-}} -d $srcDir/ >&2
unzip "$3" -d $srcDir/ >&2
}


name=$(get_prop name)
author=$(get_prop author)
version=$(get_prop version)
versionCode=$(get_prop versionCode)
installDir=${installDir0:=/data/data/mattecarra.${id}app/files} ###
config=/data/adb/${id}-data/config.txt


# check/set parent installation directory
[ -d $installDir ] || installDir=/sbin/.magisk/modules
[ -d $installDir ] || installDir=/data/adb
Expand All @@ -103,16 +123,15 @@ config=/data/adb/${id}-data/config.txt

###
echo "$name $version ($versionCode)
Copyright (c) 2017-2020, $author
License: GPLv3+
© 2017-2020, $author
GPLv3+
(i) Installing in $installDir/$id/..."


# install
cp $config /data/.${id}-config-bkp 2>/dev/null || :
ash $srcDir/$id/uninstall.sh
mv /data/.${id}-config-bkp $config 2>/dev/null || :
ash $srcDir/$id/uninstall.sh install
rm /data/adb/${id}-data/logs/bootlooped 2>/dev/null || :
cp -R $srcDir/$id/ $installDir/
installDir=$(readlink -f $installDir/$id)
installDir0=$installDir0/$id
Expand Down Expand Up @@ -165,12 +184,15 @@ fi
# disable magic mount (Magisk)
touch /sbin/.magisk/modules/$id/skip_mount 2>/dev/null || :


# restore config backup
[ -f $config ] || cp /data/media/0/.${id}-config-backup.txt $config 2>/dev/null || :


# flashable uninstaller
cp -f $srcDir/bin/${id}-uninstaller.zip /data/media/0/


# set perms
set_perms_recursive ${config%/*}
chmod 666 /data/media/0/${id}-uninstaller.zip
Expand All @@ -186,6 +208,7 @@ case $installDir in
;;
esac


set +euo pipefail 2>/dev/null || :


Expand All @@ -212,7 +235,6 @@ echo "
[ $installDir == /data/adb ] && echo -e "\n(i) Use init.d or an app to run $installDir/${id}-init.sh on boot to initialize ${id}."

echo
trap - EXIT

# initialize $id
if [ -f $installDir/service.sh ]; then
Expand All @@ -221,8 +243,4 @@ else
$installDir/${id}-init.sh --override
fi

e=$?
[ $e -eq 0 ] || { echo; exit $e; }
rm /sbin/.$id/.ghost-charging 2>/dev/null ###
/sbin/acca --daemon > /dev/null || /sbin/accd ### workaround, Magisk 20.4+
exit 0
Loading

0 comments on commit 24f11c6

Please sign in to comment.