Skip to content

Commit

Permalink
**v2021.8.26 (202108260)**
Browse files Browse the repository at this point in the history
- Fixed daemon startup issue.
- Updated framework (it uses acc's) and documentation
  • Loading branch information
VR-25 committed Aug 26, 2021
1 parent c95d67a commit 9a8d2c2
Show file tree
Hide file tree
Showing 8 changed files with 224 additions and 113 deletions.
59 changes: 36 additions & 23 deletions META-INF/com/google/android/update-binary
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ SKIPUNZIP=1
echo
id=djs
domain=vr25
umask 0077
data_dir=/data/adb/$domain/${id}-data


Expand Down Expand Up @@ -71,25 +70,27 @@ esac
get_prop() { sed -n "s|^$1=||p" ${2:-$srcDir/module.prop}; }

set_perms() {
local owner=${2:-0} perms=0600 target=$(readlink -f $1)
local owner=${2:-0}
local perms=0600
local target
target=$(readlink -f $1)
if echo $target | grep -q '.*\.sh$' || [ -d $target ]; then perms=0700; fi
chmod $perms $target
chown $owner:$owner $target
chcon u:object_r:system_file:s0 $target
chcon u:object_r:system_file:s0 $target 2>/dev/null || :
}

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

set -eu


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

srcDir="$(cd "${0%/*}" 2>/dev/null || :; echo "$PWD")"

# extract flashable zip if source code is unavailable
[ -f $srcDir/module.prop ] || {
Expand All @@ -110,14 +111,27 @@ accaFiles=/data/data/mattecarra.accapp/files ###
config=$data_dir/config.txt


# install in front-end's internal path by default
if [ "$installDir" != "$accaFiles" ]; then
case "$installDir" in
/data/data/*|/data/user/*)
accaFiles="$installDir"
;;
esac
fi


[ -d $magiskModDir ] && magisk=true || magisk=false
ls -d ${accaFiles%/*}* > /dev/null 2>&1 && acca=true || acca=false ###


# ensure AccA's files/ exists - to prevent unwanted downgrades ###
if $acca && [ ! -d $accaFiles ]; then
mkdir -p $accaFiles
chmod 0777 ${accaFiles%/*} $accaFiles
if mkdir $accaFiles 2>/dev/null; then
chown $(stat -c %u:%g ${accaFiles%/*}) $accaFiles
chmod $(stat -c %a ${accaFiles%/*}) $accaFiles
/system/bin/restorecon $accaFiles
fi
fi


Expand Down Expand Up @@ -209,30 +223,29 @@ cp -f $srcDir/bin/${id}-uninstaller.zip $data_dir/


# Termux, fix shebang
[[ $installDir != *com.termux* ]] && termux=false || {
termux=true
for f in $installDir/*.sh; do
! grep -q '^#\!/.*/sh' $f \
|| sed -i 's|^#!/.*/sh|#!/data/data/com.termux/files/usr/bin/bash|' $f
done
}
termux=false
case "$installDir" in
*/com.termux*)
termux=true
for f in $installDir/*.sh; do
! grep -q '^#\!/.*/sh' $f \
|| sed -i 's|^#!/.*/sh|#!/data/data/com.termux/files/usr/bin/bash|' $f
done
;;
esac


