sync configs

This commit is contained in:
Mateusz Gruszczyński
2025-10-23 22:22:18 +02:00
parent 29fedde85d
commit 087d045dcb

View File

@@ -136,6 +136,28 @@ def download_extract_tar_gz(url: str, dest_dir: Path) -> Path:
os.unlink(tf_path) os.unlink(tf_path)
return dest_dir / top 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(): def ensure_nginx_symlink():
from pathlib import Path from pathlib import Path
target = Path("/etc/angie") target = Path("/etc/angie")
@@ -884,6 +906,7 @@ def main():
ensure_nginx_symlink() ensure_nginx_symlink()
install_logrotate_for_data_logs() install_logrotate_for_data_logs()
fix_logrotate_permissions_and_wrapper() fix_logrotate_permissions_and_wrapper()
sync_backup_nginx_conf()
with step("Restarting services after installation"): with step("Restarting services after installation"):
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)