Пример #1
0
 def excute_pre_post(h):
     pkgnvr = "%s-%s-%s" % (h['name'],h['version'],h['release'])
     script_dir = os.path.join(self.tgtsys_root, self.tmp_noscripts_dir)
     scripts = []
     if h[rpm.RPMTAG_PREIN]: #@UndefinedVariable
         script_name = "%s.preinstall.sh" % pkgnvr
         script_path = os.path.join(script_dir, script_name)
         write_script(h[rpm.RPMTAG_PREIN], script_path) #@UndefinedVariable
         scripts.append(script_name)
     if h[rpm.RPMTAG_POSTIN]: #@UndefinedVariable
         script_name = "%s.postinstall.sh" % pkgnvr
         script_path = os.path.join(script_dir, script_name)
         write_script(h[rpm.RPMTAG_POSTIN], script_path) #@UndefinedVariable
         scripts.append(script_name)
     for script_name in scripts:
         spath = os.path.join('/', self.tmp_noscripts_dir, script_name)
         write_script("**%s\n" % script_name, self.noscripts_log, 'a')  # do log
         ret = os.system("/usr/sbin/chroot %s /bin/sh %s  2>&1 >> %s" % (self.tgtsys_root, spath, self.noscripts_log))
         if ret != 0:
             err_msg = 'Error run scripts(noscripts) in %s-%s-%s\n' \
                     % (h['name'],h['version'],h['release'])
             logger.i(err_msg)
             write_script(err_msg, self.noscripts_log, 'a')   # do log
             return ret
     return 1
Пример #2
0
    def _install(self, pkgpath, noscripts, not_pre_post_script, progress_cb):
        pkgname = get_pkg_name(pkgpath)
        try:
            cmd = 'rpm'
            argv = ['-i', '--noorder', # '--nosuggest', # on ubuntu platform rpm do not have --nosuggest parameter
                    '--force','--nodeps',
                    '--ignorearch',
                    '--root', CF.D.TGTSYS_ROOT,
                    pkgpath,
                ]
            if self.use_noscripts or noscripts:
                argv.append('--noscripts')
                self.noscripts_pkg_list.append(pkgpath)

            #cmd_res = {'err':[], 'std': [], 'ret':0}   # DEBUG
            cmd_res = run_bash(cmd, argv)
            # Sign the installing pkg name in stderr
            if cmd_res['err']:
                # Ok the stderr will dup2 a log file, so we just out it on err screen
                print >>sys.stderr, '***INSTALLING %s:\n**STDERR:\n%s\n' \
                        %(pkgname, ''.join(cmd_res['err']))
            problems = cmd_res['ret']
            if problems:
                errormsg = ''.join(cmd_res['err'])
                message = 'PROBLEMS on %s: \n return code is %s error message is\n[%s]' \
                          % (pkgname, str(problems), errormsg)
                logger.i(message)
                return  message
        except Exception, errmsg:
            logger.i('FAILED on %s: %s\n' % (pkgname, str(errmsg)))
            return str(errmsg)
Пример #3
0
def run_post_script(script_rel, _argv=[], f_chroot=True):
    logger.i('Run post_script %s %s' % (script_rel, str(_argv)))
    post_scripts_dir = CF.D.POST_SCRIPTS_DIR
    script = os.path.join(post_scripts_dir, script_rel)
    if not os.path.exists(script):
        msg = _('Can not find the script %s' % script)
        logger.e(msg)
        return -1, msg
    
    root = CF.D.TGTSYS_ROOT
    if f_chroot:
        if not os.path.exists('%s/tmp' % root):
            os.makedirs('%s/tmp' % root)
        cmd0 = 'cp -pr %s %s/tmp/' % (post_scripts_dir, root)
        logger.d(cmd0)
        os.system(cmd0)
        cmd = '/tmp/%s/%s' % (os.path.basename(post_scripts_dir), script_rel)
        cmd0 = 'chmod 777 %s%s' % (root, cmd)
        logger.d(cmd0)
        os.system(cmd0)
        argv = _argv
        _environ = dict(os.environ)
        _environ['LANG'] = 'en_US.UTF-8'
        try:
            res = run_bash(cmd, argv, root, env=_environ, cwd='/tmp/%s' % os.path.basename(post_scripts_dir))
        except OSError, e:
            res = {}
            res['ret'] = -1
            res['err'] = ['Can not run %s, can not chroot to target system or can not run this script.' % script_rel]
            res['out'] = ['']
            logger.e(res['err'], exc_info = sys.exc_info())
        cmd0 = 'rm -rf %s/tmp/%s' % (root, os.path.basename(post_scripts_dir))
        logger.d(cmd0)
        os.system(cmd0)
Пример #4
0
 def resp_pkgarr_probe(tdata, data):
     logger.i('resp_pkgarr_probe result %s' % tdata)
     if not check_data(tdata):
         msg = _('Can not get packages info (pkgarr_probe)')+'''RESULT TYPE %s VALUE: %s''' % (type(tdata), tdata)
         logger.e(msg)
         self.sself.warn_dialog(msg)
     CF.G.pkgarr_probe_result = tdata
     CF.G.pkgarr_probe_status = STAT.OP_STATUS_DONE
Пример #5
0
 def probe_position(localfn, pos_id, new_device, fstype, reldir, isofn):
     logger.i('probe_position: %s, %s, %s, %s, %s, %s' % (localfn, pos_id, new_device, fstype, reldir, isofn))
     if not os.path.exists(localfn):
         return None
     try:
         execfile(localfn)
     except Exception, errmsg:
         logger.e("Load %s failed(%s)." % (localfn, str(errmsg)))
         return None
Пример #6
0
        def wrap_func(*args, **kwargs):
            had_probe = getattr(CF.S, 'had_probe_%s' % name)
            if had_probe:
                logger.i('%s: %s have been probed' % (func.__name__, name))
                return getattr(CF.S, name)

            ret = func(*args, **kwargs)
            setattr(CF.S, 'had_probe_%s' % name, True)
            setattr(CF.S, name, ret)
            return ret
Пример #7
0
 def probe_position(localfn, pos_id, new_device, fstype, reldir, isofn):
     logger.i('probe_position: %s, %s, %s, %s, %s, %s' %
              (localfn, pos_id, new_device, fstype, reldir, isofn))
     if not os.path.exists(localfn):
         return None
     try:
         execfile(localfn)
     except Exception, errmsg:
         logger.e("Load %s failed(%s)." % (localfn, str(errmsg)))
         return None
Пример #8
0
 def resp_pkgarr_probe(tdata, data):
     logger.i('resp_pkgarr_probe result %s' % tdata)
     if not check_data(tdata):
         msg = _('Can not get packages info (pkgarr_probe)'
                 ) + '''RESULT TYPE %s VALUE: %s''' % (type(tdata),
                                                       tdata)
         logger.e(msg)
         self.sself.warn_dialog(msg)
     CF.G.pkgarr_probe_result = tdata
     CF.G.pkgarr_probe_status = STAT.OP_STATUS_DONE
Пример #9
0
 def wrap_func(*args, **kwargs):
     had_probe = getattr(CF.S, 'had_probe_%s' % name)
     if had_probe:
         logger.i('%s: %s have been probed' % (func.__name__, name))
         return getattr(CF.S, name)
     
     ret = func(*args, **kwargs)
     setattr(CF.S, 'had_probe_%s' % name, True)
     setattr(CF.S, name, ret)
     return ret
Пример #10
0
    def install_pre(self):
        logger.i('Create TransactionSet\n')
        
        var_lib_rpm = os.path.join(self.tgtsys_root, 'var/lib/rpm')
        if not os.path.isdir(var_lib_rpm):
            os.makedirs(var_lib_rpm)
        self.ts = None
        self.initTs()
        #self.ts.setVSFlags(~(rpm.RPMVSF_NORSA | rpm.RPMVSF_NODSA)) #@UndefinedVariable
        # have been removed from last rpm version
        #self.ts.setFlags(rpm.RPMTRANS_FLAG_ANACONDA)
#         rpm.addMacro("__dbi_htconfig", #@UndefinedVariable
#              "hash nofsync %{__dbi_other} %{__dbi_perms}")
#         rpm.addMacro("__file_context_path", "%{nil}") #@UndefinedVariable
        self.ts.initDB()
        return 0
Пример #11
0
    def install_pre(self):
        logger.i("Create TransactionSet\n")

        var_lib_rpm = os.path.join(self.tgtsys_root, "var/lib/rpm")
        if not os.path.isdir(var_lib_rpm):
            os.makedirs(var_lib_rpm)
        self.ts = None
        self.initTs()
        # self.ts.setVSFlags(~(rpm.RPMVSF_NORSA | rpm.RPMVSF_NODSA)) #@UndefinedVariable
        # have been removed from last rpm version
        # self.ts.setFlags(rpm.RPMTRANS_FLAG_ANACONDA)
        #         rpm.addMacro("__dbi_htconfig", #@UndefinedVariable
        #              "hash nofsync %{__dbi_other} %{__dbi_perms}")
        #         rpm.addMacro("__file_context_path", "%{nil}") #@UndefinedVariable
        self.ts.initDB()
        return 0
Пример #12
0
def probe_all_disc(mia, operid, device, devfstype, bootiso_relpath, pkgarr_reldir, disc_first_pkgs):
    '''
        probe the package from all disk
        bootiso_relpath is the first iso path relative path of device /
        pkgarr_reldir is the relative directory path of pkgarr.py of device / OR iso dir /
    '''
    logger.i('probe_all_disc(%s, %s, %s, %s, %s)\n' % \
          (device, devfstype, bootiso_relpath, pkgarr_reldir, disc_first_pkgs))
    
    midev = MiDevice(device, devfstype)
    bootiso_fn = CF.D.ISOFN_FMT % (CF.D.DISTNAME, CF.D.DISTVER, 1)
    # If probe in iso ,but bootiso_fn is not match error occur
    if bootiso_relpath and not os.path.basename(bootiso_relpath) == bootiso_fn:
        logger.e('probe_all_disc iso format is wrong: bootiso_relpath: %s bootiso_fn: %s' % (bootiso_relpath, bootiso_fn))
        return None
    probe_ret = None
    result = []
    for disc_no in range(len(disc_first_pkgs)):
        pkg_probe_path = [  '../packages',
                            'packages',
                            '../packages-%d' % (disc_no + 1),
                            'packages-%d' % (disc_no + 1)]
        if bootiso_relpath:
            # deal with iso case
            iso_fn = CF.D.ISOFN_FMT % (CF.D.DISTNAME, CF.D.DISTVER, disc_no + 1)
            iso_relpath = os.path.join(os.path.dirname(bootiso_relpath), iso_fn)
            pkgarr_reldirs = [ os.path.join(pkgarr_reldir, p) for p in pkg_probe_path ]
            for f, reldir in midev.iter_searchfiles([iso_relpath], ['']): # from disk
                midev_iso = MiDevice(f, 'iso9660')
                for pkgpath, relative_dir in midev_iso.iter_searchfiles([disc_first_pkgs[disc_no]], pkgarr_reldirs): # from iso
                    probe_ret = ( os.path.join(os.path.dirname(bootiso_relpath), iso_fn), 
                        os.path.normpath(os.path.join(relative_dir, pkgpath)) )
        else:
            # deal with harddisk case
            pkgs = [ os.path.join(p, disc_first_pkgs[disc_no]) for p in pkg_probe_path ]
            for f, reldir in midev.iter_searchfiles(pkgs, [pkgarr_reldir]):
                probe_ret = ('', os.path.normpath(os.path.join(reldir, f)))
        if probe_ret:
            result.append(probe_ret)

    dolog('probe_all_disc return result is : %s\n' % str(result))
    return  result
