aboutsummaryrefslogtreecommitdiff
path: root/tools/cru-py/crupest/download_tools.py
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2024-11-11 01:12:29 +0800
committerYuqian Yang <crupest@crupest.life>2025-01-20 22:34:18 +0800
commit5c76a1257b4a058bf919af3e31cc9461a39c2f33 (patch)
treecb32f0c22e5438a0ed9de4b29f58d0b7f142a58d /tools/cru-py/crupest/download_tools.py
parent12e1272508ba0b5909069319007d677c1c76e355 (diff)
downloadcrupest-5c76a1257b4a058bf919af3e31cc9461a39c2f33.tar.gz
crupest-5c76a1257b4a058bf919af3e31cc9461a39c2f33.tar.bz2
crupest-5c76a1257b4a058bf919af3e31cc9461a39c2f33.zip
HALF WORK: 2024.1.20 - 2
Diffstat (limited to 'tools/cru-py/crupest/download_tools.py')
-rw-r--r--tools/cru-py/crupest/download_tools.py47
1 files changed, 0 insertions, 47 deletions
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")