Compare commits

...

6 Commits

Author SHA1 Message Date
7106aa35e4 fix: fix 2026-03-12 22:18:12 +07:00
dd6272233c fix: new format 2026-03-12 22:15:49 +07:00
5194a27fd4 chore: abc 2026-03-12 22:10:20 +07:00
89d4fcfe42 fix: real fix 2026-03-12 22:08:13 +07:00
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
2 changed files with 33 additions and 13 deletions

View File

@@ -1,7 +1,9 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import json import json
import shutil
import subprocess import subprocess
import sys import sys
from pathlib import Path
# Compatibility with Angie # Compatibility with Angie
exec_name = "nginx" exec_name = "nginx"
@@ -30,15 +32,24 @@ def get_nginx_info() -> tuple[str | None, str | None]:
return (None, None) return (None, None)
def download_and_unpack(url: str) -> str: def download_and_unpack(module: dict | str) -> str:
if isinstance(module, str):
module = {"name": module.split("/")[-1].rsplit(".", 2)[0], "url": module}
url = module["url"]
print(f"Downloading '{url}'...") print(f"Downloading '{url}'...")
file_name = url.split("/")[-1] file_name = url.split("/")[-1]
if Path(file_name).exists():
print(f"File '{file_name}' already exists. Skipping download.")
else:
subprocess.call(["wget", url]) 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...") print("Unpacking...")
subprocess.call(["tar", "zxvf", file_name]) 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}") print(f"Download and unpack complete: {file_name} to {file_name_without_ext}")
return file_name_without_ext return module["name"]
def main(): def main():
@@ -61,7 +72,7 @@ def main():
if exec_name == "nginx": if exec_name == "nginx":
nginx_url = f"http://nginx.org/download/nginx-{version}.tar.gz" nginx_url = f"http://nginx.org/download/nginx-{version}.tar.gz"
elif exec_name == "angie": elif exec_name == "angie":
nginx_url = "" nginx_url = f"https://download.angie.software/files/angie-{version}.tar.gz"
else: else:
print(f"Unknown executable name: {exec_name}. Exiting.") print(f"Unknown executable name: {exec_name}. Exiting.")
return return
@@ -70,7 +81,7 @@ def main():
module_source_dirs = [] module_source_dirs = []
for module in config["modules"]: for module in config["modules"]:
print(f"Downloading module: {module['name']}") print(f"Downloading module: {module['name']}")
module_source_dir = download_and_unpack(module["url"]) module_source_dir = download_and_unpack(module)
print(f"Module '{module['name']}' downloaded successfully.") print(f"Module '{module['name']}' downloaded successfully.")
module_source_dirs.append(module_source_dir) module_source_dirs.append(module_source_dir)
# Configure and build modules # Configure and build modules
@@ -79,13 +90,10 @@ def main():
subprocess.call(["./configure", "--with-compat", *args], cwd=source_dir) subprocess.call(["./configure", "--with-compat", *args], cwd=source_dir)
subprocess.call(["make", "modules"], cwd=source_dir) subprocess.call(["make", "modules"], cwd=source_dir)
# Copy .so files to module path # Copy .so files to module path
for module in config["modules"]: for child in Path(f"{source_dir}/objs").iterdir():
module_name = module["name"] if child.suffix == ".so":
so_file = f"{module_name}.so" print(f"Copying module: {child.name}")
source_so_path = f"{source_dir}/objs/{so_file}" subprocess.call(["cp", child.resolve(), module_path])
dest_so_path = f"{module_path}/{so_file}"
print(f"Copying {source_so_path} to {dest_so_path}...")
subprocess.call(["cp", source_so_path, dest_so_path])
print("All modules installed successfully.") print("All modules installed successfully.")

View File

@@ -0,0 +1,12 @@
{
"modules": [
{
"name": "ngx_http_geoip2_module-3.4",
"url": "https://github.com/leev/ngx_http_geoip2_module/archive/refs/tags/3.4.tar.gz"
},
{
"name": "ngx_http_image_filter_module-master",
"url": "https://github.com/linsongze/ngx_http_image_filter_module/archive/refs/heads/master.tar.gz"
}
]
}