Closed ckuethe closed 4 weeks ago
ok, a few things...
init.d
script are ran by system on startup and shutdown. they are not intended for user interaction so any extras like check
and save
are non-orthodox and call for a refactoring. any interactive part should be extracted to a separate script in /usr/sbin/
, for running on start or shutdown only start
and stop
should be left in the init.d script.
we minimize writing to the flash chip for no reason so anything non-permanent like dealing with temporary files should be handled in tempfs which is actually a mapped ram.
variables and functions should be named in a way that eliminates the need for comments.
# in this function we calculate profitability (b) using money (c) and time (d)
function a() {
b = c / d;
}
should become
function calculate_profitability() {
profit = money / time;
}
ALL_CAPS_NAMES are reserved for constants. regular mutable variables go with lower snake case as regular_variable
.
also, we recently added /etc/init.d/rc.common
file which can care of of most common things between init.d scripts to reuse common practice and minimize footprtint. please take a loot at it.
hi @ckuethe, just a ping. did you see @themactep's notes?
Yep, been working on some other stuff. I'll have some time this weekend to revisit this.
Tested on a local build for the W7, works as expected
Also tested on Wyze Cam v3, works as expected.
I suppose it's worth saying that you can copy this script to an existing camera and run
S34rootcreds save
andS34rootcreds status
if you want to save and verify the saved credentials before updating...