def act_install_disc_start(self, tdata, disc_no):
        '''
            mount each ISO, and install it.
            install_disc_prep(server) mount ISO.
        '''
        (pafile, dev, fstype, reldir, bootiso_relpath) = CF.G.choosed_patuple
        while disc_no < len(CF.G.arrangement):
            logger.i("act_install_disc_start probe_all_disc_result: %s" %
                     self.probe_all_disc_result)
            if not self.install_allpkg and not self.disc_map.has_key(disc_no):
                # Skip the disc which is not needed.
                disc_no = disc_no + 1
                continue

            if disc_no >= len(self.probe_all_disc_result) \
                   or not self.probe_all_disc_result[disc_no]: ## TODO multi disc will always have only one probe_all_disc_result. please fix it.
                # we known have next disc in pkgarr.py file (CF.G.arrangement is the variable in pkgarr.py)
                # but there can not find next disc with disc_no in probe_all_disc_result. so we think it should have a next disc, and ask user to insert it.
                self.cb0_insert_next_disc(
                    disc_no + 1, self.retry_clicked, self.abort_clicked
                )  ## This call back will active next install action.
                return
            self.cur_disc_no = disc_no
            bootiso_relpath = self.probe_all_disc_result[disc_no][0]
            self.add_action(None, self.act_install_pkg_start, (disc_no, 0),
                            'install_disc_prep', dev, fstype, bootiso_relpath,
                            reldir)
            # add install current disc action, return now, and wait next disc action after current disc install action finished.
            return

        ### Install all disc finished
        self.add_action(_('Last operations for package installation'),
                        self.nextop, None, 'rpm_post_install', None)
    def act_install_disc_start(self, tdata, disc_no):
        '''
            mount each ISO, and install it.
            install_disc_prep(server) mount ISO.
        '''
        (pafile, dev, fstype, reldir, bootiso_relpath) =  CF.G.choosed_patuple
        while disc_no < len(CF.G.arrangement):
            logger.i("act_install_disc_start probe_all_disc_result: %s" % self.probe_all_disc_result)
            if not self.install_allpkg and not self.disc_map.has_key(disc_no):
                # Skip the disc which is not needed.
                disc_no = disc_no + 1
                continue

            if disc_no >= len(self.probe_all_disc_result) \
                   or not self.probe_all_disc_result[disc_no]: ## TODO multi disc will always have only one probe_all_disc_result. please fix it.
                # we known have next disc in pkgarr.py file (CF.G.arrangement is the variable in pkgarr.py)
                # but there can not find next disc with disc_no in probe_all_disc_result. so we think it should have a next disc, and ask user to insert it.
                self.cb0_insert_next_disc(disc_no + 1, self.retry_clicked, self.abort_clicked) ## This call back will active next install action.
                return
            self.cur_disc_no = disc_no
            bootiso_relpath = self.probe_all_disc_result[disc_no][0]
            self.add_action(None,
                            self.act_install_pkg_start, (disc_no, 0),
                            'install_disc_prep', dev, fstype, bootiso_relpath, reldir)
            # add install current disc action, return now, and wait next disc action after current disc install action finished.
            return
        
        ### Install all disc finished
        self.add_action(_('Last operations for package installation'),
                        self.nextop, None,
                        'rpm_post_install', None)
 def prepare(self):
     self.arch = self.rootobj.tm.actserver.get_arch()
     logger.i('Detected Arch: %s\n' % str(self.arch))
     
     self.archcompat_list = CF.G.arch_map[self.arch]
     self._calc_instpkg_map()
     self.prepared = True
 def step2():
     # set bootloader
     logger.i('setup_' + CF.BOOTLDR.bltype)
     self.add_action(_('Setup bootloader'), next_post_script, 4,
                     '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)
    def prepare(self):
        self.arch = self.rootobj.tm.actserver.get_arch()
        logger.i('Detected Arch: %s\n' % str(self.arch))

        self.archcompat_list = CF.G.arch_map[self.arch]
        self._calc_instpkg_map()
        self.prepared = True
Exemple #6
0
 def step3():
     # setup account
     logger.i('action_accounts')
     self.rootobj.tm.add_action(_('Setup accounts'),
                                next_post_script, 5,
                                'setup_accounts',
                                CF.ACCOUNT.rootpasswd,
                                CF.ACCOUNT.acclist)
 def start(self):
     for disc_no in range(len(CF.G.arrangement)):
         self.disc_first_pkgs.append(CF.G.arrangement[disc_no][0][1])
     
     (pafile, dev, fstype, reldir, bootiso_relpath) = CF.G.choosed_patuple
     logger.i('disc_first_pkgs: %s\n' % str(self.disc_first_pkgs))
     self.add_action(_('Search packages'),
                     self.act_install_prepare, None,
                     'probe_all_disc', dev, fstype, bootiso_relpath, reldir, self.disc_first_pkgs)
    def start(self):
        for disc_no in range(len(CF.G.arrangement)):
            self.disc_first_pkgs.append(CF.G.arrangement[disc_no][0][1])

        (pafile, dev, fstype, reldir, bootiso_relpath) = CF.G.choosed_patuple
        logger.i('disc_first_pkgs: %s\n' % str(self.disc_first_pkgs))
        self.add_action(_('Search packages'), self.act_install_prepare, None,
                        'probe_all_disc', dev, fstype, bootiso_relpath, reldir,
                        self.disc_first_pkgs)
Exemple #9
0
 def step2():
     # set bootloader
     logger.i('setup_' + CF.BOOTLDR.bltype)
     self.add_action(_('Setup bootloader'), next_post_script, 4,
                     '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)
    def act_install_prepare(self, tdata, data):
        '''
            invoke install_prep(server) to mount target system partitions.
        '''
        self.probe_all_disc_result = tdata
        logger.i('probe_all_disc_result: %s\n' % str(self.probe_all_disc_result))
        (pafile, dev, fstype, reldir, bootiso_relpath) = CF.G.choosed_patuple

        self.add_action(None,
                        self.act_rpm_pre_install, 0,
                        'install_prep', (dev, fstype, bootiso_relpath, reldir), 
                                        CF.G.mount_all_list,    # partition list [(mntpoint, devfn, fstype), ...] , be filled at partition step.
                            )
Exemple #11
0
    def act_install_prepare(self, tdata, data):
        '''
            invoke install_prep(server) to mount target system partitions.
        '''
        self.probe_all_disc_result = tdata
        logger.i('probe_all_disc_result: %s\n' %
                 str(self.probe_all_disc_result))
        (pafile, dev, fstype, reldir, bootiso_relpath) = CF.G.choosed_patuple

        self.add_action(
            None,
            self.act_rpm_pre_install,
            0,
            'install_prep',
            (dev, fstype, bootiso_relpath, reldir),
            CF.G.
            mount_all_list,  # partition list [(mntpoint, devfn, fstype), ...] , be filled at partition step.
        )
Exemple #12
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)))
    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)))
 def leave(self):
     logger.d('install_finished %s setup_finished %s entered %s' % (self.install_finished, self.setup_finished, self.entered))
     if not self.install_finished:
         return 0
     elif not self.setup_finished:
         self.rootobj.btnnext_sensitive(False)
         self.name_map['frame_other'].set_sensitive(True)
         self.rootobj.tm.push_progress(self.name_map['otprog'],
                                       self.name_map['otname'])
         
         # set modprobe.conf
         scsi_module_list = self.get_data(self.values, 'scsi.modules')
         if scsi_module_list == None or scsi_module_list == '':
             logger.w('No scsi driver has to be written into modprobe.conf.\n')
         else:
             logger.i('scsi_modprobe_conf(%s)\n' % scsi_module_list)
             self.add_action(_("Generate modprobe.conf"), None, None,
                             'scsi_modprobe_conf', scsi_module_list)
         
         step_lst = []
             
         class WarningDialog(magicpopup.magicmsgbox):
             def __init__(self, sself, msg, next_func):
                 self.sself = sself
                 self.next_func = next_func
                 magicpopup.magicmsgbox.__init__(self, self,
                       msg,
                       magicpopup.magicmsgbox.MB_WARNING,
                       magicpopup.magicpopup.MB_IGNORE|magicpopup.magicmsgbox.MB_REBOOT,
                       '')
             def reboot_clicked(self, widget, data):
                 self.sself.reboot_clicked(widget, data)
                 self.closedialog()
                 
             def ignore_clicked(self, widget, data):
                 self.next_func()
                 self.closedialog()
                 
         def next_post_script(tdata, data):
             logger.d('next_post_script %s %s' % (str(tdata), str(data)))
             # these post script return value is a tuple (ret, msg)
             # If ret is 0 the operation is right, otherwise the operation is wrong, 
             # and msg is the error message
             if type(tdata) is str:
                 ret = -1
                 msg = tdata
             elif type(tdata) is int:
                 ret = tdata
                 msg = ''
             elif type(tdata) in (list, tuple) and len(tdata) == 2:
                 ret, msg = tdata
             else:
                 ret = -1
                 msg = 'Unknown error result %s' % tdata
                 
             logger.d('next_post_script index %s func %s' % (data, step_lst[data]))
             if ret != 0:
                 # dialog pop up to warning user and then run next step.
                 WarningDialog(self, msg, step_lst[data])
                 return
             else:
                 step_lst[data]()
                 
         def step0_0():
             # mount target system
             self.add_action(_('Mount Target System'),
                     next_post_script, 1,
                     'mount_tgtsys', CF.G.mount_all_list,    # partition list [(mntpoint, devfn, fstype), ...] , be filled at partition step.
                         )
         step_lst.append(step0_0)
         
         def step0():
             # generate fstab
             logger.i('do_genfstab')
             self.add_action(_('Generate fstab'), next_post_script, 2, 'do_genfstab', 0)
         step_lst.append(step0)
         
         def step1():
             # make initrd
             logger.i('do_mkinitrd')
             self.add_action(_('Make initrd'), next_post_script, 3, 'do_mkinitrd', 0)
         step_lst.append(step1)    
         
         def step2():
             # set bootloader
             logger.i('setup_' + CF.BOOTLDR.bltype)
             self.add_action(_('Setup bootloader'), next_post_script, 4,
                             '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)
         step_lst.append(step2)
         
         def step3():
             # setup account
             logger.i('action_accounts')
             self.rootobj.tm.add_action(_('Setup accounts'), next_post_script, 5,
                                        'setup_accounts', CF.ACCOUNT.rootpasswd, CF.ACCOUNT.acclist)
         step_lst.append(step3)
         
         def step4():
             # run post install script
             self.tm.add_action(_('Run post install script'), next_post_script, 6,
                                    'run_post_install', 0)    
         step_lst.append(step4)
         def step4_0():
             # backup log files
             self.tm.add_action(_('Backup MI log files'), next_post_script, 7,
                                    'backup_mi_logfiles', 0)
         step_lst.append(step4_0)
         def step4_1():
             self.add_action(_('Mount Target System'),
                     self.do_setup_finished, None,
                     'umount_tgtsys', CF.G.mount_all_list,    # partition list [(mntpoint, devfn, fstype), ...] , be filled at partition step.
                         )
         step_lst.append(step4_1)
         step_lst[0]()
         return 0
     if not self.entered:
         return 0
     return 1
Exemple #15
0
 def step1():
     # make initrd
     logger.i('do_mkinitrd')
     self.add_action(_('Make initrd'), next_post_script, 3,
                     'do_mkinitrd', 0)
Exemple #16
0
 def step0():
     # generate fstab
     logger.i('do_genfstab')
     self.add_action(_('Generate fstab'), next_post_script, 2,
                     'do_genfstab', 0)
Exemple #17
0
    def leave(self):
        logger.d('install_finished %s setup_finished %s entered %s' %
                 (self.install_finished, self.setup_finished, self.entered))
        if not self.install_finished:
            return 0
        elif not self.setup_finished:
            self.rootobj.btnnext_sensitive(False)
            self.name_map['frame_other'].set_sensitive(True)
            self.rootobj.tm.push_progress(self.name_map['otprog'],
                                          self.name_map['otname'])

            # set modprobe.conf
            scsi_module_list = self.get_data(self.values, 'scsi.modules')
            if scsi_module_list == None or scsi_module_list == '':
                logger.w(
                    'No scsi driver has to be written into modprobe.conf.\n')
            else:
                logger.i('scsi_modprobe_conf(%s)\n' % scsi_module_list)
                self.add_action(_("Generate modprobe.conf"), None, None,
                                'scsi_modprobe_conf', scsi_module_list)

            step_lst = []

            class WarningDialog(magicpopup.magicmsgbox):
                def __init__(self, sself, msg, next_func):
                    self.sself = sself
                    self.next_func = next_func
                    magicpopup.magicmsgbox.__init__(
                        self, self, msg, magicpopup.magicmsgbox.MB_WARNING,
                        magicpopup.magicpopup.MB_IGNORE
                        | magicpopup.magicmsgbox.MB_REBOOT, '')

                def reboot_clicked(self, widget, data):
                    self.sself.reboot_clicked(widget, data)
                    self.closedialog()

                def ignore_clicked(self, widget, data):
                    self.next_func()
                    self.closedialog()

            def next_post_script(tdata, data):
                logger.d('next_post_script %s %s' % (str(tdata), str(data)))
                # these post script return value is a tuple (ret, msg)
                # If ret is 0 the operation is right, otherwise the operation is wrong,
                # and msg is the error message
                if type(tdata) is str:
                    ret = -1
                    msg = tdata
                elif type(tdata) is int:
                    ret = tdata
                    msg = ''
                elif type(tdata) in (list, tuple) and len(tdata) == 2:
                    ret, msg = tdata
                else:
                    ret = -1
                    msg = 'Unknown error result %s' % tdata

                logger.d('next_post_script index %s func %s' %
                         (data, step_lst[data]))
                if ret != 0:
                    # dialog pop up to warning user and then run next step.
                    WarningDialog(self, msg, step_lst[data])
                    return
                else:
                    step_lst[data]()

            def step0_0():
                # mount target system
                self.add_action(
                    _('Mount Target System'),
                    next_post_script,
                    1,
                    'mount_tgtsys',
                    CF.G.
                    mount_all_list,  # partition list [(mntpoint, devfn, fstype), ...] , be filled at partition step.
                )

            step_lst.append(step0_0)

            def step0():
                # generate fstab
                logger.i('do_genfstab')
                self.add_action(_('Generate fstab'), next_post_script, 2,
                                'do_genfstab', 0)

            step_lst.append(step0)

            def step1():
                # make initrd
                logger.i('do_mkinitrd')
                self.add_action(_('Make initrd'), next_post_script, 3,
                                'do_mkinitrd', 0)

            step_lst.append(step1)

            def step2():
                # set bootloader
                logger.i('setup_' + CF.BOOTLDR.bltype)
                self.add_action(_('Setup bootloader'), next_post_script, 4,
                                '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)

            step_lst.append(step2)

            def step3():
                # setup account
                logger.i('action_accounts')
                self.rootobj.tm.add_action(_('Setup accounts'),
                                           next_post_script, 5,
                                           'setup_accounts',
                                           CF.ACCOUNT.rootpasswd,
                                           CF.ACCOUNT.acclist)

            step_lst.append(step3)

            def step4():
                # run post install script
                self.tm.add_action(_('Run post install script'),
                                   next_post_script, 6, 'run_post_install', 0)

            step_lst.append(step4)

            def step4_0():
                # backup log files
                self.tm.add_action(_('Backup MI log files'), next_post_script,
                                   7, 'backup_mi_logfiles', 0)

            step_lst.append(step4_0)

            def step4_1():
                self.add_action(
                    _('Mount Target System'),
                    self.do_setup_finished,
                    None,
                    'umount_tgtsys',
                    CF.G.
                    mount_all_list,  # partition list [(mntpoint, devfn, fstype), ...] , be filled at partition step.
                )

            step_lst.append(step4_1)
            step_lst[0]()
            return 0
        if not self.entered:
            return 0
        return 1
 def step0():
     # generate fstab
     logger.i('do_genfstab')
     self.add_action(_('Generate fstab'), next_post_script, 2, 'do_genfstab', 0)
 def step3():
     # setup account
     logger.i('action_accounts')
     self.rootobj.tm.add_action(_('Setup accounts'), next_post_script, 5,
                                'setup_accounts', CF.ACCOUNT.rootpasswd, CF.ACCOUNT.acclist)
 def step1():
     # make initrd
     logger.i('do_mkinitrd')
     self.add_action(_('Make initrd'), next_post_script, 3, 'do_mkinitrd', 0)