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-03-16 11:14:33 +0100
committerAnton Hvornum <anton.feeds+github@gmail.com>2020-03-16 11:14:33 +0100
commitf800d44b2dbe78fb3bfcd1d593aeff7c5df51819 (patch)
treedfe98533e9eb16ecf2b1cf9ec6780326d47c1bb7
parentef088bc624a84a3a7032d6987dbcd6c0d52deca2 (diff)
New function: create_user(). Simple user creations, not many options for now.
-rw-r--r--archinstall.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/archinstall.py b/archinstall.py
index f27e6686..994ecfe0 100644
--- a/archinstall.py
+++ b/archinstall.py
@@ -1209,6 +1209,16 @@ def run_post_install_steps(*positionals, **kwargs):
return True
+def create_user(username, password='', groups=[]):
+ if username:
+ o = (f'/usr/bin/arch-chroot /mnt useradd -m -G wheel {username}')
+ if password:
+ o = (f"/usr/bin/arch-chroot /mnt sh -c \"echo '{username}:{password}' | chpasswd\"")
+ if groups:
+ for group in groups:
+ o = (f'/usr/bin/arch-chroot /mnt gpasswd -a {username} {group}')
+ return True
+
if __name__ == '__main__':
## Setup some defaults
# (in case no command-line parameters or netdeploy-params were given)
@@ -1430,8 +1440,7 @@ if __name__ == '__main__':
set_password(user='root', password=args['password'])
time.sleep(5)
if 'user' in args:
- o = ('/usr/bin/arch-chroot /mnt useradd -m -G wheel {user}'.format(**args))
- o = ("/usr/bin/arch-chroot /mnt sh -c \"echo '{user}:{pin}' | chpasswd\"".format(**args, pin=args['password']))
+ create_user(args['user'], args['password'])#, groups=['wheel'])
print('[N] Running post installation steps.')
run_post_install_steps()