Пример #1
0
    def act_instpkg_prepare(self, tdata, data):
        self.probe_all_disc_result = tdata
        dolog('probe_all_disc_result: %s\n' % str(self.probe_all_disc_result))
        (pafile, dev, fstype, reldir, bootiso_relpath) = CF.G.choosed_patuple
        self.donepkg = 0
        self.cursize = 0
        self.starttime = time.time()

        self.tadlg.name_map['totalpkg'].set_text(str(self.totalpkg))
        self.tadlg.name_map['donepkg'].set_text(str(self.donepkg))
        self.tadlg.name_map['remainpkg'].set_text(str(self.totalpkg))
        self.tadlg.name_map['totalsize'].set_text(self.szfmt(self.totalsize))
        self.tadlg.name_map['donesize'].set_text(self.szfmt(0))
        self.tadlg.name_map['remainsize'].set_text(self.szfmt(self.totalsize))
        self.tadlg.name_map['totaltime'].set_text('--:--:--')
        self.tadlg.name_map['elapsed'].set_text('--:--:--')
        self.tadlg.name_map['remaintime'].set_text('--:--:--')

        self.add_action(None,
                        self.act_instpkg_disc_start, 0,
                        'instpkg_prep', (dev, fstype, bootiso_relpath, reldir), 
                                        self.installmode, 
                                        { '/': (CF.G.root_device, get_devinfo(CF.G.root_device, CF.G.all_part_infor).fstype),
                                          '/boot': (CF.G.boot_device, get_devinfo(CF.G.boot_device, CF.G.all_part_infor).fstype),
                                          'swap': (CF.G.swap_device, get_devinfo(CF.G.swap_device, CF.G.all_part_infor).fstype),
                                          },
                        )
Пример #2
0
    def gather_setup_information(self):
        # Get account information
        CF.ACCOUNT.rootpasswd = self.get_data(self.values,
                                              'accounts.root.password')
        CF.ACCOUNT.acclist = []
        accnode = self.srh_data_node(self.values, 'accounts.userlist')
        for node in accnode.getElementsByTagName('row'):
            CF.ACCOUNT.acclist.append((
                node.getAttribute('c0'),  # Username.
                node.getAttribute('c1'),  # Password.
                node.getAttribute('c2'),  # Shell.
                node.getAttribute('c3'),  # Home directory.
                node.getAttribute('c4')))  # Real UID or 'Auto'.
        logger.i('takeactions setup_accounts %s' % str(
            (CF.ACCOUNT.rootpasswd, CF.ACCOUNT.acclist)))

        # Get bootloader information
        CF.BOOTLDR.bltype = self.get_data(self.values, 'bootloader.bltype')
        CF.BOOTLDR.instpos = self.get_data(self.values, 'bootloader.instpos')
        CF.BOOTLDR.mbr_device = self.get_data(self.values,
                                              'bootloader.mbr_device')
        CF.BOOTLDR.win_device = self.get_data(self.values,
                                              'bootloader.win_device')
        if CF.BOOTLDR.bltype == 'none':
            logger.i('takeactions get bootloader: bltype %s' %
                     CF.BOOTLDR.bltype)
        else:
            if CF.G.root_device == CF.G.boot_device:
                CF.BOOTLDR.bootdev = ''
            else:
                CF.BOOTLDR.bootdev = CF.G.boot_device
            if CF.BOOTLDR.win_device:
                CF.BOOTLDR.win_fs = get_devinfo(CF.BOOTLDR.win_device,
                                                CF.G.all_part_infor).fstype
            else:
                CF.BOOTLDR.win_fs = ''
            CF.BOOTLDR.timeout = int(
                float(self.get_data(self.values, 'bootloader.timeout')))
            CF.BOOTLDR.usepassword = self.get_data(self.values,
                                                   'bootloader.usepassword')
            CF.BOOTLDR.password = self.get_data(self.values,
                                                'bootloader.password')
            CF.BOOTLDR.lba = self.get_data(self.values, 'bootloader.lba')
            CF.BOOTLDR.options = self.get_data(self.values,
                                               'bootloader.options')
            CF.BOOTLDR.entries = []
            elnode = self.srh_data_node(self.values, 'bootloader.entrylist')
            for node in elnode.getElementsByTagName('row'):
                CF.BOOTLDR.entries.append(
                    (node.getAttribute('c1'), node.getAttribute('c2'),
                     node.getAttribute('c3')))
            self.default = self.get_data(self.values, 'bootloader.default')
            logger.i('takeactions get bootloader: %s' % str(
                ('setup_' + CF.BOOTLDR.bltype, CF.BOOTLDR.timeout,
                 CF.BOOTLDR.usepassword, CF.BOOTLDR.password, CF.BOOTLDR.lba,
                 CF.BOOTLDR.options, CF.BOOTLDR.entries, CF.BOOTLDR.default,
                 CF.BOOTLDR.instpos, CF.BOOTLDR.bootdev, CF.BOOTLDR.mbr_device,
                 CF.BOOTLDR.win_device, CF.BOOTLDR.win_fs)))
