Fix UEFI snapshot support and ensure sudo privileges
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user