Use pacman -Syu {package} instead of -S {package} to avoid updating when not installing

This commit is contained in:
flyingscorpio@pinebookpro 2021-06-29 09:55:53 +02:00
parent 2170c19ce2
commit 0e2920d658

View file

@ -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)