update fix
This commit is contained in:
@@ -287,6 +287,39 @@ def validate_supported_os():
|
|||||||
print(f"✓ Supported OS detected: {OSREL.get('PRETTY', 'Unknown')}\n")
|
print(f"✓ Supported OS detected: {OSREL.get('PRETTY', 'Unknown')}\n")
|
||||||
|
|
||||||
|
|
||||||
|
def save_installer_config(config: dict):
|
||||||
|
config_path = Path("/data/installer.json")
|
||||||
|
config_path.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
|
config["last_modified"] = time.strftime("%Y-%m-%d %H:%M:%S")
|
||||||
|
|
||||||
|
try:
|
||||||
|
config_path.write_text(json.dumps(config, indent=2), encoding="utf-8")
|
||||||
|
if DEBUG:
|
||||||
|
print(f"✓ Saved installer config to {config_path}")
|
||||||
|
except Exception as e:
|
||||||
|
print(f"⚠ Warning: Could not save installer config: {e}")
|
||||||
|
|
||||||
|
|
||||||
|
def load_installer_config() -> dict:
|
||||||
|
config_path = Path("/data/installer.json")
|
||||||
|
|
||||||
|
if not config_path.exists():
|
||||||
|
if DEBUG:
|
||||||
|
print(f"No installer config found at {config_path}")
|
||||||
|
return {}
|
||||||
|
|
||||||
|
try:
|
||||||
|
content = config_path.read_text(encoding="utf-8")
|
||||||
|
config = json.loads(content)
|
||||||
|
if DEBUG:
|
||||||
|
print(f"✓ Loaded installer config from {config_path}")
|
||||||
|
return config
|
||||||
|
except Exception as e:
|
||||||
|
print(f"⚠ Warning: Could not load installer config: {e}")
|
||||||
|
return {}
|
||||||
|
|
||||||
|
|
||||||
def comment_x_served_by_step(path="/etc/angie/conf.d/include/proxy.conf"):
|
def comment_x_served_by_step(path="/etc/angie/conf.d/include/proxy.conf"):
|
||||||
p = Path(path)
|
p = Path(path)
|
||||||
if not p.exists():
|
if not p.exists():
|
||||||
@@ -2042,6 +2075,19 @@ def update_only(
|
|||||||
if apply_dark:
|
if apply_dark:
|
||||||
apply_dark_mode(**dark_env)
|
apply_dark_mode(**dark_env)
|
||||||
|
|
||||||
|
|
||||||
|
save_installer_config({
|
||||||
|
"ipv6_enabled": ipv6_enabled,
|
||||||
|
"dark_mode_enabled": apply_dark,
|
||||||
|
"tp_theme": dark_env.get("TP_THEME") if apply_dark else None,
|
||||||
|
"tp_domain": dark_env.get("TP_DOMAIN", TP_DOMAIN),
|
||||||
|
"tp_scheme": dark_env.get("TP_SCHEME", TP_SCHEME),
|
||||||
|
"tp_community_theme": dark_env.get("TP_COMMUNITY_THEME", TP_COMMUNITY_THEME),
|
||||||
|
"node_version": node_version,
|
||||||
|
"npm_version": version,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
with step("Restarting services after update"):
|
with step("Restarting services after update"):
|
||||||
run(["systemctl", "restart", "angie.service"], check=False)
|
run(["systemctl", "restart", "angie.service"], check=False)
|
||||||
run(["systemctl", "restart", "npm.service"], check=False)
|
run(["systemctl", "restart", "npm.service"], check=False)
|
||||||
@@ -2209,6 +2255,18 @@ def main():
|
|||||||
selected_theme = None
|
selected_theme = None
|
||||||
|
|
||||||
if args.update:
|
if args.update:
|
||||||
|
installer_config = load_installer_config()
|
||||||
|
|
||||||
|
if not args.tp_theme and installer_config.get("tp_theme"):
|
||||||
|
selected_theme = installer_config["tp_theme"]
|
||||||
|
print(f"✓ Using stored theme: {selected_theme}")
|
||||||
|
|
||||||
|
if not args.dark_mode and installer_config.get("dark_mode_enabled"):
|
||||||
|
args.dark_mode = True
|
||||||
|
print(f"✓ Using stored dark mode setting: enabled")
|
||||||
|
|
||||||
|
stored_ipv6 = installer_config.get("ipv6_enabled", args.enable_ipv6)
|
||||||
|
|
||||||
install_logrotate_for_data_logs()
|
install_logrotate_for_data_logs()
|
||||||
fix_logrotate_permissions_and_wrapper()
|
fix_logrotate_permissions_and_wrapper()
|
||||||
version = update_only(
|
version = update_only(
|
||||||
@@ -2223,7 +2281,7 @@ def main():
|
|||||||
TP_SCHEME=TP_SCHEME,
|
TP_SCHEME=TP_SCHEME,
|
||||||
TP_THEME=args.tp_theme,
|
TP_THEME=args.tp_theme,
|
||||||
),
|
),
|
||||||
ipv6_enabled=args.enable_ipv6,
|
ipv6_enabled=stored_ipv6 if 'stored_ipv6' in locals() else args.enable_ipv6,
|
||||||
)
|
)
|
||||||
info = gather_versions(version)
|
info = gather_versions(version)
|
||||||
update_motd(args.motd == "yes", info, ipv6_enabled=args.enable_ipv6)
|
update_motd(args.motd == "yes", info, ipv6_enabled=args.enable_ipv6)
|
||||||
@@ -2280,6 +2338,18 @@ def main():
|
|||||||
TP_THEME=selected_theme,
|
TP_THEME=selected_theme,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Save installation configuration for future updates
|
||||||
|
save_installer_config({
|
||||||
|
"ipv6_enabled": args.enable_ipv6,
|
||||||
|
"dark_mode_enabled": dark_mode_enabled,
|
||||||
|
"tp_theme": selected_theme,
|
||||||
|
"tp_domain": TP_DOMAIN,
|
||||||
|
"tp_scheme": TP_SCHEME,
|
||||||
|
"tp_community_theme": TP_COMMUNITY_THEME,
|
||||||
|
"node_version": args.node_version,
|
||||||
|
"npm_version": npm_app_version,
|
||||||
|
})
|
||||||
|
|
||||||
create_systemd_units(ipv6_enabled=args.enable_ipv6)
|
create_systemd_units(ipv6_enabled=args.enable_ipv6)
|
||||||
|
|
||||||
ensure_nginx_symlink()
|
ensure_nginx_symlink()
|
||||||
|
|||||||
Reference in New Issue
Block a user