Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Hvornum <anton.feeds+github@gmail.com>2020-08-31 21:38:28 +0200
committerAnton Hvornum <anton.feeds+github@gmail.com>2020-08-31 21:38:28 +0200
commite4b9ad9d37704eb9cac725a7b5b44ad05b244fdd (patch)
treeabae6691586114d08db64f286c516805b4ddfc09
parentb91699c0e55cc43581d8f1d84886d296e02611de (diff)
Forgot the syntax of sudoers apparently. Corrected.
-rw-r--r--archinstall/lib/installer.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py
index 7c2c976a..a9470b7c 100644
--- a/archinstall/lib/installer.py
+++ b/archinstall/lib/installer.py
@@ -59,7 +59,7 @@ class Installer():
raise args[1]
if not (missing_steps := self.post_install_check()):
- log('Installation completed without any errors.', bg='black', fg='green')
+ log('Installation completed without any errors. You may now reboot.', bg='black', fg='green')
return True
else:
log('Some required steps were not successfully installed/configured before leaving the installer:', bg='black', fg='red')
@@ -213,19 +213,23 @@ class Installer():
log(f'Installing network profile {profile}')
return profile.install()
+ def enable_sudo(self, entity :str, group=False):
+ log(f'Enabling sudo permissions for {entity}.')
+ with open(f'{self.mountpoint}/etc/sudoers', 'a') as sudoers:
+ sudoers.write(f'{"%" if group else ""}{entity} ALL=(ALL) ALL\n')
+ return True
+
def user_create(self, user :str, password=None, groups=[], sudo=False):
log(f'Creating user {user}')
o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.mountpoint} useradd -m -G wheel {user}'))
if password:
self.user_set_pw(user, password)
+
if groups:
for group in groups:
o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.mountpoint} gpasswd -a {user} {group}'))
- if sudo:
- with open(f'{self.mountpoint}/etc/sudoers', 'a') as sudoers:
- sudoers.write(f'{user}\n')
-
+ if sudo and self.enable_sudo(user):
self.helper_flags['user'] = True
def user_set_pw(self, user, password):