diff options
author | crupest <crupest@outlook.com> | 2022-10-31 20:14:32 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2022-10-31 20:14:32 +0800 |
commit | 16bc28ac505aabd9da7dce085054a86db7904d6e (patch) | |
tree | 373c34c6cc699ddde1d09e5755666b1ae260c27c /tool/download.py | |
parent | efdfc6feb5744d8ad4bd07e35fa8d662925e3e96 (diff) | |
download | crupest-16bc28ac505aabd9da7dce085054a86db7904d6e.tar.gz crupest-16bc28ac505aabd9da7dce085054a86db7904d6e.tar.bz2 crupest-16bc28ac505aabd9da7dce085054a86db7904d6e.zip |
...
Diffstat (limited to 'tool/download.py')
-rwxr-xr-x | tool/download.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tool/download.py b/tool/download.py new file mode 100755 index 0000000..a77daa1 --- /dev/null +++ b/tool/download.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python3 + +import os.path + +SCRIPTS = [("docker-mailserver setup script", "docker-mailserver-setup.sh", + "https://raw.githubusercontent.com/docker-mailserver/docker-mailserver/master/setup.sh")] + +this_script_dir = os.path.dirname(os.path.relpath(__file__)) + +for script in SCRIPTS: + name, filename, url = script + path = os.path.join(this_script_dir, filename) + skip = False + if os.path.exists(path): + print(f"{name} already exists, download and overwrite? (y/N)", end=" ") + if input() != "y": + skip = True + else: + print(f"Download {name} to {path}? (Y/n)", end=" ") + if input() == "n": + skip = True + if not skip: + print(f"Downloading {name}...") + os.system(f"curl -s {url} > {path} && chmod +x {path}") + print(f"Downloaded {name} to {path}.") + else: + print(f"Skipped {name}.") |