# set perms
case $installDir in
/data/*/files/*$id)
pkg=${installDir%/files/*$id}
pkg=${pkg##/data*/}
owner=$(grep $pkg /data/system/packages.list | cut -d ' ' -f 2)
set_perms_recursive $installDir $owner
/data/data/*|/data/user/*)
set_perms_recursive $installDir $(stat -c %u ${installDir%/$id})

# Termux:Boot
! $termux || {
mkdir -p ${installDir%/*}/.termux/boot
ln -sf $installDir/service.sh ${installDir%/*}/.termux/boot/${id}-init.sh
chown -R $(stat -c %u:%g /data/data/com.termux) ${installDir%/*}/.termux
chmod -R 0755 ${installDir%/*}/.termux
/system/bin/restorecon -R ${installDir%/*}/.termux > /dev/null 2>&1
/system/bin/restorecon -R ${installDir%/*}/.termux > /dev/null 2>&1 || :
}
;;
*)
Expand Down
54 changes: 44 additions & 10 deletions README.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<h1 id="daily-job-scheduler-djs">Daily Job Scheduler (DJS)</h1>
<ul>
<li><a href="#description">DESCRIPTION</a></li>
<li><a href="#legal">LEGAL</a></li>
<li><a href="#license">LICENSE</a></li>
<li><a href="#disclaimer">DISCLAIMER</a></li>
<li><a href="#warning">WARNING</a></li>
<li><a href="#donations">DONATIONS</a></li>
Expand All @@ -49,7 +49,12 @@ <h1 id="daily-job-scheduler-djs">Daily Job Scheduler (DJS)</h1>
<li><a href="#terminal-commands">Terminal Commands</a></li>
</ul>
</li>
<li><a href="#notestips-for-front-end-developers">NOTES/TIPS FOR FRONT-END DEVELOPERS</a></li>
<li><a href="#notestips-for-front-end-developers">NOTES/TIPS FOR FRONT-END DEVELOPERS</a>
<ul>
<li><a href="#basics">Basics</a></li>
<li><a href="#initializing-djs">Initializing DJS</a></li>
</ul>
</li>
<li><a href="#frequently-asked-questions-faq">FREQUENTLY ASKED QUESTIONS (FAQ)</a></li>
<li><a href="#links">LINKS</a></li>
<li><a href="#latest-changes">LATEST CHANGES</a></li>
Expand All @@ -60,7 +65,7 @@ <h2 id="description">DESCRIPTION</h2>
Any root solution is supported.
The installation is always &quot;systemless&quot;, whether or not the system is rooted with Magisk.</p>
<hr>
<h2 id="legal">LEGAL</h2>
<h2 id="license">LICENSE</h2>
<p>Copyright (C) 2019-2021, VR25</p>
<p>This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand All @@ -71,7 +76,7 @@ <h2 id="legal">LEGAL</h2>
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.</p>
<p>You should have received a copy of the GNU General Public License
along with this program. If not, see <a href="https://www.gnu.org/licenses/">https://www.gnu.org/licenses/</a>.</p>
along with this program. If not, see <a href="https://www.gnu.org/licenses/">https://www.gnu.org/licenses/</a>.</p>
<hr>
<h2 id="disclaimer">DISCLAIMER</h2>
<p>Always read/reread this reference prior to installing/upgrading this software.</p>
Expand Down Expand Up @@ -167,19 +172,47 @@ <h3 id="terminal-commands">Terminal Commands</h3>
</div></code></code></pre>
<hr>
<h2 id="notestips-for-front-end-developers">NOTES/TIPS FOR FRONT-END DEVELOPERS</h2>
<h3 id="basics">Basics</h3>
<p>DJS does not require Magisk.
Any root solution is fine.</p>
<p>Use <code>/dev/.vr25/djs/*</code> over regular commands.
These are guaranteed to be readily available after installation/initialization.</p>
These are guaranteed to be readily available after installation/upgrades.</p>
<p>It may be best to use long options over short equivalents - e.g., <code>/dev/.vr25/djs/djs-config --list</code>, instead of <code>/dev/.vr25/djs/djsc -l</code>.
This makes code more readable (less cryptic).</p>
<p>Include provided descriptions of DJS features/settings in your app(s).
Provide additional information (trusted) where appropriate.
Explain settings/concepts as clearly and with as few words as possible.</p>
<h3 id="initializing-djs">Initializing DJS</h3>
<p>DJS is automatically initialized after installation/upgrades.
It needs to be initialized on boot, too.
If it's installed as a Magisk module, this is done by Magisk itself.
Otherwise, the front-end should handle it as follows:</p>
<pre><code><code><div>on boot_completed receiver and main activity
if file /dev/.acca/started does NOT exist
create it
mkdir -p /dev/.acca
touch /dev/.acca/started
if accd is NOT running
launch it
/data/adb/vr25/djs/service.sh
else
do nothing
else
do nothing
</div></code></code></pre>
<p><code>/dev/</code> is volatile - meaning, a reboot/shutdown clears <code>/dev/.acca/</code> and its contents.
That's exactly what we want.
Of course, <code>/dev/.acca/started</code> is just an example.
One can use any random path (e.g., <code>.myapp/initialized</code>), as long as it's under <code>/dev/</code> and does not conflict with preexisting data.
<strong>WARNING</strong>: do not play with preexisting /dev/ data!
Doing so may result in data loss and/or other undesired outcome.</p>
<hr>
<h2 id="frequently-asked-questions-faq">FREQUENTLY ASKED QUESTIONS (FAQ)</h2>
<blockquote>
<p>How do I report issues?</p>
</blockquote>
<p>Open issues on GitHub or contact the developer on Telegram/XDA (linked below). Always provide as much information as possible.</p>
<p>Open issues on GitHub or contact the developer on Telegram/XDA (linked below).
Always provide as much information as possible.</p>
<blockquote>
<p>Where do I find daemon logs?</p>
</blockquote>
Expand All @@ -197,10 +230,6 @@ <h2 id="links">LINKS</h2>
</ul>
<hr>
<h2 id="latest-changes">LATEST CHANGES</h2>
<p><strong>v2021.8.2 (202108020)</strong></p>
<ul>
<li>Fixed AccA related issues.</li>
</ul>
<p><strong>v2021.8.9.1 (202108091)</strong></p>
<ul>
<li>Rewritten daemon logic for better efficiency and reliability.</li>
Expand All @@ -212,6 +241,11 @@ <h2 id="latest-changes">LATEST CHANGES</h2>
<li>General fixes</li>
<li>Major optimizations</li>
<li>Updated documentation: now with a table of contents and available in HTML format.</li>
</ul>
<p><strong>v2021.8.26 (202108260)</strong></p>
<ul>
<li>Fixed daemon startup issue.</li>
<li>Updated framework (it uses acc's) and documentation</li>
</ul>

</body>
Expand Down
58 changes: 48 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


- [DESCRIPTION](#description)
- [LEGAL](#legal)
- [LICENSE](#license)
- [DISCLAIMER](#disclaimer)
- [WARNING](#warning)
- [DONATIONS](#donations)
Expand All @@ -12,6 +12,8 @@
- [USAGE](#usage)
- [Terminal Commands](#terminal-commands)
- [NOTES/TIPS FOR FRONT-END DEVELOPERS](#notestips-for-front-end-developers)
- [Basics](#basics)
- [Initializing DJS](#initializing-djs)
- [FREQUENTLY ASKED QUESTIONS (FAQ)](#frequently-asked-questions-faq)
- [LINKS](#links)
- [LATEST CHANGES](#latest-changes)
Expand All @@ -26,7 +28,7 @@ The installation is always "systemless", whether or not the system is rooted wit


---
## LEGAL
## LICENSE

Copyright (C) 2019-2021, VR25

Expand All @@ -41,7 +43,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
along with this program. If not, see <https://www.gnu.org/licenses/>.


---
Expand Down Expand Up @@ -164,8 +166,14 @@ The first directory holds user executables.
---
## NOTES/TIPS FOR FRONT-END DEVELOPERS


### Basics

DJS does not require Magisk.
Any root solution is fine.

Use `/dev/.vr25/djs/*` over regular commands.
These are guaranteed to be readily available after installation/initialization.
These are guaranteed to be readily available after installation/upgrades.

It may be best to use long options over short equivalents - e.g., `/dev/.vr25/djs/djs-config --list`, instead of `/dev/.vr25/djs/djsc -l`.
This makes code more readable (less cryptic).
Expand All @@ -175,13 +183,42 @@ Provide additional information (trusted) where appropriate.
Explain settings/concepts as clearly and with as few words as possible.


### Initializing DJS

DJS is automatically initialized after installation/upgrades.
It needs to be initialized on boot, too.
If it's installed as a Magisk module, this is done by Magisk itself.
Otherwise, the front-end should handle it as follows:
```
on boot_completed receiver and main activity
if file /dev/.acca/started does NOT exist
create it
mkdir -p /dev/.acca
touch /dev/.acca/started
if accd is NOT running
launch it
/data/adb/vr25/djs/service.sh
else
do nothing
else
do nothing
```
`/dev/` is volatile - meaning, a reboot/shutdown clears `/dev/.acca/` and its contents.
That's exactly what we want.
Of course, `/dev/.acca/started` is just an example.
One can use any random path (e.g., `.myapp/initialized`), as long as it's under `/dev/` and does not conflict with preexisting data.
**WARNING**: do not play with preexisting /dev/ data!
Doing so may result in data loss and/or other undesired outcome.


---
## FREQUENTLY ASKED QUESTIONS (FAQ)


> How do I report issues?
Open issues on GitHub or contact the developer on Telegram/XDA (linked below). Always provide as much information as possible.
Open issues on GitHub or contact the developer on Telegram/XDA (linked below).
Always provide as much information as possible.


> Where do I find daemon logs?
Expand All @@ -205,11 +242,6 @@ Open issues on GitHub or contact the developer on Telegram/XDA (linked below). A
## LATEST CHANGES


**v2021.8.2 (202108020)**

- Fixed AccA related issues.


**v2021.8.9.1 (202108091)**

- Rewritten daemon logic for better efficiency and reliability.
Expand All @@ -222,3 +254,9 @@ Open issues on GitHub or contact the developer on Telegram/XDA (linked below). A
- General fixes
- Major optimizations
- Updated documentation: now with a table of contents and available in HTML format.


**v2021.8.26 (202108260)**

- Fixed daemon startup issue.
- Updated framework (it uses acc's) and documentation
Loading

0 comments on commit 9a8d2c2

Please sign in to comment.