예제 #1
0
    def applyRequest(self):

        pt = self.partitionType()

        if not pt.mountpoint: # do nothing
            return

        source = self.partition().getPath()
        target = consts.target_dir + pt.mountpoint
        filesystem = pt.filesystem.name()

        if not os.path.isdir(target):
            os.mkdir(target)

        yalisys.mount(source, target, filesystem)
        
        mtab_entry = "%s %s %s rw 0 0\n" % (source,
                                            target,
                                            filesystem)
        open("/etc/mtab", "a").write(mtab_entry)
        #FIXME: use logging system
#        print mtab_entry

        
        PartRequest.applyRequest(self)
예제 #2
0
def is_windows_boot(partition_path, file_system):
    m_dir = "/tmp/pcheck"
    if not os.path.isdir(m_dir):
        os.makedirs(m_dir)

    try:
        if file_system == "fat32":
            yalisys.mount(partition_path, m_dir, "vfat")
        else:
            yalisys.mount(partition_path, m_dir, file_system)
    except:
        return False

    exist = lambda f: os.path.exists(os.path.join(m_dir, f))

    if exist("boot.ini") or exist("command.com"):
        yalisys.umount(m_dir)
        return True
    else:
        yalisys.umount(m_dir)
        return False