Commit Graph

1974 Commits

Author SHA1 Message Date
steadfasterX
30859d2c08
fix-up & enhance advanced error handling
new (internal used) functions:
- _exit
- _exit_report
- _exit_sigint

these are used to fix several (wrong) error handlings.

new environment variable:
- UNATTENDED_PATCHING

by default we assume unattended patching, i.e. if an error occurs during
the patch, reset or any other process we will report the error and
auto close the shell. this is needed as we source functions and code and
so cannot simply terminate a master process. instead the whole shell will
be terminated so if an error occurs nothing else will be executed (and you
should notice easily that something is wrong).

without that a (serious) error can still continue the rest of a function
and you likely not even noticing the error itself.

you can use:

export UNATTENDED_PATCHING=0

before or after sourcing init.sh and it will *NOT* auto-close the shell.
that way you can check the output and fix any issues.

Signed-off-by: steadfasterX <steadfasterX@gmail.com>
2024-04-22 10:24:18 +02:00
steadfasterX
fcec1c8887
common: do not abort when recovery-in-boot
when using strict (i.e set -e added by this PR) a build will fail on release when there is no recovery.img. this makes that non-fatal allowing to proceed

Signed-off-by: steadfasterX <steadfasterX@users.noreply.github.com>
2024-04-22 10:24:18 +02:00
steadfasterX
7724c3effd
make divest functions error aware
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>
2024-04-22 10:24:18 +02:00
Tavi
a16b5a89c7
Update CVE patchers
Signed-off-by: Tavi <tavi@divested.dev>
2024-04-16 08:41:35 -04:00
Tavi
aa52315312
Picks
Signed-off-by: Tavi <tavi@divested.dev>
2024-04-14 13:54:25 -04:00
steadfasterX
fb8ee6e2eb functions: do not fail if not building pixel devices
Signed-off-by: steadfasterX <steadfasterX@users.noreply.github.com>
2024-04-10 11:45:45 -04:00
Tavi
25da5b3f74
Update CVE patchers
Signed-off-by: Tavi <tavi@divested.dev>
2024-04-10 11:21:10 -04:00
Tavi
fce6f95a73
Churn
Signed-off-by: Tavi <tavi@divested.dev>
2024-04-10 08:27:30 -04:00
Tavi
570d2edfee
Update CVE patchers
Signed-off-by: Tavi <tavi@divested.dev>
2024-04-10 08:16:01 -04:00
Tavi
e7de509de5
Record current checkouts
Signed-off-by: Tavi <tavi@divested.dev>
2024-04-10 08:15:58 -04:00
Tavi
e1e6d55cc6
Improve 78cb11ac
Signed-off-by: Tavi <tavi@divested.dev>
2024-04-10 07:48:20 -04:00
Tavi
78cb11acd7 tensor stuff
Signed-off-by: Tavi <tavi@divested.dev>
2024-04-10 07:24:29 -04:00
Tavi
741e5a7ca3
Fixup
also 16.0 probably needs a backport of IsRecoveryMode
compile tested on 20.0

Signed-off-by: Tavi <tavi@divested.dev>
2024-04-09 16:40:05 -04:00
Tavi
3f430b038e
18.1: April ASB picks
1 extra patch

Signed-off-by: Tavi <tavi@divested.dev>
2024-04-09 16:29:38 -04:00
Tavi
4f8cfc8a41
you want it, you got it!
now compile it yourself.

Signed-off-by: Tavi <tavi@divested.dev>
2024-04-09 16:25:54 -04:00
Tavi
f5d06ea9aa
Refresh defconfig paths
Signed-off-by: Tavi <tavi@divested.dev>
2024-04-09 13:31:34 -04:00
Tavi
ea83b47d59
apex signing updates
untested

Signed-off-by: Tavi <tavi@divested.dev>
2024-04-09 13:25:56 -04:00
Tavi
835fbb7d2c
Fixup
Signed-off-by: Tavi <tavi@divested.dev>
2024-04-08 15:12:49 -04:00
Tavi
9d6325e2a0
15.1: April ASB work
Signed-off-by: Tavi <tavi@divested.dev>
2024-04-08 13:36:38 -04:00
Tavi
20a47d5b25
16.0: April ASB work
Signed-off-by: Tavi <tavi@divested.dev>
2024-04-08 12:24:08 -04:00
Tavi
b6f3f2e055
17.1: April ASB work
Signed-off-by: Tavi <tavi@divested.dev>
2024-04-08 09:53:03 -04:00
Tavi
e5f019d63d
18.1: April ASB work
Signed-off-by: Tavi <tavi@divested.dev>
2024-04-07 18:26:07 -04:00
Tavi
898ddf41a9
19.1: ASB Picks
Signed-off-by: Tavi <tavi@divested.dev>
2024-04-07 16:56:12 -04:00
Tavi
5cad35c028
Fixup
Signed-off-by: Tavi <tavi@divested.dev>
2024-04-06 19:59:27 -04:00
Tavi
2c9a3903e5
14.1: ASB Picks
Signed-off-by: Tavi <tavi@divested.dev>
2024-04-06 15:43:21 -04:00
Tavi
b6c2959272
Fixup lemonade/lemonadep
Signed-off-by: Tavi <tavi@divested.dev>
2024-04-05 22:58:48 -04:00
Tavi
97ce53667f
Churn
Signed-off-by: Tavi <tavi@divested.dev>
2024-04-04 14:42:59 -04:00
Tavi
450ad03159
Update CVE patchers
maybe some breakage

