Exemplo n.º 1
0
 def subswitch(self, substep):
     logger.d('subswitch substep: %s, self.substep: %s' % (substep, self.substep))
     if substep != self.substep:
         if not self.name_map.has_key(substep):
             logger.w("%s step is not in UIxml, please fill it yourself, and check it work" % substep)
             self.substep = substep
             return
         if self.name_map.has_key(self.substep):
             logger.d('hide %s' % self.substep)
             self.name_map[self.substep].hide()
         self.name_map[substep].show()
         logger.d('show %s' % substep)
         if hasattr(self, 'switch_%s_%s' % (self.substep, substep)):
             eval('self.switch_%s_%s()' % (self.substep, substep))
         self.substep = substep
Exemplo n.º 2
0
 def subswitch(self, substep):
     logger.d('subswitch substep: %s, self.substep: %s' %
              (substep, self.substep))
     if substep != self.substep:
         if not self.name_map.has_key(substep):
             logger.w(
                 "%s step is not in UIxml, please fill it yourself, and check it work"
                 % substep)
             self.substep = substep
             return
         if self.name_map.has_key(self.substep):
             logger.d('hide %s' % self.substep)
             self.name_map[self.substep].hide()
         self.name_map[substep].show()
         logger.d('show %s' % substep)
         if hasattr(self, 'switch_%s_%s' % (self.substep, substep)):
             eval('self.switch_%s_%s()' % (self.substep, substep))
         self.substep = substep
Exemplo n.º 3
0
            os.path.join(CF.D.DATADIR, 'mi'))
build_top = os.environ.get('MI_BUILD_TOP', None)
if build_top:
    os.chdir('%s/src/mi' % build_top)
else:
    os.chdir(os.path.join(CF.D.DATADIR, 'mi'))

if USE_TEXTDOMAIN:
    sys_locale = '/usr/share/locale'
    all_dirs, all_files = treedir(sys_locale, False)
    textdomain = CF.D.TEXTDOMAIN
    if textdomain + '.mo' in all_files:
        gettext.bindtextdomain(textdomain, sys_locale)
        gettext.textdomain(textdomain)
    else:
        logger.w('Can not bind textdomain %s' % textdomain)

## We can use some custom style here.
#settings = gtk.settings_get_default()
#settings.set_string_property('gtk-theme-name', 'Default', '')
#gtk.rc_parse_string(open('style.rc', 'rt').read())
#print gtk.rc_get_theme_dir()
settings = gtk.settings_get_default()
settings.set_string_property("gtk-theme-name", "Gnursid", "")

step_name_list = [
    (_('Welcome'), 'welcome'),  # (group name, module name)
    #'scsi',
    (_('Package'), 'pkgselect'),
    (_('Partition'), 'partition'),
    (_('Partition'), 'dopartition'),
Exemplo n.º 4
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
Exemplo n.º 5
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
Exemplo n.º 6
0
logger.info('change current working directory to %s' % os.path.join(CF.D.DATADIR, 'mi'))
build_top = os.environ.get('MI_BUILD_TOP', None)
if build_top:
    os.chdir('%s/src/mi' % build_top)
else:
    os.chdir(os.path.join(CF.D.DATADIR, 'mi'))

if USE_TEXTDOMAIN:
    sys_locale = '/usr/share/locale'
    all_dirs, all_files = treedir(sys_locale, False)
    textdomain = CF.D.TEXTDOMAIN
    if textdomain+'.mo' in all_files:
        gettext.bindtextdomain(textdomain, sys_locale)
        gettext.textdomain(textdomain)
    else:
        logger.w('Can not bind textdomain %s' % textdomain)

## We can use some custom style here.
#settings = gtk.settings_get_default()
#settings.set_string_property('gtk-theme-name', 'Default', '')
#gtk.rc_parse_string(open('style.rc', 'rt').read())
#print gtk.rc_get_theme_dir()
settings = gtk.settings_get_default()
settings.set_string_property("gtk-theme-name", "Gnursid", "")

step_name_list = [
    (_('Welcome'), 'welcome'), # (group name, module name)
    #'scsi',
    (_('Package'), 'pkgselect'),
    (_('Partition'), 'partition'),
    (_('Partition'), 'dopartition'),