Fix UEFI snapshot support and ensure sudo privileges

This commit is contained in:
2026-02-05 14:23:44 +01:00
parent 4eff9d7e22
commit e5f46324e4
2 changed files with 16 additions and 5 deletions

View File

@@ -190,6 +190,13 @@ UUID={efi_uuid} /boot vfat defaults 0 2
p = subprocess.Popen(["chroot", mount_root, "chpasswd"], stdin=subprocess.PIPE, text=True)
p.communicate(input=f"{user_info['username']}:{user_info['password']}")
# Ensure wheel group has sudo privileges
sudoers_dir = os.path.join(mount_root, "etc/sudoers.d")
os.makedirs(sudoers_dir, exist_ok=True)
with open(os.path.join(sudoers_dir, "wheel"), "w") as f:
f.write("%wheel ALL=(ALL) ALL\n")
os.chmod(os.path.join(sudoers_dir, "wheel"), 0o440)
# Set hostname
with open(os.path.join(mount_root, "etc/hostname"), "w") as f:
f.write(user_info["hostname"] + "\n")