Пример #3
0
    def check_enter_bootlist(self):
        if 'b' in get_devinfo(CF.G.boot_device, CF.G.all_part_infor).flags:
            f_boot_usable = True
        else:
            f_boot_usable = False
        self.name_map['bootpartition'].set_sensitive(f_boot_usable)
        self.name_map['bootpartition_entry'].set_sensitive(False)

        self.fill_values(self.values)
        self.restore_entrylist()
        return 1
Пример #4
0
    def check_enter_bootlist(self):
        if 'b' in get_devinfo(CF.G.boot_device, CF.G.all_part_infor).flags:
            f_boot_usable = True
        else:
            f_boot_usable = False
        self.name_map['bootpartition'].set_sensitive(f_boot_usable)
        self.name_map['bootpartition_entry'].set_sensitive(False)

        self.fill_values(self.values)
        self.restore_entrylist()
        return 1
Пример #5
0
    def restore_entrylist(self):
        child_values = []
        has_dos = None

        self.fetch_values(self.rootobj.values)
        win_device = self.get_data(self.values, 'bootloader.win_device')

        default = self.get_data(self.values, 'bootloader.default')
        if self.restore_dos and win_device:
            try:
                devinfo = get_devinfo(win_device, CF.G.all_part_infor)
                if devinfo.fstype in ('ntfs-3g', 'ntfs', 'vfat') \
                       and devinfo.not_touched == 'true':
                    has_dos = 'true'
            except KeyError:
                pass

        if has_dos:
            node = self.rootobj.values.createElement('row')
            doslabel = self.get_data(self.values, 'bootloader.doslabel')
            node.setAttribute('c1', doslabel)
            node.setAttribute('c2', win_device)
            if default == 'dos':
                node.setAttribute('c0', 'images/yes.png')
                node.setAttribute('c3', 'true')
            else:
                node.setAttribute('c0', 'images/blank.png')
                node.setAttribute('c3', 'false')
            child_values.append(node)

        node = self.rootobj.values.createElement('row')
        linuxlabel = self.get_data(self.values, 'bootloader.linuxlabel')
        linuxdevice = CF.G.root_device
        node.setAttribute('c1', linuxlabel)
        node.setAttribute('c2', linuxdevice)
        if not has_dos or default == 'linux':
            node.setAttribute('c0', 'images/yes.png')
            node.setAttribute('c3', 'true')
        else:
            node.setAttribute('c0', 'images/blank.png')
            node.setAttribute('c3', 'false')
        child_values.append(node)
        self.set_child_data(self.values, 'bootloader.entrylist', 'row',
                            child_values)
        self.fill_values(self.values)
Пример #6
0
    def restore_entrylist(self):
        child_values = []
        has_dos = None

        self.fetch_values(self.rootobj.values)
        win_device = self.get_data(self.values, 'bootloader.win_device')

        default = self.get_data(self.values, 'bootloader.default')
        if self.restore_dos and win_device:
            try:
                devinfo = get_devinfo(win_device, CF.G.all_part_infor)
                if devinfo.fstype in ('ntfs-3g', 'ntfs', 'vfat') \
                       and devinfo.not_touched == 'true':
                    has_dos = 'true'
            except KeyError:
                pass

        if has_dos:
            node = self.rootobj.values.createElement('row')
            doslabel = self.get_data(self.values, 'bootloader.doslabel')
            node.setAttribute('c1', doslabel)
            node.setAttribute('c2', win_device)
            if default == 'dos':
                node.setAttribute('c0', 'images/yes.png')
                node.setAttribute('c3', 'true')
            else:
                node.setAttribute('c0', 'images/blank.png')
                node.setAttribute('c3', 'false')
            child_values.append(node)

        node = self.rootobj.values.createElement('row')
        linuxlabel = self.get_data(self.values, 'bootloader.linuxlabel')
        linuxdevice = CF.G.root_device
        node.setAttribute('c1', linuxlabel)
        node.setAttribute('c2', linuxdevice)
        if not has_dos or default == 'linux':
            node.setAttribute('c0', 'images/yes.png')
            node.setAttribute('c3', 'true')
        else:
            node.setAttribute('c0', 'images/blank.png')
            node.setAttribute('c3', 'false')
        child_values.append(node)
        self.set_child_data(self.values,
                            'bootloader.entrylist', 'row', child_values)
        self.fill_values(self.values)
