Fix password setting and inhibit system sleep during install

This commit is contained in:
2026-02-05 17:03:36 +01:00
parent 400235067d
commit 7613bdf8d5
2 changed files with 21 additions and 2 deletions

View File

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