Пример #13
0
    def tryload_file(self, patuple):
        (pafile, dev, fstype, reldir, isofn) = patuple

        g_map = {}
        l_map = {}
        try:
            execfile(os.path.join(CF.G.path_tftproot, pafile), g_map, l_map)
            CF.G.arch_map = l_map['arch_map']
            CF.G.arrangement = l_map['arrangement']
            CF.G.archsize_map = l_map['archsize_map']
            CF.G.pkgpos_map = l_map['pkgpos_map']
            CF.G.toplevelgrp_map = l_map['toplevelgrp_map']
            del (g_map)
            del (l_map)
        except:
            return None
        valdoc = Document()
        self.groupdoc = valdoc
        topele = valdoc.createElement('data')
        valdoc.appendChild(topele)
        valtopele = valdoc.createElement('grouplist')
        topele.appendChild(valtopele)
        for group in CF.G.toplevelgrp_map.keys():
            if group == 'lock':
                continue
            rowele = valdoc.createElement('row')
            rowele.setAttribute('c0', group)
            rowele.setAttribute('c1', group)
            valtopele.appendChild(rowele)
        rowele = valdoc.createElement('row')
        rowele.setAttribute('c0', _('All Packages'))
        rowele.setAttribute('c1', 'ALL')
        valtopele.appendChild(rowele)
        self.fill_values(topele)
        self.fill_values(self.values)
        self.pa_choose = pafile
        self.name_map['srcpos_show'].set_text(os.path.join(dev, reldir, isofn))
        CF.G.choosed_patuple = patuple
        logger.i('CF.G.choosed_patuple set to %s' % CF.G.choosed_patuple)
        return 1
Пример #14
0
def pkgarr_probe(mia, operid):
    logger.i("pkgarr_probe starting...")

    def probe_position(localfn, pos_id, new_device, fstype, reldir, isofn):
        logger.i('probe_position: %s, %s, %s, %s, %s, %s' %
                 (localfn, pos_id, new_device, fstype, reldir, isofn))
        if not os.path.exists(localfn):
            return None
        try:
            execfile(localfn)
        except Exception, errmsg:
            logger.e("Load %s failed(%s)." % (localfn, str(errmsg)))
            return None
        remotefn = 'allpa/%s.%d.%s' % (os.path.basename(new_device), pos_id,
                                       os.path.basename(localfn))
        logger.i('ftp upload %s to remote %s...' % (localfn, remotefn))

        try:
            ftp = ftplib.FTP("127.0.0.1")
            ftp.login("root", "magic")
            ftp.storbinary("STOR %s" % remotefn, open(localfn, "rb"), 1024)
            ftp.close()
        except:
            logger.e('Upload failed')
            return None
        logger.i('Upload success')
        return [remotefn, new_device, fstype, reldir, isofn]
Пример #15
0
    def tryload_file(self, patuple):
        (pafile, dev, fstype, reldir, isofn) = patuple

        g_map = {}
        l_map = {}
        try:
            execfile(os.path.join(CF.G.path_tftproot, pafile), g_map, l_map)
            CF.G.arch_map = l_map['arch_map']
            CF.G.arrangement = l_map['arrangement']
            CF.G.archsize_map = l_map['archsize_map']
            CF.G.pkgpos_map = l_map['pkgpos_map']
            CF.G.toplevelgrp_map = l_map['toplevelgrp_map']
            del(g_map)
            del(l_map)
        except:
            return None
        valdoc = Document()
        self.groupdoc = valdoc
        topele = valdoc.createElement('data')
        valdoc.appendChild(topele)
        valtopele = valdoc.createElement('grouplist')
        topele.appendChild(valtopele)
        for group in CF.G.toplevelgrp_map.keys():
            if group == 'lock':
                continue
            rowele = valdoc.createElement('row')
            rowele.setAttribute('c0', group)
            rowele.setAttribute('c1', group)
            valtopele.appendChild(rowele)
        rowele = valdoc.createElement('row')
        rowele.setAttribute('c0', _('All Packages'))
        rowele.setAttribute('c1', 'ALL')
        valtopele.appendChild(rowele)
        self.fill_values(topele)
        self.fill_values(self.values)
        self.pa_choose = pafile
        self.name_map['srcpos_show'].set_text(os.path.join(dev, reldir, isofn))
        CF.G.choosed_patuple = patuple
        logger.i('CF.G.choosed_patuple set to %s' % CF.G.choosed_patuple)
        return 1
Пример #16
0
def pkgarr_probe(mia, operid):
    logger.i("pkgarr_probe starting...")
    def probe_position(localfn, pos_id, new_device, fstype, reldir, isofn):
        logger.i('probe_position: %s, %s, %s, %s, %s, %s' % (localfn, pos_id, new_device, fstype, reldir, isofn))
        if not os.path.exists(localfn):
            return None
        try:
            execfile(localfn)
        except Exception, errmsg:
            logger.e("Load %s failed(%s)." % (localfn, str(errmsg)))
            return None
        remotefn = 'allpa/%s.%d.%s' % (os.path.basename(new_device), pos_id, os.path.basename(localfn))
        logger.i('ftp upload %s to remote %s...' % (localfn, remotefn))

        try:
            ftp = ftplib.FTP("127.0.0.1")
            ftp.login("root", "magic")
            ftp.storbinary("STOR %s" % remotefn, open(localfn, "rb"), 1024)
            ftp.close()
        except:
            logger.e('Upload failed')
            return None
        logger.i('Upload success')
        return [remotefn, new_device, fstype, reldir, isofn]
Пример #17
0
        try:
            server.handle_request()
        except select.error:
            print 'select.error exception'
        if server_quit:
            break
    # Block until the action process terminate.
    mia.wait_action_exit()

elif mia.pid == 0:
    # Action process. For long operation only.
    #from mi.utils import MiLogger
    #log_long = MiLogger('mi_long')
    from mi.server.utils import logger
    from mi.server import handlers_long
    logger.i('test long logger')
    while 1:
        (id, opera) = mia.get_operation()
        if opera == 'quit':
            break
        else:
            (params, method) = xmlrpclib.loads(opera)
            if handlers_long.has_key(method):
                if CF.D.EXPERT_MODE:
                    logger.d('Run long.%s() with %s and id %d,\n' % (method, params, id))
                exe_ok = True
                try:
                    result = handlers_long[method](mia, id, *params)
                except:
                    result = 'Exception: run method %s raise %s' % (method, str(sys.exc_info()[0:2]))
                    exe_ok = False
Пример #18
0
def finish(mia, operid, dummy):
    logger.i('finish install')
    return 0
Пример #19
0
def clean_server_env(mia, operid, dummy):
    logger.i('clean_server_env')
    return 0
