this commit adds (the currently non-existing) error handling when
using divest's functions and scripts.
all the magic here gets activated when `source ../../Scripts/init.sh`
gets executed which is already a mandatory step before starting any
of the divest functions.
when something fails during patching, resetting or building
each error will be catched + printed including an error code now.
last but not least the executed file and the line number causing that
failure will be shown, too.
as all divest functions get source'd and so not a single build
script gets executed all ERR's needs to be trapped to catch issues.
I am not aware of another way to handle that properly as sourcing
means we cannot track a script or smth while this approach here
just works.
Example for an error thrown in a function call:
> ERROR: $DOS_WORKSPACE_ROOT/Scripts/Common/Functions.sh -> verifyAllPlatformTags() ended with status >1< at line >49<
Final SUCCESS result message after using `patchWorkspace`:
> [FINAL RESULT] No error detected (please check the above output nevertheless!)
Final ERROR result message after using `patchWorkspace`:
> [FINAL RESULT] Serious error(s) found!!!
> Summary error code was: 126. Check & fix all error lines above
Some notes:
- when an error occurs the process continues until the end (like it is now)
i.e. an error will not stop the current and following tasks
- when multiple errors occur the exit codes will be summed
- buildDevice: a (summed) end result gets printed (SUCCESS or ERROR) at the very end
- the trap used to catch any error will also be active for any command executed
on the cli. that means: type "false" -> ENTER and you will get an error, too
same for any script exectued after source init.sh
- when all goes well the trap will be resetted at the end but there are cases
where this might not happen -> that is why `resetEnv` can be executed to
reset the trap, i.e. all becomes as it was before sourcing init.sh
- `resetEnv` gets called automatically:
- after a successful `patchWorkspace` run
- whenever CTRL+C is used (during a running task or just on the cli)
- a process get killed (SIGHUP, TERM)
- the whole implementation might not catch all errors though - it highly depends
on how the function or the script/program called actually handles errors or better
said: if they return a proper exit code on failures.
For example some tools (like some git cmds) might print an error but don't return
a non-zero exit code. This cannot be tracked other then with your eyes or these
must be replaced by other methods returning a non-zero exit code on failures.
Signed-off-by: steadfasterX <steadfasterX@gmail.com>
- Only enable on Linux 3.0 through 4.9
- Always enable defer option
- Only run twice a second, instead of fifty times a second
Signed-off-by: Tad <tad@spotco.us>
- 19.1/20.0: Enable low ram for <6GB devices
- 20.0: support RROs with exec spawning patch from GrapheneOS
- allow work profiles when low ram is enabled
- churn
- cherrypicks
Signed-off-by: Tad <tad@spotco.us>
Change the property too, so it takes effect next update.
Since 16.0 lacks a toggle, this effectively disables the feature for it.
Even devices with 4GB of RAM have usability severely impacted.
Plus some other tweaks/churn
Signed-off-by: Tad <tad@spotco.us>
No change to AVB devices except for enabling on more
Verity devices have the potential to regress by not booting
No change to non-verity/avb devices
Tested working on: mata, cheeseburger, fajita
Signed-off-by: Tad <tad@spotco.us>