Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update builder.py(Support low version of Python 3) #2

Merged
merged 1 commit into from
Dec 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 12 additions & 19 deletions core/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,27 +34,20 @@ def container_start(self):
self.container = self.client.containers.run(**container_params)

def container_change_repository(self):
match self.banner_release:
case "ubuntu":
logging.info(
"[+] {}".format("sed -i 's@//.*archive.ubuntu.com@//mirrors.ustc.edu.cn@g' /etc/apt/sources.list"))
self.container.exec_run(
"sed -i 's@//.*archive.ubuntu.com@//mirrors.ustc.edu.cn@g' /etc/apt/sources.list")
logging.info(
"[+] {}".format("sed -i 's@//.*security.ubuntu.com@//mirrors.ustc.edu.cn@g' /etc/apt/sources.list"))
self.container.exec_run(
"sed -i 's@//.*security.ubuntu.com@//mirrors.ustc.edu.cn@g' /etc/apt/sources.list")
exec_result = self.container.exec_run("apt-get update")
logging.debug(exec_result.output.decode("utf-8").strip())
if self.banner_release == "ubuntu":
logging.info("[+] {}".format("sed -i 's@//.*archive.ubuntu.com@//mirrors.ustc.edu.cn@g' /etc/apt/sources.list"))
self.container.exec_run("sed -i 's@//.*archive.ubuntu.com@//mirrors.ustc.edu.cn@g' /etc/apt/sources.list")
logging.info("[+] {}".format("sed -i 's@//.*security.ubuntu.com@//mirrors.ustc.edu.cn@g' /etc/apt/sources.list"))
self.container.exec_run("sed -i 's@//.*security.ubuntu.com@//mirrors.ustc.edu.cn@g' /etc/apt/sources.list")
exec_result = self.container.exec_run("apt-get update")
logging.debug(exec_result.output.decode("utf-8").strip())

def container_install_dependency(self):
dependency_ubuntu = ["wget", "unzip", "dwarfdump", "build-essential", "kmod", "linux-base", "gcc-10", "gcc-11",
"gcc-12"]
match self.banner_release:
case "ubuntu":
logging.info("[+] {}".format("apt-get install -y " + " ".join(dependency_ubuntu)))
exec_result = self.container.exec_run("apt-get install -y " + " ".join(dependency_ubuntu))
logging.debug(exec_result.output.decode("utf-8").strip())
dependency_ubuntu = ["wget", "unzip", "dwarfdump", "build-essential", "kmod", "linux-base", "gcc-10", "gcc-11", "gcc-12"]
if self.banner_release == "ubuntu":
logging.info("[+] {}".format("apt-get install -y " + " ".join(dependency_ubuntu)))
exec_result = self.container.exec_run("apt-get install -y " + " ".join(dependency_ubuntu))
logging.debug(exec_result.output.decode("utf-8").strip())

def container_install_debs(self):
repository_url = key_repository[self.banner_release]
Expand Down