Add remove floppy for executing parted.

netsetup
Mike Hiretsky 14 years ago
parent 4c2bd780dd
commit c4c634164c

@ -41,6 +41,24 @@ class fillVars(object, glob_attr):
"/opt", "/proc", "/sbin",
"/sys", "/usr", "/var"]
def removeFloppy(self):
"""Remove floopy device and return floppyData"""
floppyPath = '/dev/fd1'
if path.exists(floppyPath):
info = os.lstat(floppyPath)
os.unlink(floppyPath)
return (floppyPath,info)
return None
def restoreFloppy(self,floppyData):
"""Restore floppy device by floppyData"""
try:
if floppyData:
os.mknod(floppyData[0],floppyData[1].st_mode,
floppyData[1].st_rdev)
except:
pass
def get_cl_install_merge_action(self):
"""Need perform templates for install:merge or install:unmerge"""
if self.Get('cl_assemble_prepare_action') != "":
@ -170,12 +188,15 @@ class fillVars(object, glob_attr):
disk_hash[part]['id'] = sysid
# parse all parted lines started with Disk and started with number
floppyData = self.removeFloppy()
execProg = '/usr/sbin/parted'
execStr = '%s -l'%execProg
if not path.exists(execProg):
cl_overriding.printERROR(_("Command not found '%s'")%execProg)
cl_overriding.exit(1)
res = self._runos(execStr,env={"LANG":"C"})
self.restoreFloppy(floppyData)
if res is False:
cl_overriding.printERROR(_("Cann't execute '%s'")%execStr)
cl_overriding.exit(1)

Loading…
Cancel
Save