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"]])
|
||||
|
||||
# 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")
|
||||
|
||||
Reference in New Issue
Block a user