envsetup: Auto set BlissRoms buildtype
- Check if device is officially supported by us or not.
Signed-off-by: Jackeagle <jackeagle102@gmail.com>
Change-Id: I65346178ae6cd4a2e66cd7c5ee06b253511f96d5
diff --git a/build/envsetup.sh b/build/envsetup.sh
index 9127fe9..3361364 100644
--- a/build/envsetup.sh
+++ b/build/envsetup.sh
@@ -25,6 +25,22 @@
EOF
}
+function checkofficial()
+{
+ codenames=$(curl -s 'https://api.blissroms.org/api/maintainers')
+ for row in $(echo "${codenames}" | jq -r '.[] | @base64'); do
+ _jq() {
+ echo ${row} | base64 --decode | jq -r ${1}
+ }
+ if [ "$(_jq '.codename')" == "$1" ]; then
+ export BLISS_BUILDTYPE=OFFICIAL
+ break
+ else
+ export BLISS_BUILDTYPE=UNOFFICIAL
+ fi
+ done
+}
+
function mk_timer()
{
local start_time=$(date +"%s")
@@ -58,7 +74,8 @@
{
target=$1
local variant=$2
-
+
+ checkofficial $target
if [ $# -eq 0 ]; then
# No arguments, so let's have the full menu
lunch
@@ -1043,7 +1060,9 @@
echo "No device name specified. Please use --help to verify correct usage"
return 0
fi
-
+
+ checkofficial $1
+
# Breakfast extension
if [ $TARGET_BUILD_VARIANT == "user" ];then
breakfast $* user