Dynamically adjust url and gpg key

This commit is contained in:
Marcel Schwarz 2020-03-11 00:16:39 +01:00
parent 76c5dc8363
commit df127f63e2

View File

@ -38,18 +38,21 @@ class ToolsInstaller:
if "download.docker.com/linux/" not in line.lower(): if "download.docker.com/linux/" not in line.lower():
print("apt-repo is not installed, setting up docker apt-key") print("apt-repo is not installed, setting up docker apt-key")
if "ubuntu" in platform.version().lower(): if "ubuntu" in platform.version().lower():
subprocess.run("curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -", linux_distro = "ubuntu"
shell=True)
subprocess.run("apt-key fingerprint 0EBFCD88", shell=True)
subprocess.run("add-apt-repository "
"\"deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable\"",
shell=True)
elif "debian" in platform.version().lower(): elif "debian" in platform.version().lower():
subprocess.run("curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -", linux_distro = "debian"
else:
print("Version not supported by this installer")
return
subprocess.run("curl -fsSL "
f"https://download.docker.com/linux/${linux_distro}/gpg "
"| sudo apt-key add -",
shell=True) shell=True)
subprocess.run("apt-key fingerprint 0EBFCD88", shell=True) subprocess.run("apt-key fingerprint 0EBFCD88", shell=True)
subprocess.run("add-apt-repository " subprocess.run("add-apt-repository \"deb [arch=amd64] "
"\"deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable\"", f"https://download.docker.com/linux/${linux_distro}"
"$(lsb_release -cs) stable\"",
shell=True) shell=True)
else: else:
print("skip adding of the key") print("skip adding of the key")