From 5c76a1257b4a058bf919af3e31cc9461a39c2f33 Mon Sep 17 00:00:00 2001 From: crupest Date: Mon, 11 Nov 2024 01:12:29 +0800 Subject: HALF WORK: 2024.1.20 - 2 --- tools/cru-py/crupest/download_tools.py | 47 ---------------------------------- 1 file changed, 47 deletions(-) delete mode 100644 tools/cru-py/crupest/download_tools.py (limited to 'tools/cru-py/crupest/download_tools.py') diff --git a/tools/cru-py/crupest/download_tools.py b/tools/cru-py/crupest/download_tools.py deleted file mode 100644 index beb06d4..0000000 --- a/tools/cru-py/crupest/download_tools.py +++ /dev/null @@ -1,47 +0,0 @@ -import sys -from os.path import * -from urllib.request import * -from rich.prompt import Confirm -from .path import * -from .helper import print_order - - -TOOLS = [("docker-mailserver setup script", "docker-mailserver-setup.sh", - "https://raw.githubusercontent.com/docker-mailserver/docker-mailserver/master/setup.sh")] - - -def download_tools(console): - # if we are not linux, we prompt the user - if sys.platform != "linux": - console.print( - "You are not running this script on linux. The tools will not work.", style="yellow") - if not Confirm.ask("Do you want to continue?", default=False, console=console): - return - - for index, script in enumerate(TOOLS): - number = index + 1 - total = len(TOOLS) - print_order(number, total, console) - name, filename, url = script - # if url is callable, call it - if callable(url): - url = url() - path = join(tool_dir, filename) - skip = False - if exists(path): - overwrite = Confirm.ask( - f"[cyan]{name}[/] already exists, download and overwrite?", default=False, console=console) - if not overwrite: - skip = True - else: - download = Confirm.ask( - f"Download [cyan]{name}[/] to [magenta]{path}[/]?", default=True, console=console) - if not download: - skip = True - if not skip: - console.print(f"Downloading {name}...") - urlretrieve(url, path) - os.chmod(path, 0o755) - console.print(f"Downloaded {name} to {path}.", style="green") - else: - console.print(f"Skipped {name}.", style="yellow") -- cgit v1.2.3