Пример #20
0
    def _post_pkg(self, pkgpath, noscripts, not_pre_post_script, progress_cb):
        if progress_cb:
            progress_cb.set_step(0.5, 1)
        ### TODO Because this method to dump post script is not a valid bash script, it is like:
        # posix.symlink("../run", "/var/run")
        # posix.symlink("../run/lock", "/var/lock")
        # I do not know, may be it is the rpm inter language to create a link.
        # It happend in filesystem-3-3mgc30.i686.rpm please check.
        
        #return 'Not support this _post_pkg method'
    
        # we will execute all the pre_in and post_in scripts there, if we use
        # the --noscripts option during rpm installation
        logger.i('Execute Pre Post Scripts:\n\t%s\n' % str(self.noscripts_pkg_list))

        if not self.noscripts_pkg_list:
            return 0
        if self.not_pre_post_script or not_pre_post_script:
            return 0
        def write_script(script_cmd, script_file, mode='w'):
            tfd = open(script_file, mode)
            tfd.write(script_cmd)
            tfd.close()
        def excute_pre_post(h):
            pkgnvr = "%s-%s-%s" % (h['name'],h['version'],h['release'])
            script_dir = os.path.join(self.tgtsys_root, self.tmp_noscripts_dir)
            scripts = []
            if h[rpm.RPMTAG_PREIN]: #@UndefinedVariable
                script_name = "%s.preinstall.sh" % pkgnvr
                script_path = os.path.join(script_dir, script_name)
                write_script(h[rpm.RPMTAG_PREIN], script_path) #@UndefinedVariable
                scripts.append(script_name)
            if h[rpm.RPMTAG_POSTIN]: #@UndefinedVariable
                script_name = "%s.postinstall.sh" % pkgnvr
                script_path = os.path.join(script_dir, script_name)
                write_script(h[rpm.RPMTAG_POSTIN], script_path) #@UndefinedVariable
                scripts.append(script_name)
            for script_name in scripts:
                spath = os.path.join('/', self.tmp_noscripts_dir, script_name)
                write_script("**%s\n" % script_name, self.noscripts_log, 'a')  # do log
                ret = os.system("/usr/sbin/chroot %s /bin/sh %s  2>&1 >> %s" % (self.tgtsys_root, spath, self.noscripts_log))
                if ret != 0:
                    err_msg = 'Error run scripts(noscripts) in %s-%s-%s\n' \
                            % (h['name'],h['version'],h['release'])
                    logger.i(err_msg)
                    write_script(err_msg, self.noscripts_log, 'a')   # do log
                    return ret
            return 1
        
        write_script('Execute Pre Post Scripts:\n\t%s\n' % str(self.noscripts_pkg_list), self.noscripts_log, 'a')  # do log
        script_dir = os.path.join(self.tgtsys_root, self.tmp_noscripts_dir)
        if not os.path.exists(script_dir):
            os.makedirs(script_dir)
        ts_m = rpm.TransactionSet(self.tgtsys_root)
        for pkg in self.noscripts_pkg_list:
            pkgname = get_pkg_name(pkg)
            mi = ts_m.dbMatch('name', pkgname)
            for h in mi:
                if h['name'] == pkgname:
                    ret = excute_pre_post(h)
                    if ret != 0:
                        # Error
                        return ret

        self.noscripts_pkg_list = []
        if progress_cb:
            progress_cb.set_step(1, 1)
        return 0
Пример #21
0
 def install_post(self):
     if self.ts is not None:
         logger.i('Close TransactionSet\n')
         self.ts.closeDB()
         self.ts = None
     return 0
Пример #22
0
        # The format like ('allpa/hdc.1.pkgarr.py', '/dev/hdc', 'iso9660', 'MagicLinux/base', '')
        # ['allpa/sda6.100.pkgarr.py', '/dev/sda6', 'ext3', 'MagicLinux/base', 'MagicLinux-3.0-1.iso']

    mia.set_step(operid, 0, -1)

    result = []

    all_drives = {}
    all_parts = getdev.get_part_info(getdev.CLASS_HD)
    cdrom_dev = getdev.get_dev_info(getdev.CLASS_CDROM)
    for k, v in cdrom_dev.items():
        v['fstype'] = 'iso9660'  # fill cdrom file type, because it is None for default.

    all_drives.update(all_parts)
    all_drives.update(cdrom_dev)
    logger.i('all_drives: %s' % all_drives)
    pos_id = -1
    for k, value in all_drives.items():
        devpath = value['devpath']
        fstype = value['fstype']
        if not CF.D.FSTYPE_MAP.has_key(fstype):
            continue
        if CF.D.FSTYPE_MAP[fstype][0] == '':
            continue
        midev = MiDevice(devpath, CF.D.FSTYPE_MAP[fstype][0])
        logger.d('Search %s pkgarr(%s) in dirs %s' %
                 (CF.D.BOOTCDFN, CF.D.PKGARR_FILE,
                  repr(CF.D.PKGARR_SER_HDPATH + CF.D.PKGARR_SER_CDPATH)))
        for f, reldir in midev.iter_searchfiles(
            [CF.D.PKGARR_FILE, CF.D.BOOTCDFN],
                CF.D.PKGARR_SER_HDPATH + CF.D.PKGARR_SER_CDPATH):
