Compare commits
2 Commits
a1bdc79343
...
1fa253dfff
| Author | SHA1 | Date | |
|---|---|---|---|
| 1fa253dfff | |||
| a606febb5d |
@@ -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]
|
||||
subprocess.call(["wget", url])
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user