Added new function: set_password(). Sets a password for a given username.
This commit is contained in:
parent
fe69d970a3
commit
93780ba888
|
|
@ -439,6 +439,11 @@ def get_drive_from_part_uuid(partuuid, *positionals, **kwargs):
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def set_password(user, password, *positionals, **kwargs):
|
||||||
|
if not SAFETY_LOCK:
|
||||||
|
o = simple_command("/usr/bin/arch-chroot /mnt sh -c \"echo 'root:{pin}' | chpasswd\"".format(**args, pin=args['password']))
|
||||||
|
return True
|
||||||
|
|
||||||
def update_git(branch='master'):
|
def update_git(branch='master'):
|
||||||
default_gw = get_default_gateway_linux()
|
default_gw = get_default_gateway_linux()
|
||||||
if(default_gw):
|
if(default_gw):
|
||||||
|
|
@ -1405,8 +1410,7 @@ if __name__ == '__main__':
|
||||||
## == Passwords
|
## == Passwords
|
||||||
# o = sys_command('arch-chroot /mnt usermod --password {} root'.format(args['password']))
|
# o = sys_command('arch-chroot /mnt usermod --password {} root'.format(args['password']))
|
||||||
# o = sys_command("arch-chroot /mnt sh -c 'echo {pin} | passwd --stdin root'".format(pin='"{pin}"'.format(**args, pin=args['password'])), echo=True)
|
# o = sys_command("arch-chroot /mnt sh -c 'echo {pin} | passwd --stdin root'".format(pin='"{pin}"'.format(**args, pin=args['password'])), echo=True)
|
||||||
o = simple_command("/usr/bin/arch-chroot /mnt sh -c \"echo 'root:{pin}' | chpasswd\"".format(**args, pin=args['password']))
|
set_password(user='root', password=args['password'])
|
||||||
print(o)
|
|
||||||
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))
|
o = ('/usr/bin/arch-chroot /mnt useradd -m -G wheel {user}'.format(**args))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue