New function: create_user(). Simple user creations, not many options for now.
This commit is contained in:
parent
ef088bc624
commit
f800d44b2d
|
|
@ -1209,6 +1209,16 @@ def run_post_install_steps(*positionals, **kwargs):
|
||||||
|
|
||||||
return True
|
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__':
|
if __name__ == '__main__':
|
||||||
## Setup some defaults
|
## Setup some defaults
|
||||||
# (in case no command-line parameters or netdeploy-params were given)
|
# (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'])
|
set_password(user='root', password=args['password'])
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
if 'user' in args:
|
if 'user' in args:
|
||||||
o = ('/usr/bin/arch-chroot /mnt useradd -m -G wheel {user}'.format(**args))
|
create_user(args['user'], args['password'])#, groups=['wheel'])
|
||||||
o = ("/usr/bin/arch-chroot /mnt sh -c \"echo '{user}:{pin}' | chpasswd\"".format(**args, pin=args['password']))
|
|
||||||
|
|
||||||
print('[N] Running post installation steps.')
|
print('[N] Running post installation steps.')
|
||||||
run_post_install_steps()
|
run_post_install_steps()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue