This commit is contained in:
steadfasterX 2024-04-11 17:49:22 +02:00 committed by GitHub
commit 5db0aa23a7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 50 additions and 3 deletions

View file

@ -16,6 +16,19 @@
#along with this program. If not, see <https://www.gnu.org/licenses/>.
umask 0022;
_fetchError(){
local last_status="$1";
local error_line_number="$2";
local last_func="$3";
local file=$(echo "$4" | sed "s#$DOS_WORKSPACE_ROOT#\$DOS_WORKSPACE_ROOT#g");
if [ ! -z "$last_func" ] && [ ! -z "$file" ];then
echo -e "\e[0;31mERROR: $file -> ${last_func}() ended with status >${last_status}< at line >$((error_line_number -1))<\e[0m";
else
echo -e "\e[0;31mERROR: last command ended with status >${last_status}< at line >$((error_line_number -1))<\e[0m";
fi
}
export -f _fetchError;
startPatcher() {
java -jar "$DOS_BINARY_PATCHER" patch workspace "$DOS_BUILD_BASE" "$DOS_WORKSPACE_ROOT""Patches/Linux/" "$DOS_SCRIPTS_CVES" $1;
}
@ -380,7 +393,7 @@ processRelease() {
echo "$INCREMENTAL_ID" > "$OUT_DIR/$PREFIX-target_files.zip.id";
#Image
unzip -l $OUT_DIR/$PREFIX-target_files.zip | grep -q recovery.img;
unzip -l $OUT_DIR/$PREFIX-target_files.zip | grep -q recovery.img || true;
local hasRecoveryImg="$?";
unzip -l $OUT_DIR/$PREFIX-target_files.zip | grep -q dtbo.img;
local hasDtboImg="$?";

View file

@ -58,3 +58,5 @@ sed -i '/android.software.managed_users/s/notLowRam="true"//' frameworks/native/
cd "$DOS_BUILD_BASE";
echo -e "\e[0;32m[SCRIPT COMPLETE] Post tweaks complete\e[0m";
kill -USR2 $TR_PID

View file

@ -117,6 +117,38 @@ export DOS_THEME_700="E64A19"; #Deep Orange 700
umask 0022;
export TR_ERR=0
export TR_PID=$$
set -E; #required for resetEnv()
resetEnv(){
trap - ERR EXIT USR2 SIGINT SIGHUP TERM
echo -e "\n\e[0;32mThe environment has been reset.\e[0m\nRemember to always '\e[0;31msource ../../Scripts/init.sh\e[0m' before building.\n"
set +E +f
}
export -f resetEnv
# print result
# will also ensure the corresponding status code gets returned properly
_errorReport(){
if [ "$TR_ERR" -ne 0 ];then
echo -e "\n\e[0;31m[FINAL RESULT] Serious error(s) found!!!\nSummary error code was: $TR_ERR. Check & fix all error lines above\e[0m"
else
echo -e "\n\e[0;32m[FINAL RESULT] No error detected (please check the above output nevertheless!)\e[0m"
fi
return $TR_ERR
}
export -f _errorReport
# trap and print errors
# ERR: needed to fetch aborts when set -e is set
trap 'E=$?; \
[ $E -ne 0 ] && _fetchError $E $LINENO $FUNCNAME $BASH_SOURCE \
&& export TR_ERR=$((TR_ERR + $E))' EXIT ERR
trap _errorReport USR2
trap resetEnv SIGINT SIGHUP TERM
gpgVerifyGitHead() {
if [ -r "$DOS_TMP_GNUPG/pubring.kbx" ]; then
if git -C "$1" verify-commit HEAD &>/dev/null; then
@ -203,5 +235,5 @@ source "$DOS_SCRIPTS_COMMON/Functions.sh";
source "$DOS_SCRIPTS_COMMON/Tag_Verifier.sh";
source "$DOS_SCRIPTS/Functions.sh";
[[ -f "$DOS_BUILD_BASE/.repo/local_manifests/roomservice.xml" ]] && echo "roomservice manifest found! Please fix your manifests before continuing!";
[[ -f "$DOS_BUILD_BASE/DOS_PATCHED_FLAG" ]] && echo "NOTE: THIS WORKSPACE IS ALREADY PATCHED, PLEASE RESET BEFORE PATCHING AGAIN!";
[[ -f "$DOS_BUILD_BASE/.repo/local_manifests/roomservice.xml" ]] && echo "roomservice manifest found! Please fix your manifests before continuing!" || true;
[[ -f "$DOS_BUILD_BASE/DOS_PATCHED_FLAG" ]] && echo "NOTE: THIS WORKSPACE IS ALREADY PATCHED, PLEASE RESET BEFORE PATCHING AGAIN!" || true;