More handling improvements

Signed-off-by: Tad <tad@spotco.us>
This commit is contained in:
Tad 2023-03-08 16:02:02 -05:00
parent 0b294c1601
commit ef2fdb1d3e
No known key found for this signature in database
GPG Key ID: B286E9F57A07424B
9 changed files with 60 additions and 29 deletions

View File

@ -19,24 +19,24 @@ set -uo pipefail;
source "$DOS_SCRIPTS_COMMON/Shell.sh";
copyKey() {
if [[ -f "$DOS_SIGNING_KEYS/$1/verifiedboot_relkeys.der.x509" ]] && [[ -d "$DOS_BUILD_BASE/$2" ]]; then
if cp "$DOS_SIGNING_KEYS/$1/verifiedboot_relkeys.der.x509" "$DOS_BUILD_BASE/$2/verifiedboot_$1_dos_relkeys.der.x509"; then
echo -e "\e[0;32mCopied verifiedboot keys for $1 to $2\e[0m";
else
echo -e "\e[0;33mCould not copy verifiedboot keys for $1\e[0m";
if [[ -d "$DOS_SIGNING_KEYS/$1" ]] && [[ -d "$DOS_BUILD_BASE/$2" ]]; then
if [[ -f "$DOS_SIGNING_KEYS/$1/verifiedboot_relkeys.der.x509" ]] && [[ -d "$DOS_BUILD_BASE/$2" ]]; then
if cp "$DOS_SIGNING_KEYS/$1/verifiedboot_relkeys.der.x509" "$DOS_BUILD_BASE/$2/verifiedboot_$1_dos_relkeys.der.x509"; then
echo -e "\e[0;32mCopied verifiedboot keys for $1 to $2\e[0m";
else
echo -e "\e[0;31mCould not copy verifiedboot keys for $1\e[0m";
fi;
fi;
else
echo -e "\e[0;33mCould not copy verifiedboot keys for $1\e[0m";
fi;
if [[ -f "$DOS_SIGNING_KEYS/$1/verity.x509.pem" ]] && [[ -d "$DOS_BUILD_BASE/$2/certs" ]]; then
if cat "$DOS_SIGNING_KEYS/$1/verity.x509.pem" >> "$DOS_BUILD_BASE/$2/certs/verity.x509.pem"; then
echo -e "\e[0;32mAppended verity keys for $1 to $2\e[0m";
else
echo -e "\e[0;33mCould not append verity keys for $1\e[0m";
if [[ -f "$DOS_SIGNING_KEYS/$1/verity.x509.pem" ]] && [[ -d "$DOS_BUILD_BASE/$2/certs" ]]; then
if cat "$DOS_SIGNING_KEYS/$1/verity.x509.pem" >> "$DOS_BUILD_BASE/$2/certs/verity.x509.pem"; then
echo -e "\e[0;32mAppended verity keys for $1 to $2\e[0m";
else
echo -e "\e[0;31mCould not append verity keys for $1\e[0m";
fi;
fi;
else
echo -e "\e[0;33mCould not append verity keys for $1\e[0m";
elif [[ ! -d "$DOS_SIGNING_KEYS/$1" ]] && [[ -d "$DOS_BUILD_BASE/$2" ]]; then
echo -e "\e[0;31mNo keys available for $1 but kernel $2 exists!\e[0m";
fi;
}

View File

@ -41,8 +41,12 @@ export -f buildDevice;
buildDeviceUserDebug() {
cd "$DOS_BUILD_BASE";
export OTA_KEY_OVERRIDE_DIR="$DOS_SIGNING_KEYS/$1";
breakfast "lineage_$1-userdebug" && mka target-files-package otatools && processRelease $1 true $2;
if [[ -d "$DOS_SIGNING_KEYS/$1" ]]; then
export OTA_KEY_OVERRIDE_DIR="$DOS_SIGNING_KEYS/$1";
breakfast "lineage_$1-userdebug" && mka target-files-package otatools && processRelease $1 true $2;
else
echo -e "\e[0;31mNo signing keys available for $1\e[0m";
fi;
}
export -f buildDeviceUserDebug;

View File

