MatteCarra / AccA

Acc app allows to edit acc config file and add a tile to start and stop acc deamon
GNU General Public License v3.0
1.19k stars 85 forks source link

There may be a mistake in install-current.sh #82

Closed cEvolve05 closed 4 years ago

cEvolve05 commented 4 years ago

I am sorry. Because I am not very good at English and I can't reply in time. Can you forgive me? Think you very much!

Pixel XL Android 10 ACCA 1.0.20

Before I modify install-current.sh. It said that Failed to install. logs:

+ trap 'e=$?; echo; exit $e' EXIT
+ '[' -d /sbin/.magisk/busybox ']'
+ id -u
+ '[' 0 -ne 0 ']'
+ set -euo pipefail
+ '[' -f /data/data/mattecarra.accapp/files/install-current.sh ']'
+ srcDir=acc-201910132 
+ '[' ! -f acc-201910132/module.prop ']'
+ print name
+ sed -n 's|^name=||p' acc-201910132/module.prop
+ name='Advanced Charging Controller (acc)' 
+ print author
+ sed -n 's|^author=||p' acc-201910132/module.prop
+ author='VR25 (xda-developers.com)' 
+ print version
+ sed -n 's|^version=||p' acc-201910132/module.prop
+ version=2019.10.13-r2-dev 
+ print versionCode
+ sed -n 's|^versionCode=||p' acc-201910132/module.prop
+ versionCode=201910132 
+ installDir=/data/data/mattecarra.accapp/files 
+ config=/data/media/0/acc/acc.conf 
+ '[' -f /data/media/0/acc/acc.conf ']'
+ 2>/dev/null 
+ mv /data/media/0/acc/config.txt /data/media/0/acc/acc.conf
+ :
+ '[' -d /data/media/0/acc ']'
+ config=/data/adb/acc-data/config.txt 
+ '[' -f /data/adb/acc-data/config.txt ']'
+ 2>/dev/null 
+ print versionCode /data/adb/acc-data/config.txt
+ sed -n 's|^versionCode=||p' /data/adb/acc-data/config.txt
+ configVer=201910130 
+ '[' -d /data/data/mattecarra.accapp/files ']'
+ '[' -d /data/data/mattecarra.accapp/files ']'
+ '[' -d /data/data/mattecarra.accapp/files ']'
+ '[' -d /data/data/mattecarra.accapp/files ']'
+ <<EOF 
+ cat
+ pkill -9 -f '/acc (-|--)|/accd.sh'
+ readlink -f /sbin/.acc/acc
+ 2>/dev/null 
+ rm -rf /data/data/mattecarra.accapp/files/acc /data/data/mattecarra.accapp/files/acc
+ cp -R acc-201910132/acc/ /data/data/mattecarra.accapp/files/
+ installDir=/data/data/mattecarra.accapp/files/acc 
+ '[' x '==' x ']'
+ installDir0=/data/data/mattecarra.accapp/files/acc 
+ cp acc-201910132/module.prop /data/data/mattecarra.accapp/files/acc/
cp: /data/data/mattecarra.accapp/files/acc/: Is a directory
+ e=1 
+ echo
+ exit 1

After that, I found that there may be a mistake in install-current.sh in line 111-113

cp -R $srcDir/$id/ $installDir/
installDir=$installDir/$id
[ ${installDir0:-x} == x ] && installDir0=/data/data/mattecarra.accapp/files/$id || installDir0=$installDir0/$id

After I put cp -R $srcDir/$id/ $installDir/ underinstallDir=$installDir/$id [ ${installDir0:-x} == x ] && installDir0=/data/data/mattecarra.accapp/files/$id || installDir0=$installDir0/$id It works well. Is it a bug? Will it be fixed?

VR-25 commented 4 years ago
+ cp acc-201910132/module.prop /data/data/mattecarra.accapp/files/acc/
cp: /data/data/mattecarra.accapp/files/acc/: Is a directory
+ e=1 
+ echo
+ exit 1

That's the problematic part. However, the logic is not wrong. Besides, I would have stumbled across it, too. Something else is not right - and it may be on your side only.

Your arrangement breaks the installation logic (files are misplaced).

Anyway, I'll keep an eye on this. Thanks