diff --git a/npm_install.py b/npm_install.py index 251ef33..1ee7308 100644 --- a/npm_install.py +++ b/npm_install.py @@ -136,6 +136,28 @@ def download_extract_tar_gz(url: str, dest_dir: Path) -> Path: os.unlink(tf_path) return dest_dir / top +# === NA GÓRZE pliku, obok innych utili === +def sync_backup_nginx_conf(): + from pathlib import Path + import shutil, filecmp + src = Path("/etc/nginx.bak/conf.d") + dst = Path("/etc/angie/conf.d") + if not src.exists(): + return + with step("Sync /etc/nginx.bak/conf.d -> /etc/angie/conf.d"): + for p in src.rglob("*"): + if p.is_dir(): + continue + rel = p.relative_to(src) + target = dst / rel + target.parent.mkdir(parents=True, exist_ok=True) + try: + if not target.exists() or not filecmp.cmp(p, target, shallow=False): + shutil.copy2(p, target) + except Exception as e: + print(f"Warning: sync failed for {p} -> {target}: {e}") + + def ensure_nginx_symlink(): from pathlib import Path target = Path("/etc/angie") @@ -884,6 +906,7 @@ def main(): ensure_nginx_symlink() install_logrotate_for_data_logs() fix_logrotate_permissions_and_wrapper() + sync_backup_nginx_conf() with step("Restarting services after installation"): run(["systemctl","restart","angie.service"], check=False) run(["systemctl","restart","npm.service"], check=False)