allow setting custom flipper name

serial & ble mac generated from custom name (if set), CI support added too
This commit is contained in:
MX
2022-08-14 05:34:54 +03:00
parent 4dab3a83a3
commit a896aa4113
7 changed files with 81 additions and 12 deletions
+10 -1
View File
@@ -2,7 +2,7 @@
from flipper.app import App
from os.path import join, exists
from os import makedirs
from os import makedirs, environ
from update import Main as UpdateMain
import shutil
@@ -134,6 +134,15 @@ class Main(App):
self.logger.info(
f"Use this directory to self-update your Flipper:\n\t{bundle_dir}"
)
log_custom_fz_name = (
environ.get("CUSTOM_FLIPPER_NAME", None)
or ""
)
if (log_custom_fz_name != ""):
self.logger.info(
f"Flipper Custom Name is set:\n\tName: {log_custom_fz_name} : length - {len(log_custom_fz_name)} chars"
)
return UpdateMain(no_exit=True)(bundle_args)
return 0
+22 -7
View File
@@ -37,13 +37,28 @@ class GitVersion:
or "unknown"
)
return {
"GIT_COMMIT": commit,
"GIT_BRANCH": branch,
"GIT_BRANCH_NUM": branch_num,
"VERSION": version,
"BUILD_DIRTY": dirty and 1 or 0,
}
custom_fz_name = (
os.environ.get("CUSTOM_FLIPPER_NAME", None)
or ""
)
if (custom_fz_name != "") and (len(custom_fz_name) <= 8):
return {
"GIT_COMMIT": commit,
"GIT_BRANCH": branch,
"GIT_BRANCH_NUM": branch_num,
"FURI_CUSTOM_FLIPPER_NAME": custom_fz_name,
"VERSION": version,
"BUILD_DIRTY": dirty and 1 or 0,
}
else:
return {
"GIT_COMMIT": commit,
"GIT_BRANCH": branch,
"GIT_BRANCH_NUM": branch_num,
"VERSION": version,
"BUILD_DIRTY": dirty and 1 or 0,
}
def _exec_git(self, args):
cmd = ["git"]