diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2013-04-14 15:09:05 +0000 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2013-04-14 15:09:05 +0000 |
commit | 9a9cdba02e32064d0580d17700951476808d61e0 (patch) | |
tree | f18bd58ce55f54d5ffab05694953d928a7e5c106 | |
parent | fbeb29535b39f9517034e21b14499b2bc3c1bac3 (diff) | |
download | live-9a9cdba02e32064d0580d17700951476808d61e0.tar.gz |
Set root password
-rwxr-xr-x | install | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -726,12 +726,30 @@ def mount_in_bootenv(): call(['mount', '-F' , 'fd', '-', rootdir + '/dev/fd'], stdout=PIPE, stderr=PIPE) call(['mount', '-F' , 'proc', '-', rootdir + '/proc'], stdout=PIPE, stderr=PIPE) +def set_root_password(): + entry1 = Entry(width=30, password=1, returnExit=0) + entry2 = Entry(width=30, password=1, returnExit=1) + passwd = None + while not passwd: + choice, entries = EntryWindow(screen, title='Set root password', + text='Enter the root password. The password is not shown, you have to type it twice.', + prompts=[('Password', entry1), ('Confirm', entry2)], + allowCancel=0, width=40, entryWidth=30, buttons=['Ok']) + if entries[0] == entries[1]: + passwd = entries[0] + else: + ButtonChoiceWindow(screen, title='Error', + text='Entries do not match. Try again.', buttons=['Ok']) + chpasswd_cmd = Popen(['chpasswd', '-R', rootdir], stderr=PIPE, stdout=PIPE, stdin=PIPE) + chpasswd_cmd.communicate(input='root:'+passwd) + def configure_bootenv(): write_vfstab() mount_in_bootenv() in_bootenv(['/sbin/devfsadm']) configure_packages() configure_network() + set_root_password() create_bootarchive() |