Skip to content

Commit

Permalink
Fix adding user to sudoers
Browse files Browse the repository at this point in the history
  • Loading branch information
pkgdemon committed Jan 14, 2024
1 parent de07f7d commit 322e887
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions installer/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,12 +230,14 @@ def user():
# Set PASSWORD for the user
subprocess.run(["chroot", MNT, "chpasswd"], input=f"{USERNAME}:{PASSWORD}\n", text=True, check=True)

# Enable sudo for the wheel group
subprocess.run(["chroot", MNT, "sed", "-i", "/%wheel ALL=(ALL) ALL/s/^# //", "/etc/sudoers"], check=True)

# Remove sddm.conf autologin
subprocess.run(["chroot", MNT, "rm", "/etc/sddm.conf.d/autologin.conf"], check=True)

# Add user to sudoers.d
with open(f"{sudoers_dir}/00_{USERNAME}", "w", encoding="utf-8") as sudoers_file:
sudoers_file.write(f"{USERNAME} ALL=(ALL) ALL\n")
sudoers_file.write(f"{USERNAME} ALL=(ALL) ALL\n")

# Remove installer from installed system
subprocess.run(["rm", "-rf", f"{MNT}/maloneyos"], check=True)

Expand Down

0 comments on commit 322e887

Please sign in to comment.