@ -32,8 +32,12 @@ export -f scanWorkspaceForMalware;
buildDevice() {
cd "$DOS_BUILD_BASE";
export OTA_KEY_OVERRIDE_DIR="$DOS_SIGNING_KEYS/$1";
breakfast "lineage_$1-user" && mka target-files-package otatools && processRelease $1 true $2;
if [[ -d "$DOS_SIGNING_KEYS/$1" ]]; then
export OTA_KEY_OVERRIDE_DIR="$DOS_SIGNING_KEYS/$1";
breakfast "lineage_$1-user" && mka target-files-package otatools && processRelease $1 true $2;
else
echo -e "\e[0;31mNo signing keys available for $1\e[0m";
fi;
}
export -f buildDevice;

View File

@ -32,8 +32,12 @@ export -f scanWorkspaceForMalware;
buildDevice() {
cd "$DOS_BUILD_BASE";
export OTA_KEY_OVERRIDE_DIR="$DOS_SIGNING_KEYS/$1";
breakfast "lineage_$1-user" && mka target-files-package otatools && processRelease $1 true $2;
if [[ -d "$DOS_SIGNING_KEYS/$1" ]]; then
export OTA_KEY_OVERRIDE_DIR="$DOS_SIGNING_KEYS/$1";
breakfast "lineage_$1-user" && mka target-files-package otatools && processRelease $1 true $2;
else
echo -e "\e[0;31mNo signing keys available for $1\e[0m";
fi;
}
export -f buildDevice;

View File

@ -32,8 +32,12 @@ export -f scanWorkspaceForMalware;
buildDevice() {
cd "$DOS_BUILD_BASE";
export OTA_KEY_OVERRIDE_DIR="$DOS_SIGNING_KEYS/$1";
breakfast "lineage_$1-user" && mka target-files-package otatools && processRelease $1 true $2;
if [[ -d "$DOS_SIGNING_KEYS/$1" ]]; then
export OTA_KEY_OVERRIDE_DIR="$DOS_SIGNING_KEYS/$1";
breakfast "lineage_$1-user" && mka target-files-package otatools && processRelease $1 true $2;
else
echo -e "\e[0;31mNo signing keys available for $1\e[0m";
fi;
}
export -f buildDevice;

View File

@ -32,8 +32,12 @@ export -f scanWorkspaceForMalware;
buildDevice() {
cd "$DOS_BUILD_BASE";
export OTA_KEY_OVERRIDE_DIR="$DOS_SIGNING_KEYS/$1";
breakfast "lineage_$1-user" && mka target-files-package otatools && processRelease $1 true $2;
if [[ -d "$DOS_SIGNING_KEYS/$1" ]]; then
export OTA_KEY_OVERRIDE_DIR="$DOS_SIGNING_KEYS/$1";
breakfast "lineage_$1-user" && mka target-files-package otatools && processRelease $1 true $2;
else
echo -e "\e[0;31mNo signing keys available for $1\e[0m";
fi;
}
export -f buildDevice;

View File

@ -32,8 +32,12 @@ export -f scanWorkspaceForMalware;
buildDevice() {
cd "$DOS_BUILD_BASE";
export OTA_KEY_OVERRIDE_DIR="$DOS_SIGNING_KEYS/$1";
breakfast "lineage_$1-user" && mka target-files-package otatools && processRelease $1 true $2;
if [[ -d "$DOS_SIGNING_KEYS/$1" ]]; then
export OTA_KEY_OVERRIDE_DIR="$DOS_SIGNING_KEYS/$1";
breakfast "lineage_$1-user" && mka target-files-package otatools && processRelease $1 true $2;
else
echo -e "\e[0;31mNo signing keys available for $1\e[0m";
fi;
}
export -f buildDevice;

View File

@ -32,8 +32,12 @@ export -f scanWorkspaceForMalware;
buildDevice() {
cd "$DOS_BUILD_BASE";
#export OTA_KEY_OVERRIDE_DIR="$DOS_SIGNING_KEYS/$1";
breakfast "lineage_$1-user" && mka target-files-package otatools && processRelease $1 true $2;
if [[ -d "$DOS_SIGNING_KEYS/$1" ]]; then
#export OTA_KEY_OVERRIDE_DIR="$DOS_SIGNING_KEYS/$1";
breakfast "lineage_$1-user" && mka target-files-package otatools && processRelease $1 true $2;
else
echo -e "\e[0;31mNo signing keys available for $1\e[0m";
fi;
}
export -f buildDevice;

View File

@ -187,3 +187,6 @@ source "$DOS_SCRIPTS_COMMON/Shell.sh";
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!";