Compare commits

...

2 Commits

Author SHA1 Message Date
1fa253dfff chore: remove dir before extract 2026-03-12 20:19:29 +07:00
a606febb5d chore: add support for angie 2026-03-12 20:18:22 +07:00

View File

@@ -1,7 +1,9 @@
#!/usr/bin/env python3
import json
import shutil
import subprocess
import sys
from pathlib import Path
# Compatibility with Angie
exec_name = "nginx"
@@ -33,10 +35,16 @@ def get_nginx_info() -> tuple[str | None, str | None]:
def download_and_unpack(url: str) -> str:
print(f"Downloading '{url}'...")
file_name = url.split("/")[-1]
if Path(file_name).exists():
print(f"File '{file_name}' already exists. Skipping download.")
else:
subprocess.call(["wget", url])
file_name_without_ext = file_name.rsplit(".", 2)[0] # Remove .tar.gz
shutil.rmtree(
file_name_without_ext, ignore_errors=True
) # Remove existing dir if exists
print("Unpacking...")
subprocess.call(["tar", "zxvf", file_name])
file_name_without_ext = file_name.rsplit(".", 2)[0] # Remove .tar.gz
print(f"Download and unpack complete: {file_name} to {file_name_without_ext}")
return file_name_without_ext
@@ -61,7 +69,7 @@ def main():
if exec_name == "nginx":
nginx_url = f"http://nginx.org/download/nginx-{version}.tar.gz"
elif exec_name == "angie":
nginx_url = ""
nginx_url = f"https://download.angie.software/files/angie-{version}.tar.gz"
else:
print(f"Unknown executable name: {exec_name}. Exiting.")
return