Пример #23
0
        try:
            server.handle_request()
        except select.error:
            print 'select.error exception'
        if server_quit:
            break
    # Block until the action process terminate.
    mia.wait_action_exit()

elif mia.pid == 0:
    # Action process. For long operation only.
    #from mi.utils import MiLogger
    #log_long = MiLogger('mi_long')
    from mi.server.utils import logger
    from mi.server import handlers_long
    logger.i('test long logger')
    while 1:
        (id, opera) = mia.get_operation()
        if opera == 'quit':
            break
        else:
            (params, method) = xmlrpclib.loads(opera)
            if handlers_long.has_key(method):
                if CF.D.EXPERT_MODE:
                    logger.d('Run long.%s() with %s and id %d,\n' %
                             (method, params, id))
                exe_ok = True
                try:
                    result = handlers_long[method](mia, id, *params)
                except:
                    result = 'Exception: run method %s raise %s' % (
Пример #24
0
 def install_post(self):
     if self.ts is not None:
         logger.i("Close TransactionSet\n")
         self.ts.closeDB()
         self.ts = None
     return 0
Пример #25
0
        return [remotefn, new_device, fstype, reldir, isofn]
        # The format like ('allpa/hdc.1.pkgarr.py', '/dev/hdc', 'iso9660', 'MagicLinux/base', '')
        # ['allpa/sda6.100.pkgarr.py', '/dev/sda6', 'ext3', 'MagicLinux/base', 'MagicLinux-3.0-1.iso']
    mia.set_step(operid, 0, -1)

    result = []
    
    all_drives = {}
    all_parts = getdev.get_part_info(getdev.CLASS_HD)
    cdrom_dev = getdev.get_dev_info(getdev.CLASS_CDROM)
    for k, v in cdrom_dev.items():
        v['fstype'] = 'iso9660'   # fill cdrom file type, because it is None for default.
    
    all_drives.update(all_parts)
    all_drives.update(cdrom_dev)
    logger.i('all_drives: %s' % all_drives)
    pos_id = -1
    for k, value in all_drives.items():
        devpath = value['devpath']
        fstype = value['fstype']
        if not CF.D.FSTYPE_MAP.has_key(fstype):
            continue
        if CF.D.FSTYPE_MAP[fstype][0] == '':
            continue
        midev = MiDevice(devpath, CF.D.FSTYPE_MAP[fstype][0])
        logger.d('Search %s pkgarr(%s) in dirs %s' % (CF.D.BOOTCDFN, CF.D.PKGARR_FILE, repr(CF.D.PKGARR_SER_HDPATH+CF.D.PKGARR_SER_CDPATH)))
        for f, reldir in midev.iter_searchfiles([CF.D.PKGARR_FILE, CF.D.BOOTCDFN], CF.D.PKGARR_SER_HDPATH+CF.D.PKGARR_SER_CDPATH):
            if f.endswith('.iso'):
                midev_iso = MiDevice(f, 'iso9660')
                for pkgarr, relative_dir in midev_iso.iter_searchfiles([CF.D.PKGARR_FILE], CF.D.PKGARR_SER_CDPATH):
                    pos_id += 1