Skip to content

Commit 9a8d2c2

Browse files
committed
**v2021.8.26 (202108260)**
- Fixed daemon startup issue. - Updated framework (it uses acc's) and documentation
1 parent c95d67a commit 9a8d2c2

File tree

8 files changed

+224
-113
lines changed

8 files changed

+224
-113
lines changed

META-INF/com/google/android/update-binary

+36-23
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ SKIPUNZIP=1
1313
echo
1414
id=djs
1515
domain=vr25
16-
umask 0077
1716
data_dir=/data/adb/$domain/${id}-data
1817

1918

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

7372
set_perms() {
74-
local owner=${2:-0} perms=0600 target=$(readlink -f $1)
73+
local owner=${2:-0}
74+
local perms=0600
75+
local target
76+
target=$(readlink -f $1)
7577
if echo $target | grep -q '.*\.sh$' || [ -d $target ]; then perms=0700; fi
7678
chmod $perms $target
7779
chown $owner:$owner $target
78-
chcon u:object_r:system_file:s0 $target
80+
chcon u:object_r:system_file:s0 $target 2>/dev/null || :
7981
}
8082

8183
set_perms_recursive() {
82-
local owner=${2-0} target=""
84+
local owner=${2-0}
85+
local target
8386
find $1 2>/dev/null | while read target; do set_perms $target $owner; done
8487
}
8588

8689
set -eu
8790

8891

8992
# set source code directory
90-
[ -f $PWD/${0##*/} ] && srcDir=$PWD || srcDir=${0%/*}
91-
srcDir=${srcDir/#"${0##*/}"/"."}
92-
93+
srcDir="$(cd "${0%/*}" 2>/dev/null || :; echo "$PWD")"
9394

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

112113

114+
# install in front-end's internal path by default
115+
if [ "$installDir" != "$accaFiles" ]; then
116+
case "$installDir" in
117+
/data/data/*|/data/user/*)
118+
accaFiles="$installDir"
119+
;;
120+
esac
121+
fi
122+
123+
113124
[ -d $magiskModDir ] && magisk=true || magisk=false
114125
ls -d ${accaFiles%/*}* > /dev/null 2>&1 && acca=true || acca=false ###
115126

116127

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

123137

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

210224

211225
# Termux, fix shebang
212-
[[ $installDir != *com.termux* ]] && termux=false || {
213-
termux=true
214-
for f in $installDir/*.sh; do
215-
! grep -q '^#\!/.*/sh' $f \
216-
|| sed -i 's|^#!/.*/sh|#!/data/data/com.termux/files/usr/bin/bash|' $f
217-
done
218-
}
226+
termux=false
227+
case "$installDir" in
228+
*/com.termux*)
229+
termux=true
230+
for f in $installDir/*.sh; do
231+
! grep -q '^#\!/.*/sh' $f \
232+
|| sed -i 's|^#!/.*/sh|#!/data/data/com.termux/files/usr/bin/bash|' $f
233+
done
234+
;;
235+
esac
219236

220237

221238
# set perms
222239
case $installDir in
223-
/data/*/files/*$id)
224-
pkg=${installDir%/files/*$id}
225-
pkg=${pkg##/data*/}
226-
owner=$(grep $pkg /data/system/packages.list | cut -d ' ' -f 2)
227-
set_perms_recursive $installDir $owner
240+
/data/data/*|/data/user/*)
241+
set_perms_recursive $installDir $(stat -c %u ${installDir%/$id})
228242

229243
# Termux:Boot
230244
! $termux || {
231245
mkdir -p ${installDir%/*}/.termux/boot
232246
ln -sf $installDir/service.sh ${installDir%/*}/.termux/boot/${id}-init.sh
233247
chown -R $(stat -c %u:%g /data/data/com.termux) ${installDir%/*}/.termux
234-
chmod -R 0755 ${installDir%/*}/.termux
235-
/system/bin/restorecon -R ${installDir%/*}/.termux > /dev/null 2>&1
248+
/system/bin/restorecon -R ${installDir%/*}/.termux > /dev/null 2>&1 || :
236249
}
237250
;;
238251
*)

README.html

+44-10
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
<h1 id="daily-job-scheduler-djs">Daily Job Scheduler (DJS)</h1>
3939
<ul>
4040
<li><a href="#description">DESCRIPTION</a></li>
41-
<li><a href="#legal">LEGAL</a></li>
41+
<li><a href="#license">LICENSE</a></li>
4242
<li><a href="#disclaimer">DISCLAIMER</a></li>
4343
<li><a href="#warning">WARNING</a></li>
4444
<li><a href="#donations">DONATIONS</a></li>
@@ -49,7 +49,12 @@ <h1 id="daily-job-scheduler-djs">Daily Job Scheduler (DJS)</h1>
4949
<li><a href="#terminal-commands">Terminal Commands</a></li>
5050
</ul>
5151
</li>
52-
<li><a href="#notestips-for-front-end-developers">NOTES/TIPS FOR FRONT-END DEVELOPERS</a></li>
52+
<li><a href="#notestips-for-front-end-developers">NOTES/TIPS FOR FRONT-END DEVELOPERS</a>
53+
<ul>
54+
<li><a href="#basics">Basics</a></li>
55+
<li><a href="#initializing-djs">Initializing DJS</a></li>
56+
</ul>
57+
</li>
5358
<li><a href="#frequently-asked-questions-faq">FREQUENTLY ASKED QUESTIONS (FAQ)</a></li>
5459
<li><a href="#links">LINKS</a></li>
5560
<li><a href="#latest-changes">LATEST CHANGES</a></li>
@@ -60,7 +65,7 @@ <h2 id="description">DESCRIPTION</h2>
6065
Any root solution is supported.
6166
The installation is always &quot;systemless&quot;, whether or not the system is rooted with Magisk.</p>
6267
<hr>
63-
<h2 id="legal">LEGAL</h2>
68+
<h2 id="license">LICENSE</h2>
6469
<p>Copyright (C) 2019-2021, VR25</p>
6570
<p>This program is free software: you can redistribute it and/or modify
6671
it under the terms of the GNU General Public License as published by
@@ -71,7 +76,7 @@ <h2 id="legal">LEGAL</h2>
7176
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7277
GNU General Public License for more details.</p>
7378
<p>You should have received a copy of the GNU General Public License
74-
along with this program. If not, see <a href="https://www.gnu.org/licenses/">https://www.gnu.org/licenses/</a>.</p>
79+
along with this program. If not, see <a href="https://www.gnu.org/licenses/">https://www.gnu.org/licenses/</a>.</p>
7580
<hr>
7681
<h2 id="disclaimer">DISCLAIMER</h2>
7782
<p>Always read/reread this reference prior to installing/upgrading this software.</p>
@@ -167,19 +172,47 @@ <h3 id="terminal-commands">Terminal Commands</h3>
167172
</div></code></code></pre>
168173
<hr>
169174
<h2 id="notestips-for-front-end-developers">NOTES/TIPS FOR FRONT-END DEVELOPERS</h2>
175+
<h3 id="basics">Basics</h3>
176+
<p>DJS does not require Magisk.
177+
Any root solution is fine.</p>
170178
<p>Use <code>/dev/.vr25/djs/*</code> over regular commands.
171-
These are guaranteed to be readily available after installation/initialization.</p>
179+
These are guaranteed to be readily available after installation/upgrades.</p>
172180
<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>.
173181
This makes code more readable (less cryptic).</p>
174182
<p>Include provided descriptions of DJS features/settings in your app(s).
175183
Provide additional information (trusted) where appropriate.
176184
Explain settings/concepts as clearly and with as few words as possible.</p>
185+
<h3 id="initializing-djs">Initializing DJS</h3>
186+
<p>DJS is automatically initialized after installation/upgrades.
187+
It needs to be initialized on boot, too.
188+
If it's installed as a Magisk module, this is done by Magisk itself.
189+
Otherwise, the front-end should handle it as follows:</p>
190+
<pre><code><code><div>on boot_completed receiver and main activity
191+
if file /dev/.acca/started does NOT exist
192+
create it
193+
mkdir -p /dev/.acca
194+
touch /dev/.acca/started
195+
if accd is NOT running
196+
launch it
197+
/data/adb/vr25/djs/service.sh
198+
else
199+
do nothing
200+
else
201+
do nothing
202+
</div></code></code></pre>
203+
<p><code>/dev/</code> is volatile - meaning, a reboot/shutdown clears <code>/dev/.acca/</code> and its contents.
204+
That's exactly what we want.
205+
Of course, <code>/dev/.acca/started</code> is just an example.
206+
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.
207+
<strong>WARNING</strong>: do not play with preexisting /dev/ data!
208+
Doing so may result in data loss and/or other undesired outcome.</p>
177209
<hr>
178210
<h2 id="frequently-asked-questions-faq">FREQUENTLY ASKED QUESTIONS (FAQ)</h2>
179211
<blockquote>
180212
<p>How do I report issues?</p>
181213
</blockquote>
182-
<p>Open issues on GitHub or contact the developer on Telegram/XDA (linked below). Always provide as much information as possible.</p>
214+
<p>Open issues on GitHub or contact the developer on Telegram/XDA (linked below).
215+
Always provide as much information as possible.</p>
183216
<blockquote>
184217
<p>Where do I find daemon logs?</p>
185218
</blockquote>
@@ -197,10 +230,6 @@ <h2 id="links">LINKS</h2>
197230
</ul>
198231
<hr>
199232
<h2 id="latest-changes">LATEST CHANGES</h2>
200-
<p><strong>v2021.8.2 (202108020)</strong></p>
201-
<ul>
202-
<li>Fixed AccA related issues.</li>
203-
</ul>
204233
<p><strong>v2021.8.9.1 (202108091)</strong></p>
205234
<ul>
206235
<li>Rewritten daemon logic for better efficiency and reliability.</li>
@@ -212,6 +241,11 @@ <h2 id="latest-changes">LATEST CHANGES</h2>
212241
<li>General fixes</li>
213242
<li>Major optimizations</li>
214243
<li>Updated documentation: now with a table of contents and available in HTML format.</li>
244+
</ul>
245+
<p><strong>v2021.8.26 (202108260)</strong></p>
246+
<ul>
247+
<li>Fixed daemon startup issue.</li>
248+
<li>Updated framework (it uses acc's) and documentation</li>
215249
</ul>
216250

217251
</body>

README.md

+48-10
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44

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

2729

2830
---
29-
## LEGAL
31+
## LICENSE
3032

3133
Copyright (C) 2019-2021, VR25
3234

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

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

4648

4749
---
@@ -164,8 +166,14 @@ The first directory holds user executables.
164166
---
165167
## NOTES/TIPS FOR FRONT-END DEVELOPERS
166168

169+
170+
### Basics
171+
172+
DJS does not require Magisk.
173+
Any root solution is fine.
174+
167175
Use `/dev/.vr25/djs/*` over regular commands.
168-
These are guaranteed to be readily available after installation/initialization.
176+
These are guaranteed to be readily available after installation/upgrades.
169177

170178
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`.
171179
This makes code more readable (less cryptic).
@@ -175,13 +183,42 @@ Provide additional information (trusted) where appropriate.
175183
Explain settings/concepts as clearly and with as few words as possible.
176184

177185

186+
### Initializing DJS
187+
188+
DJS is automatically initialized after installation/upgrades.
189+
It needs to be initialized on boot, too.
190+
If it's installed as a Magisk module, this is done by Magisk itself.
191+
Otherwise, the front-end should handle it as follows:
192+
```
193+
on boot_completed receiver and main activity
194+
if file /dev/.acca/started does NOT exist
195+
create it
196+
mkdir -p /dev/.acca
197+
touch /dev/.acca/started
198+
if accd is NOT running
199+
launch it
200+
/data/adb/vr25/djs/service.sh
201+
else
202+
do nothing
203+
else
204+
do nothing
205+
```
206+
`/dev/` is volatile - meaning, a reboot/shutdown clears `/dev/.acca/` and its contents.
207+
That's exactly what we want.
208+
Of course, `/dev/.acca/started` is just an example.
209+
One can use any random path (e.g., `.myapp/initialized`), as long as it's under `/dev/` and does not conflict with preexisting data.
210+
**WARNING**: do not play with preexisting /dev/ data!
211+
Doing so may result in data loss and/or other undesired outcome.
212+
213+
178214
---
179215
## FREQUENTLY ASKED QUESTIONS (FAQ)
180216

181217

182218
> How do I report issues?
183219
184-
Open issues on GitHub or contact the developer on Telegram/XDA (linked below). Always provide as much information as possible.
220+
Open issues on GitHub or contact the developer on Telegram/XDA (linked below).
221+
Always provide as much information as possible.
185222

186223

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

207244

208-
**v2021.8.2 (202108020)**
209-
210-
- Fixed AccA related issues.
211-
212-
213245
**v2021.8.9.1 (202108091)**
214246

215247
- Rewritten daemon logic for better efficiency and reliability.
@@ -222,3 +254,9 @@ Open issues on GitHub or contact the developer on Telegram/XDA (linked below). A
222254
- General fixes
223255
- Major optimizations
224256
- Updated documentation: now with a table of contents and available in HTML format.
257+
258+
259+
**v2021.8.26 (202108260)**
260+
261+
- Fixed daemon startup issue.
262+
- Updated framework (it uses acc's) and documentation

0 commit comments

Comments
 (0)