Fix password setting and inhibit system sleep during install
This commit is contained in:
@@ -237,8 +237,19 @@ UUID={efi_uuid} /boot vfat defaults 0 2
|
|||||||
run_command(["chroot", mount_root, "useradd", "-m", "-G", "wheel", user_info["username"]])
|
run_command(["chroot", mount_root, "useradd", "-m", "-G", "wheel", user_info["username"]])
|
||||||
|
|
||||||
# Set password
|
# Set password
|
||||||
p = subprocess.Popen(["chroot", mount_root, "chpasswd"], stdin=subprocess.PIPE, text=True)
|
try:
|
||||||
p.communicate(input=f"{user_info['username']}:{user_info['password']}")
|
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
|
# Ensure wheel group has sudo privileges
|
||||||
sudoers_dir = os.path.join(mount_root, "etc/sudoers.d")
|
sudoers_dir = os.path.join(mount_root, "etc/sudoers.d")
|
||||||
|
|||||||
@@ -465,6 +465,14 @@ class InstallerWindow(Adw.ApplicationWindow):
|
|||||||
# Show success in UI even in mock
|
# Show success in UI even in mock
|
||||||
self.show_finish_page("Mock Installation Complete!")
|
self.show_finish_page("Mock Installation Complete!")
|
||||||
else:
|
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...")
|
self.show_progress_page("Installing Iridium OS...")
|
||||||
thread = threading.Thread(
|
thread = threading.Thread(
|
||||||
target=self.run_installation,
|
target=self.run_installation,
|
||||||
|
|||||||
Reference in New Issue
Block a user