From 7613bdf8d53a6d4f88e98095e8209c7053af9ce2 Mon Sep 17 00:00:00 2001 From: N0VA Date: Thu, 5 Feb 2026 17:03:36 +0100 Subject: [PATCH] Fix password setting and inhibit system sleep during install --- iridium_installer/backend/os_install.py | 15 +++++++++++++-- iridium_installer/ui/window.py | 8 ++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/iridium_installer/backend/os_install.py b/iridium_installer/backend/os_install.py index 1fe5cf8..f604bcf 100644 --- a/iridium_installer/backend/os_install.py +++ b/iridium_installer/backend/os_install.py @@ -237,8 +237,19 @@ UUID={efi_uuid} /boot vfat defaults 0 2 run_command(["chroot", mount_root, "useradd", "-m", "-G", "wheel", user_info["username"]]) # Set password - p = subprocess.Popen(["chroot", mount_root, "chpasswd"], stdin=subprocess.PIPE, text=True) - p.communicate(input=f"{user_info['username']}:{user_info['password']}") + try: + logger.info("Setting user password...") + p = subprocess.run( + ["chroot", mount_root, "chpasswd"], + input=f"{user_info['username']}:{user_info['password']}\n", + text=True, + check=True, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE + ) + except subprocess.CalledProcessError as e: + logger.error(f"Failed to set password: {e.stderr}") + raise e # Ensure wheel group has sudo privileges sudoers_dir = os.path.join(mount_root, "etc/sudoers.d") diff --git a/iridium_installer/ui/window.py b/iridium_installer/ui/window.py index cdbff1b..de81a7d 100644 --- a/iridium_installer/ui/window.py +++ b/iridium_installer/ui/window.py @@ -465,6 +465,14 @@ class InstallerWindow(Adw.ApplicationWindow): # Show success in UI even in mock self.show_finish_page("Mock Installation Complete!") else: + # Inhibit logout/suspend + app = self.get_application() + self.inhibit_cookie = app.inhibit( + self, + Gtk.ApplicationInhibitFlags.LOGOUT | Gtk.ApplicationInhibitFlags.SUSPEND, + "Installing Operating System" + ) + self.show_progress_page("Installing Iridium OS...") thread = threading.Thread( target=self.run_installation,