From 0e2920d65895c634d6bf2fa13c18fce7f963492e Mon Sep 17 00:00:00 2001 From: "flyingscorpio@pinebookpro" Date: Tue, 29 Jun 2021 09:55:53 +0200 Subject: [PATCH] Use pacman -Syu {package} instead of -S {package} to avoid updating when not installing --- install.py | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/install.py b/install.py index e11dfd2..74c296a 100755 --- a/install.py +++ b/install.py @@ -63,24 +63,22 @@ class Installer: this_stderr: Optional[int] = subprocess.DEVNULL if self.hide_commands else None if operating_system in ("arch", "manjaro"): - command = "sudo pacman -Syu" operating_system = "arch" + # On Arch-based systems, will update while installing packages elif operating_system in ("debian", "ubuntu"): - command = "sudo apt update" operating_system = "debian" + subprocess.run( + "sudo apt update", + check=True, + shell=True, + stdout=this_stdout, + stderr=this_stderr, + ) else: raise AssertionError("The operating system should have been defined") - subprocess.run( - command, - check=True, - shell=True, - stdout=this_stdout, - stderr=this_stderr, - ) - def evaluate_condition(self, condition: str) -> bool: """Run a bash command. On success return True, else return False.""" @@ -215,7 +213,7 @@ class Installer: ui.info_2("Installing packages...") for i, package in enumerate(packages): if self.operating_system == "arch": - command = "sudo pacman -S --needed --noconfirm {}".format(package) + command = "sudo pacman -Syu --needed --noconfirm {}".format(package) elif self.operating_system == "debian": command = "sudo apt install -y {}".format(package)