From 5eaedb26fe9c8fe024ff528731d74089fa66cf79 Mon Sep 17 00:00:00 2001 From: Mike Hiretsky Date: Mon, 25 Jul 2011 12:58:36 +0400 Subject: [PATCH] Add --iso option. --- pym/cl_fill_install.py | 7 ++++++- pym/cl_install.py | 14 ++++++++++++++ pym/cl_install_cmd.py | 13 +++++++++++-- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/pym/cl_fill_install.py b/pym/cl_fill_install.py index 91e0baa..7b9ab1c 100644 --- a/pym/cl_fill_install.py +++ b/pym/cl_fill_install.py @@ -313,6 +313,9 @@ class fillVars(object, glob_attr): dev_hash['options'] = fstab.getBy(what=fstab.OPTS,eq=devName) or "" dev_hash['size'] = getPartitionSize(disk) dev_hash['content'] = osProberHash.get(devName,'') + if not dev_hash['content'] and devParent in devicesHash and \ + devicesHash[devParent]['type'] == "flash": + dev_hash['content'] = distrRep._getfromcontent(devName).get('name','') if devParent in devicesHash and 'ID_PART_ENTRY_NUMBER' in props: dev_hash['grub'] = "%s,%d"%(devicesHash[devParent]['map'], int(props['ID_PART_ENTRY_NUMBER'])-1) @@ -689,7 +692,9 @@ class fillVars(object, glob_attr): discardType = ["dir"] else: discardType = [] - distRep = DistributiveRepository(self.Get('cl_image_path')) + if type(imagePath) == str: + imagePath = [imagePath] + distRep = DistributiveRepository(imagePath) return distRep.getBestDistributive(march=archMachine, shortname=shortName.lower(), discardType=discardType, diff --git a/pym/cl_install.py b/pym/cl_install.py index 93d60ee..e74d4ca 100644 --- a/pym/cl_install.py +++ b/pym/cl_install.py @@ -2470,3 +2470,17 @@ the system") + " (yes/no)" self.printERROR(_("Package uninstallation failed")) return False return True + + def setIso(self,isoimage): + """Set iso image for installation""" + imageData = DistributiveRepository()._getfromcontent(isoimage) + if "name" in imageData and imageData.get('build','') and \ + "march" in imageData: + self.clVars.Set('os_install_arch_machine', + imageData['march'],True) + self.setLinuxName(imageData['name'].upper()) + self.clVars.Set('cl_image',True) + return True + else: + self.printERROR(_("Wrong image file")) + return False diff --git a/pym/cl_install_cmd.py b/pym/cl_install_cmd.py index 3c81ec5..338a965 100644 --- a/pym/cl_install_cmd.py +++ b/pym/cl_install_cmd.py @@ -57,6 +57,9 @@ CMD_OPTIONS = [{'shortOption':"d", 'choices':['flash','hdd','usb-hdd'], 'help':_("device type for installed system") }, + {'longOption':'iso', + 'optVal':"ISO", + 'help':_("ISO image for installation")}, {'shortOption':"s", 'longOption':"os", 'optVal':"SYSTEM", @@ -372,6 +375,10 @@ class install_cmd(share_cmd): self.logicObj.clVars.Set('os_install_root_type', self.optobj.values.type, True) + if self.optobj.values.iso: + if not self.logicObj.setIso(self.optobj.values.iso): + return False + listDiskOptions = [] listBindOptions = [] listSwapOptions = [] @@ -469,8 +476,10 @@ class install_cmd(share_cmd): if self.logicObj.installSystem(force=force, bootDisk=bootDisk, stdinReadPwd=stdinReadPwd, builder=builder, flagSpinner=flagSpinner,update=update): - self.defaultPrint("\n") - self.defaultPrint(_("To apply changes you have to reboot")+".\n") + if self.logicObj.clVars.Get('os_install_root_type') != "flash": + self.defaultPrint("\n") + self.defaultPrint(_("To apply changes you have to reboot")+ + ".\n") return True else: return False