예제 #1
0
             f = open(info_file, 'r')
             info = f.read()
             f.close()
             try:
                 self.__debian_version = info.split()[2].split('.')[0]
                 self.log.debug('Found Debian version {0}'.format(self.__debian_version))
             except:
                 # ignore errors
                 pass
         return True
     except Exception, d:
         self.log.error('Error extracting live squash filesystem: %s' % (d))
         return False
     finally:
         # unmount iso
         if not fs_tools.unmount(tmpMntIsoDir):
             self.log.error('Error unmounting %s; check log for details...' % (tmpMntIsoDir))
 
 def update_boot_kernel(self):
     try:
         f = os.listdir('%s' % (os.path.join(self.__live_fs_dir, 'boot')))
         for k in f:
             if k.find('initrd.img') > -1:
                 if k.find('486') > -1:
                     if self.__debian_version == '5':
                         # copy the 486 initrd to iso dir
                         shutil.copy('%s/boot/%s' % (self.__live_fs_dir, k), '%s/live/initrd1.img' % (self.__iso_fs_dir))
                     else:
                         # copy the 486 initrd to iso dir
                         shutil.copy('%s/boot/%s' % (self.__live_fs_dir, k), '%s/live/initrd.img' % (self.__iso_fs_dir))
                 elif k.find('686') > -1:
예제 #2
0
            # fedora uses an ext image -- extract that first, then copy the contents
            tmpdir = tempfile.mkdtemp()
            tmpImgDir = tempfile.mkdtemp()
            self.log.debug('Extracting squash filesystem: %s' % (self.__live_fs_filename))
            squash_tools.extract_squash_fs(unsquashfs_cmd=self.__unsquash, filename=self.__live_fs_filename, dest_dir=tmpdir)
            # mount the ext image
            self.log.debug('Mounting filesystem...')
            fs_tools.mount(os.path.join(tmpdir, 'LiveOS' + os.sep + 'ext3fs.img'), tmpImgDir)
            commands.getoutput('rsync -a %s/ %s/' % (tmpImgDir, self.__live_fs_dir))
            return True
        except Exception, d:
            self.log.error('Error extracting live squash filesystem: %s' % (d))
            return False
        finally:
            # unmount iso
            if not fs_tools.unmount(tmpMntIsoDir):
                self.log.error('Error unmounting %s; check log for details...' % (tmpMntIsoDir))
            if not fs_tools.unmount(tmpImgDir):
                self.log.error('Error unmounting %s; check log for details...' % (tmpImgDir))
            #shutil.rmtree(tmpdir)

    def update_boot_kernel(self):
        # skip for now
        #self.log.info('Not yet implemented...')
        return True
        try:
            f = os.listdir('%s' % (os.path.join(self.__live_fs_dir, 'boot')))
            for k in f:
                if k.find('initrd.img') > -1:
                    # copy the initrd to iso dir
                    shutil.copy('%s/boot/%s' % (self.__live_fs_dir, k), '%s/isolinux/initrd0.img' % (self.__iso_fs_dir))
예제 #3
0
                                           filename=self.__live_fs_filename,
                                           dest_dir=tmpdir)
            # mount the ext image
            self.log.debug('Mounting filesystem...')
            fs_tools.mount(
                os.path.join(tmpdir, 'LiveOS' + os.sep + 'ext3fs.img'),
                tmpImgDir)
            commands.getoutput('rsync -a %s/ %s/' %
                               (tmpImgDir, self.__live_fs_dir))
            return True
        except Exception, d:
            self.log.error('Error extracting live squash filesystem: %s' % (d))
            return False
        finally:
            # unmount iso
            if not fs_tools.unmount(tmpMntIsoDir):
                self.log.error(
                    'Error unmounting %s; check log for details...' %
                    (tmpMntIsoDir))
            if not fs_tools.unmount(tmpImgDir):
                self.log.error(
                    'Error unmounting %s; check log for details...' %
                    (tmpImgDir))
            #shutil.rmtree(tmpdir)

    def update_boot_kernel(self):
        # skip for now
        #self.log.info('Not yet implemented...')
        return True
        try:
            f = os.listdir('%s' % (os.path.join(self.__live_fs_dir, 'boot')))
예제 #4
0
                info = f.read()
                f.close()
                try:
                    self.__debian_version = info.split()[2].split('.')[0]
                    self.log.debug('Found Debian version {0}'.format(
                        self.__debian_version))
                except:
                    # ignore errors
                    pass
            return True
        except Exception, d:
            self.log.error('Error extracting live squash filesystem: %s' % (d))
            return False
        finally:
            # unmount iso
            if not fs_tools.unmount(tmpMntIsoDir):
                self.log.error(
                    'Error unmounting %s; check log for details...' %
                    (tmpMntIsoDir))

    def update_boot_kernel(self):
        try:
            f = os.listdir('%s' % (os.path.join(self.__live_fs_dir, 'boot')))
            for k in f:
                if k.find('initrd.img') > -1:
                    if k.find('486') > -1:
                        if self.__debian_version == '5':
                            # copy the 486 initrd to iso dir
                            shutil.copy(
                                '%s/boot/%s' % (self.__live_fs_dir, k),
                                '%s/live/initrd1.img' % (self.__iso_fs_dir))
예제 #5
0
 def testUnmount(self):
     self.assertTrue(fs_tools.mount(self.iso, self.tmp_dir))
     self.assertTrue(fs_tools.unmount(self.tmp_dir))
     self.assertFalse(os.path.exists(self.tmp_dir))
예제 #6
0
 def testMount(self):
     self.assertTrue(fs_tools.mount(self.iso, self.tmp_dir))
     self.assert_(os.listdir(self.tmp_dir) != 0)
     self.assertTrue(fs_tools.unmount(self.tmp_dir))
예제 #7
0
 def testUnmount(self):
     self.assertTrue(fs_tools.mount(self.iso, self.tmp_dir))
     self.assertTrue(fs_tools.unmount(self.tmp_dir))
     self.assertFalse(os.path.exists(self.tmp_dir))
예제 #8
0
 def testMount(self):
     self.assertTrue(fs_tools.mount(self.iso, self.tmp_dir))
     self.assert_(os.listdir(self.tmp_dir) != 0)
     self.assertTrue(fs_tools.unmount(self.tmp_dir))