初始化奇妙小屏幕控制器项目
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Run every registered persistent-data migration against an isolated data root."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
from app.animations.store import AnimationStore
|
||||
from app.config.store import ConfigStore
|
||||
from app.fonts.store import FontCatalog
|
||||
from app.library_order import LibraryOrderStore
|
||||
from app.network.store import WifiConfigStore
|
||||
from app.templates.store import TemplateStore
|
||||
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--data-root", required=True)
|
||||
parser.add_argument("--runtime-root", required=True)
|
||||
args = parser.parse_args()
|
||||
data_root = Path(args.data_root).resolve()
|
||||
runtime_root = Path(args.runtime_root).resolve()
|
||||
os.environ["MATRIX_DATA_DIR"] = str(data_root)
|
||||
os.environ["MATRIX_RUNTIME_DIR"] = str(runtime_root)
|
||||
|
||||
config = ConfigStore()
|
||||
fonts = FontCatalog(config.data_dir)
|
||||
TemplateStore(config.data_dir, font_resolver=fonts.resolve)
|
||||
AnimationStore(config.data_dir, font_resolver=fonts.resolve)
|
||||
LibraryOrderStore(config.data_dir)
|
||||
WifiConfigStore(config.data_dir, config.runtime_dir, boot_id="ota-preflight")
|
||||
from scripts.ota_components import begin
|
||||
begin(Path(__file__).resolve().parents[1], data_root)
|
||||
print(f"Persistent data prepared successfully: schema={config.path.name}")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
Reference in New Issue
Block a user