Signed-off-by: Tavi <tavi@divested.dev>
2024-04-04 13:55:38 -04:00
Tavi
768f46c3bd
Update CVE patchers
Signed-off-by: Tavi <tavi@divested.dev>
2024-04-02 08:54:59 -04:00
Tavi
2a78a4cfc0
Update CVE patchers
for realz

Signed-off-by: Tavi <tavi@divested.dev>
2024-03-27 22:09:10 -04:00
Tavi
dc9ed7c46c
Update CVE patchers
Signed-off-by: Tavi <tavi@divested.dev>
2024-03-21 14:54:23 -04:00
Tavi
4f4d760687
Churn
Signed-off-by: Tavi <tavi@divested.dev>
2024-03-21 13:56:43 -04:00
Tavi
26d99a04f0
15.1: March ASB work
Signed-off-by: Tavi <tavi@divested.dev>
2024-03-14 23:35:21 -04:00
Tavi
6b0362d46f
20.0: Fix invisible camera buttons
Signed-off-by: Tavi <tavi@divested.dev>
2024-03-14 23:12:45 -04:00
Tavi
1e8e187ede
17.1: March ASB work
+ a bonus February patch for 15.1

Signed-off-by: Tavi <tavi@divested.dev>
2024-03-14 21:15:15 -04:00
Tavi
fa6d1f7f90
17.1: Reconcile picks
Signed-off-by: Tavi <tavi@divested.dev>
2024-03-14 20:00:59 -04:00
Tavi
dee7abe09d Update CVE patchers
Signed-off-by: Tavi <tavi@divested.dev>
2024-03-14 14:58:24 -04:00
Tavi
3b2fde1dd6
16: ASB picks
Signed-off-by: Tavi <tavi@divested.dev>
2024-03-13 21:19:02 -04:00
Tavi
8157086726
Churn
Signed-off-by: Tavi <tavi@divested.dev>
2024-03-11 14:19:21 -04:00
Tavi
54469e0693
Fixup
Signed-off-by: Tavi <tavi@divested.dev>
2024-03-11 07:22:03 -04:00
Tavi
cdfbce9dfd
Fixups
Signed-off-by: Tavi <tavi@divested.dev>
2024-03-10 12:10:49 -04:00
Tavi
2aecd058d3
18: ASB Picks
Signed-off-by: Tavi <tavi@divested.dev>
2024-03-09 20:54:44 -05:00
Tavi
c3b07f5e01
Churn
Signed-off-by: Tavi <tavi@divested.dev>
2024-03-09 16:35:22 -05:00
Tavi
0b8f1a2c57
Churn
Signed-off-by: Tavi <tavi@divested.dev>
2024-03-09 12:02:14 -05:00
Tavi
366140a179
14/19/20: ASB Picks
Signed-off-by: Tavi <tavi@divested.dev>
2024-03-09 11:05:06 -05:00
Tavi
f5a44efdff
Update CVE patchers
Signed-off-by: Tavi <tavi@divested.dev>
2024-03-07 12:13:52 -05:00
Tavi
3307463ffb
Update commons
Signed-off-by: Tavi <tavi@divested.dev>
2024-03-05 13:07:52 -05:00
Tavi
5aefd27519
Update CVE patchers
Fixes https://github.com/Divested-Mobile/DivestOS-Build/issues/294

Signed-off-by: Tavi <tavi@divested.dev>
2024-03-05 12:42:34 -05:00
Tavi
cd38073ad2
Update CVE patchers
Signed-off-by: Tavi <tavi@divested.dev>
2024-03-04 15:39:53 -05:00
Tavi
fdbd1a090f
Update CVE patchers
I made a pass through removing some obvious wrongly applied patches
but there is likely some more breakage here

Signed-off-by: Tavi <tavi@divested.dev>
2024-03-02 12:31:51 -05:00