Пример #7
0
    def gather_setup_information(self):
        # Get account information
        CF.ACCOUNT.rootpasswd = self.get_data(self.values, 'accounts.root.password')
        CF.ACCOUNT.acclist = []
        accnode = self.srh_data_node(self.values, 'accounts.userlist')
        for node in accnode.getElementsByTagName('row'):
            CF.ACCOUNT.acclist.append((node.getAttribute('c0'), # Username.
                            node.getAttribute('c1'), # Password.
                            node.getAttribute('c2'), # Shell.
                            node.getAttribute('c3'), # Home directory.
                            node.getAttribute('c4'))) # Real UID or 'Auto'.
        logger.i('takeactions setup_accounts %s' % str((CF.ACCOUNT.rootpasswd, CF.ACCOUNT.acclist)))
 
        # Get bootloader information
        CF.BOOTLDR.bltype = self.get_data(self.values, 'bootloader.bltype')
        CF.BOOTLDR.instpos = self.get_data(self.values, 'bootloader.instpos')
        CF.BOOTLDR.mbr_device = self.get_data(self.values, 'bootloader.mbr_device')
        CF.BOOTLDR.win_device = self.get_data(self.values, 'bootloader.win_device')
        if CF.BOOTLDR.bltype == 'none':
            logger.i('takeactions get bootloader: bltype %s' % CF.BOOTLDR.bltype)
        else:
            if CF.G.root_device == CF.G.boot_device:
                CF.BOOTLDR.bootdev = ''
            else:
                CF.BOOTLDR.bootdev = CF.G.boot_device
            if CF.BOOTLDR.win_device:
                CF.BOOTLDR.win_fs = get_devinfo(CF.BOOTLDR.win_device, CF.G.all_part_infor).fstype
            else:
                CF.BOOTLDR.win_fs = ''
            CF.BOOTLDR.timeout = int(float(self.get_data(self.values, 'bootloader.timeout')))
            CF.BOOTLDR.usepassword = self.get_data(self.values, 'bootloader.usepassword')
            CF.BOOTLDR.password = self.get_data(self.values, 'bootloader.password')
            CF.BOOTLDR.lba = self.get_data(self.values, 'bootloader.lba')
            CF.BOOTLDR.options = self.get_data(self.values, 'bootloader.options')
            CF.BOOTLDR.entries = []
            elnode = self.srh_data_node(self.values, 'bootloader.entrylist')
            for node in elnode.getElementsByTagName('row'):
                CF.BOOTLDR.entries.append((node.getAttribute('c1'),
                                node.getAttribute('c2'),
                                node.getAttribute('c3')))
            self.default = self.get_data(self.values, 'bootloader.default')
            logger.i('takeactions get bootloader: %s' % str(('setup_' + CF.BOOTLDR.bltype, CF.BOOTLDR.timeout, CF.BOOTLDR.usepassword,
                                CF.BOOTLDR.password, CF.BOOTLDR.lba, CF.BOOTLDR.options, CF.BOOTLDR.entries, CF.BOOTLDR.default,
                                CF.BOOTLDR.instpos, CF.BOOTLDR.bootdev, CF.BOOTLDR.mbr_device, CF.BOOTLDR.win_device, CF.BOOTLDR.win_fs)))
Пример #8
0
 def act_start_bootloader(self):
     bltype = self.get_data(self.values, 'bootloader.bltype')
     instpos = self.get_data(self.values, 'bootloader.instpos')
     mbr_device = self.get_data(self.values, 'bootloader.mbr_device')
     win_device = self.get_data(self.values, 'bootloader.win_device')
     dolog('action_bootloader: bltype = %s\n' % bltype)
     if bltype == 'none':
         self.add_action(None, self.nextop, None, 'sleep', 0)
         return
     if CF.G.root_device == CF.G.boot_device:
         bootdev = ''
     else:
         bootdev = CF.G.boot_device
     if win_device:
         win_fs = get_devinfo(win_device, CF.G.all_part_infor).fstype
     else:
         win_fs = ''
     timeout = int(float(self.get_data(self.values, 'bootloader.timeout')))
     usepassword = self.get_data(self.values, 'bootloader.usepassword')
     password = self.get_data(self.values, 'bootloader.password')
     lba = self.get_data(self.values, 'bootloader.lba')
     options = self.get_data(self.values, 'bootloader.options')
     entries = []
     elnode = self.srh_data_node(self.values, 'bootloader.entrylist')
     for node in elnode.getElementsByTagName('row'):
         entries.append((node.getAttribute('c1'),
                         node.getAttribute('c2'),
                         node.getAttribute('c3')))
     default = self.get_data(self.values, 'bootloader.default')
     dolog('%s\n' % str(('setup_' + bltype, timeout, usepassword,
                         password, lba, options, entries, default,
                         instpos, bootdev, mbr_device, win_device, win_fs)))
     #### TODO: add clean server operate.
     
     self.add_action(_('Prepare bootloader'), self.bl_umount, bltype,
                     'prepare_' + bltype, timeout, usepassword, password,
                     lba, options, entries, default, instpos, bootdev, mbr_device, win_device, win_fs)