mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-07-03 22:23:35 -07:00
allow setting custom flipper name
serial & ble mac generated from custom name (if set), CI support added too
This commit is contained in:
+10
-1
@@ -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
@@ -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"]
|
||||
|
||||
Reference in New Issue
Block a user