def create_image(self, fs_type='RAMFS'): print _("NFSLiveCDImage: Creating Live CD Image Now...") image_type = _("NFS Live CD Image") self.create_all_initramfs() initrd_stat_result = os.stat('/tmp/.tmp.initrd0') self.tmp_path = tempfile.mkdtemp('','pdk-', '/tmp') self.kernels.insert(0,self.default_kernel) for count, kernel in enumerate(self.kernels): initrd_path = os.path.join(self.tmp_path, "initrd%d.img" % count) try: shutil.move("/tmp/.tmp.initrd%d" % count, initrd_path) except: print _("shutil.move failed. Ignored error") self.kernels.pop(0) # Flashing yellow on a green background self.install_kernels("ae", image_type, 'NFSCDImage') try: pdk_utils.copy(os.path.join(self.project.path, "usr/lib/syslinux/isolinux.bin"), self.tmp_path) except OSError: print _("Could not copy isolinux.bin. Ignored error") print _("Creating NFS CD image file at: %s") % self.path jail_path = self.path[len(self.project.path):] cmd_line = "genisoimage -quiet -o %s -b isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -l -R -r %s" % (jail_path, self.tmp_path) result = self.project.chroot(cmd_line) if result: print >> sys.stderr, _("Error running command: %s") % cmd_line raise EnvironmentError, _("Error running command: %s") % cmd_line shutil.rmtree(self.tmp_path) self.tmp_path = '' print _("NFSLiveIsoImage: Finished!")
def create_fstab(self, swap = True): #FIXME #Check to see if fstab exists as a part of platform definition #If it exists copy that if os.path.isfile(os.path.join(self.project.platform.path, 'fstab')): try: pdk_utils.copy(os.path.join(self.project.platform.path, 'fstab'), os.path.join(self.target.fs_path, 'etc/fstab')) except: self.create_new_fstab(swap) #if it does not exists, create one else: self.create_new_fstab(swap)
def create_image(self): print _("InstallUsbImage: Creating InstallUSB Image...") image_type = _("Install USB Image. This will DESTROY all content on your hard drive!!") if self.project.platform.config_info['package_manager'] == 'apt': self.create_all_initramfs() self.create_grub_menu() self.apply_hd_kernel_cmdline() if self.project.platform.config_info['package_manager'] == 'yum': self.create_all_initrd() self.create_grub_menu_yum() self.create_rootfs() self.create_bootfs() initrd_stat_result = os.stat('/tmp/.tmp.initrd0') rootfs_stat_result = os.stat(self.rootfs_path) bootfs_stat_result = os.stat(self.bootfs_path) size = ((rootfs_stat_result.st_size + bootfs_stat_result.st_size + initrd_stat_result.st_size) / (1024 * 1024)) + 64 self.create_usb_image(size) self.mount_container() self.kernels.insert(0,self.default_kernel) for count, kernel in enumerate(self.kernels): initrd_path = os.path.join(self.tmp_path, "initrd%d.img" % count) try: shutil.move("/tmp/.tmp.initrd%d" % count, initrd_path) except: print _("shutil.move failed. Ignored error") self.kernels.pop(0) # Flashing yellow on a red background self.install_kernels("ce", image_type, 'USBImage') try: pdk_utils.copy(self.rootfs_path, self.tmp_path) except OSError: print _("Could not copy rootfs_path. Ignored error") try: pdk_utils.copy(self.bootfs_path, self.tmp_path) except OSError: print _("Could not copy bootfs_path. Ignored error") try: self.create_install_script(self.tmp_path) except OSError: print _("Could create install script. Ignored error") self.umount_container() self.delete_rootfs() self.delete_bootfs() print _("InstallUsbImage: Finished!") print _("\nYou can now use the image to boot and install the target file-system on the target device's HDD.\n") print _("\nWARNING: Entire contents of the target devices's HDD will be erased prior to installation!") print _(" This includes ALL partitions on the disk!\n") print _("InstallUsbImage: Finished!")
def create_image(self, fs_type='RAMFS'): if fs_type == 'EXT3FS': print _("LiveUsbImage: Creating Live R/W USB Image(%s) Now...") % fs_type image_type = _("Live R/W USB Image") else: print _("LiveUsbImage: Creating Live USB Image(%s) Now...") % fs_type image_type = _("Live USB Image (no persistent R/W)") # How big to make the ext3 File System on the Live RW USB image, in megabytes ext3fs_fs_size = int(self.project.get_target_config(self.target.name, 'usb_ext3fs_size')) if self.project.platform.config_info['package_manager'] == 'apt': self.create_all_initramfs() if self.project.platform.config_info['package_manager'] == 'yum': self.create_all_initrd() self.create_rootfs() initrd_stat_result = os.stat('/tmp/.tmp.initrd0') rootfs_stat_result = os.stat(self.rootfs_path) size = ((rootfs_stat_result.st_size + initrd_stat_result.st_size) / (1024 * 1024)) + 64 if fs_type == 'EXT3FS': size = size + ext3fs_fs_size self.create_usb_image(size) self.mount_container() self.kernels.insert(0,self.default_kernel) for count, kernel in enumerate(self.kernels): initrd_path = os.path.join(self.tmp_path, "initrd%d.img" % count) try: shutil.move("/tmp/.tmp.initrd%d" % count, initrd_path) except: print _("shutil.move failed. Ignored error") self.kernels.pop(0) # Flashing yellow on a blue background self.install_kernels("9e", image_type, 'USBImage') try: pdk_utils.copy(self.rootfs_path, self.tmp_path) except OSError: print _("Could not copy rootfs_path. Ignored error") if fs_type == 'EXT3FS': self.create_ext3fs_file(os.path.join(self.tmp_path, 'ext3fs.img'), ext3fs_fs_size) self.umount_container() self.delete_rootfs() print _("LiveUsbImage: Finished!")
def create_image(self, fs_type='RAMFS'): print _("LiveCDImage: Creating Live CD Image(%s) Now...") % fs_type image_type = _("Live CD Image (no persistent R/W)") self.create_all_initramfs() self.create_rootfs() initrd_stat_result = os.stat('/tmp/.tmp.initrd0') rootfs_stat_result = os.stat(self.rootfs_path) self.tmp_path = tempfile.mkdtemp('','pdk-', '/tmp') self.kernels.insert(0,self.default_kernel) for count, kernel in enumerate(self.kernels): initrd_path = os.path.join(self.tmp_path, "initrd%d.img" % count) try: shutil.move("/tmp/.tmp.initrd%d" % count, initrd_path) except: print _("shutil.move failed. Ignored error") self.kernels.pop(0) # Flashing yellow on a blue background self.install_kernels("9e", image_type, 'CDImage') try: pdk_utils.copy(self.rootfs_path, self.tmp_path) except OSError: print _("Could not copy rootfs_path. Ignored error") try: pdk_utils.copy(os.path.join(self.project.path, "/usr/lib/syslinux/isolinux.bin"), self.tmp_path) except OSError: print _("Could not copy isolinux.bin. Ignored error") print _("Creating CD image file at: %s") % self.path cmd_line = "genisoimage -quiet -o %s -b isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -l -R -r %s" % (self.path, self.tmp_path) result = pdk_utils.execCommand(cmd_line, callback = self.progress_callback) if result: print >> sys.stderr, _("Error running command: %s") % cmd_line raise EnvironmentError, _("Error running command: %s") % cmd_line shutil.rmtree(self.tmp_path) self.tmp_path = '' self.delete_rootfs() print _("LiveIsoImage: Finished!")
def create_image(self): print _("InstallCDImage: Creating Install CD Image Now...") image_type = _("Install CD Image. This will DESTROY all content on your hard drive!!") if self.project.platform.config_info['package_manager'] == 'apt': self.create_all_initramfs() self.create_grub_menu() self.apply_hd_kernel_cmdline() if self.project.platform.config_info['package_manager'] == 'yum': self.create_all_initrd() self.create_grub_menu_yum() self.create_rootfs() self.create_bootfs() initrd_stat_result = os.stat('/tmp/.tmp.initrd0') rootfs_stat_result = os.stat(self.rootfs_path) bootfs_stat_result = os.stat(self.bootfs_path) self.tmp_path = tempfile.mkdtemp('','pdk-', '/tmp') self.kernels.insert(0,self.default_kernel) for count, kernel in enumerate(self.kernels): initrd_path = os.path.join(self.tmp_path, "initrd%d.img" % count) try: shutil.move("/tmp/.tmp.initrd%d" % count, initrd_path) except: print _("shutil.move failed. Ignored error") self.kernels.pop(0) # Flashing yellow on a red background self.install_kernels("ce", image_type, 'CDImage') try: pdk_utils.copy(self.rootfs_path, self.tmp_path) except OSError: print _("Could not copy rootfs_path. Ignored error") try: pdk_utils.copy(self.bootfs_path, self.tmp_path) except OSError: print _("Could not copy bootfs_path. Ignored error") try: self.create_install_script(self.tmp_path) except OSError: print _("Could not create install script. Ignored error") try: pdk_utils.copy(os.path.join(self.project.path, "usr/lib/syslinux/isolinux.bin"), self.tmp_path) except OSError: print _("Could not copy isolinux.bin. Ignored error") print _("Creating CD image file at: %s") % self.path jail_path = self.path[len(self.project.path):] cmd_line = "genisoimage -quiet -o %s -b isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -l -R -r %s" % (jail_path, self.tmp_path) result = self.project.chroot(cmd_line) if result: print >> sys.stderr, _("Error running command: %s") % cmd_line raise EnvironmentError, _("Error running command: %s") % cmd_line shutil.rmtree(self.tmp_path) self.tmp_path = '' self.delete_rootfs() self.delete_bootfs() print _("InstallIsoImage: Finished!") print _("\nYou can now use the image to boot and install the target file-system on the target device's HDD.\n") print _("\nWARNING: Entire contents of the target devices's HDD will be erased prior to installation!") print _(" This includes ALL partitions on the disk!\n") print _("InstallIsoImage: Finished!")