From 873c9b4e39e47d2e6e1dbf40ee6f2e812c229adb Mon Sep 17 00:00:00 2001 From: crupest Date: Mon, 28 Nov 2022 13:05:32 +0800 Subject: Make io more maintainable. --- tool/modules/install_docker.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 tool/modules/install_docker.py (limited to 'tool/modules/install_docker.py') diff --git a/tool/modules/install_docker.py b/tool/modules/install_docker.py new file mode 100644 index 0000000..ac50290 --- /dev/null +++ b/tool/modules/install_docker.py @@ -0,0 +1,16 @@ +from os.path import * +from .path import * +import urllib +import subprocess + + +def install_docker(): + ensure_tmp_dir() + get_docker_path = join(tmp_dir, "get-docker.sh") + urllib.request.urlretrieve("https://get.docker.com", get_docker_path) + os.chmod(get_docker_path, 0o755) + subprocess.run(["sudo", "sh", get_docker_path], check=True) + subprocess.run(["sudo", "systemctl", "enable", + "--now", "docker"], check=True) + subprocess.run(["sudo", "usermod", "-aG", "docker", + os.getlogin()], check=True) -- cgit v1.2.3