From a6b2c19b56cd3f690959447e08d52a3147f4c445 Mon Sep 17 00:00:00 2001 From: dd Date: Thu, 10 Oct 2024 19:30:50 +0200 Subject: improved circinus debranding --- new/lib/debranding.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/new/lib/debranding.py b/new/lib/debranding.py index b7cdb8d..86d2f82 100644 --- a/new/lib/debranding.py +++ b/new/lib/debranding.py @@ -17,6 +17,7 @@ class Debranding: keep_branding = None remove_branding = None alternative_name = None + logged = False def __init__(self): self.cache = Cache(os.path.join(data_dir, "debranding-cache.json"), dict, {}) @@ -50,6 +51,11 @@ class Debranding: ("VyOS", alternative_name), ]) + motd_path = os.path.join(root_dir, "data/templates/login/motd_vyos_nonproduction.j2") + if os.path.exists(motd_path): + with open(motd_path, "w") as file: + file.truncate() + login_banner_path = os.path.join(root_dir, "src/conf_mode/system_login_banner.py") self.replace_patterns_in_file(login_banner_path, [ ("Welcome to VyOS", "Welcome to %s" % alternative_name), @@ -177,6 +183,10 @@ class Debranding: self.cache.set("alternative_name", self.alternative_name) def log_settings(self): + if self.logged: + return + self.logged = True + if not self.is_debranding_enabled(): option = "option" if self.keep_branding else "cached option" logging.info("Using %s --keep-branding to keep VyOS branding intact" % option) -- cgit v1.2.3