diff --git a/install.py b/install.py index 65de56b..917134c 100755 --- a/install.py +++ b/install.py @@ -63,11 +63,10 @@ class Installer: this_stderr: Optional[int] = subprocess.DEVNULL if self.hide_commands else None if operating_system in ("arch", "manjaro"): - operating_system = "arch" # On Arch-based systems, will update while installing packages + pass elif operating_system in ("debian", "ubuntu"): - operating_system = "debian" subprocess.run( "sudo apt update", check=True, @@ -204,14 +203,13 @@ class Installer: except KeyError: ui.warning("No packages for {}".format(self.operating_system)) - failed_installs = [] - # defaults for subprocess.run() this_stdout: Optional[int] = subprocess.DEVNULL if self.hide_commands else None this_stderr: Optional[int] = subprocess.DEVNULL if self.hide_commands else None ui.info_2("Installing packages...") + # On Arch-based OS, update the system first if self.operating_system == "arch": subprocess.run( "sudo pacman -Syu", @@ -221,37 +219,21 @@ class Installer: stderr=this_stderr, ) - for i, package in enumerate(packages): - if self.operating_system == "arch": - command = "sudo pacman -S --needed --noconfirm {}".format(package) - elif self.operating_system == "debian": - command = "sudo apt install -y {}".format(package) - - ui.info_count(i, len(packages), package, end="... ") - - install = subprocess.run( - command, - check=False, - shell=True, - stdout=this_stdout, - stderr=this_stderr, + if self.operating_system == "arch": + command = "sudo pacman -S --needed --noconfirm {}".format( + " ".join(packages) ) + elif self.operating_system == "debian": + command = "sudo apt install -y {}".format(" ".join(packages)) - if install.returncode != 0: - ui.info(ui.cross) - failed_installs.append(package) - else: - ui.info(ui.check) - - if len(failed_installs) > 0: - ui.warning("These packages failed to install:") - - for failed in failed_installs: - ui.info(" ", failed) - - ui.warning( - f"Are the packages really meant for {self.operating_system} systems?" - ) + assert command + subprocess.run( + command, + check=False, + shell=True, + stdout=this_stdout, + stderr=this_stderr, + ) def do_include(self, yml_file: str) -> None: """Include an additional config file."""