From 9a9cdba02e32064d0580d17700951476808d61e0 Mon Sep 17 00:00:00 2001 From: Igor Pashev Date: Sun, 14 Apr 2013 15:09:05 +0000 Subject: Set root password --- install | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/install b/install index 3157324..1a69261 100755 --- a/install +++ b/install @@ -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() -- cgit v1.2.3