|
|
|
@ -23,7 +23,7 @@ from cl_datavars import glob_attr
|
|
|
|
|
from os import path
|
|
|
|
|
from os import readlink,access,R_OK
|
|
|
|
|
from cl_utils import isMount,typeFile,getTupleVersion,pathJoin,isFstabMount,\
|
|
|
|
|
listDirectory, getAvailableX11Drivers
|
|
|
|
|
listDirectory, getAvailableX11Drivers, getUUIDDict
|
|
|
|
|
from cl_distr import DistributiveRepository,PartitionDistributive
|
|
|
|
|
from cl_fill import clLocale
|
|
|
|
|
from operator import itemgetter
|
|
|
|
@ -166,6 +166,15 @@ class fillVars(object, glob_attr):
|
|
|
|
|
return device_hash
|
|
|
|
|
|
|
|
|
|
def get_os_disk_hash(self):
|
|
|
|
|
# check command existing
|
|
|
|
|
for util in ("/sbin/fdisk","/usr/sbin/gdisk","/sbin/blkid",
|
|
|
|
|
"/usr/sbin/parted"):
|
|
|
|
|
utilPath = self.getProgPath(util)
|
|
|
|
|
if not utilPath:
|
|
|
|
|
cl_overriding.printERROR(_("Command not found '%s'")%
|
|
|
|
|
path.basename(util))
|
|
|
|
|
cl_overriding.exit(1)
|
|
|
|
|
|
|
|
|
|
reSdaPart = \
|
|
|
|
|
re.compile("^/dev/(sd[a-z])(\d+)|/dev/(cciss/c\dd\d+)p(\d+)$")
|
|
|
|
|
devicesHash = self.Get('os_device_hash')
|
|
|
|
@ -194,14 +203,9 @@ class fillVars(object, glob_attr):
|
|
|
|
|
int(match.groups()[3])-1)
|
|
|
|
|
curDevice = None
|
|
|
|
|
|
|
|
|
|
# getting id
|
|
|
|
|
execFdisk = self.getProgPath("/sbin/fdisk")
|
|
|
|
|
execGdisk = self.getProgPath("/usr/sbin/gdisk")
|
|
|
|
|
# check on error utils path
|
|
|
|
|
for utilPath,name in [(execFdisk,"fdisk"),(execGdisk,"gdisk")]:
|
|
|
|
|
if not utilPath:
|
|
|
|
|
cl_overriding.printERROR(_("Command not found '%s'")%name)
|
|
|
|
|
cl_overriding.exit(1)
|
|
|
|
|
# getting id
|
|
|
|
|
for device in devices:
|
|
|
|
|
if devicesHash[device]['table'] == 'msdos':
|
|
|
|
|
execStr = '%s -l %s'%(execFdisk,"/dev/%s"%device)
|
|
|
|
@ -239,9 +243,6 @@ class fillVars(object, glob_attr):
|
|
|
|
|
floppyData = self.removeFloppy()
|
|
|
|
|
execProg = self.getProgPath("/usr/sbin/parted")
|
|
|
|
|
execStr = '%s -l'%execProg
|
|
|
|
|
if not execProg:
|
|
|
|
|
cl_overriding.printERROR(_("Command not found '%s'")%"parted")
|
|
|
|
|
cl_overriding.exit(1)
|
|
|
|
|
res = self._runos(execStr,env={"LANG":"C"})
|
|
|
|
|
self.restoreFloppy(floppyData)
|
|
|
|
|
|
|
|
|
@ -278,9 +279,6 @@ class fillVars(object, glob_attr):
|
|
|
|
|
disk_hash[partition]['size'] = parts[3]
|
|
|
|
|
# fill format, name and uuid
|
|
|
|
|
execStr = self.getProgPath('/sbin/blkid')
|
|
|
|
|
if not execStr:
|
|
|
|
|
cl_overriding.printERROR(_("Command not found '%s'")%"blkid")
|
|
|
|
|
cl_overriding.exit(1)
|
|
|
|
|
res = self._runos(execStr)
|
|
|
|
|
if res is False:
|
|
|
|
|
cl_overriding.printERROR(_("Cann't execute '%s'")%execStr)
|
|
|
|
@ -300,17 +298,8 @@ class fillVars(object, glob_attr):
|
|
|
|
|
key = blkid_hash[key]
|
|
|
|
|
disk_hash[dev][key] = value[1:-1]
|
|
|
|
|
# discard comment and empty string
|
|
|
|
|
devuuid = '/dev/disk/by-uuid'
|
|
|
|
|
if path.exists(devuuid):
|
|
|
|
|
mapUuidDev = dict(
|
|
|
|
|
map(lambda x:("UUID=%s"%os.path.basename(x),
|
|
|
|
|
os.path.normpath(os.path.join(devuuid,os.readlink(x)))),
|
|
|
|
|
filter(os.path.islink,
|
|
|
|
|
map(lambda x:os.path.join(devuuid,x),
|
|
|
|
|
listDirectory(devuuid)))))
|
|
|
|
|
else:
|
|
|
|
|
mapUuidDev = {}
|
|
|
|
|
mapDevUuid = dict(map(lambda x:(x[1],x[0]),mapUuidDev.items()))
|
|
|
|
|
mapUuidDev = getUUIDDict()
|
|
|
|
|
mapDevUuid = dict(zip(mapUuidDev.values(),mapUuidDev.keys()))
|
|
|
|
|
mountOptionsList = \
|
|
|
|
|
filter(lambda x: x.strip() and not x.strip().startswith('#'),
|
|
|
|
|
open("/etc/fstab").readlines())
|
|
|
|
@ -1236,19 +1225,8 @@ class fillVars(object, glob_attr):
|
|
|
|
|
return self.Get('cl_autoupdate_set')
|
|
|
|
|
|
|
|
|
|
def get_cl_install_kernel_uid(self):
|
|
|
|
|
uuidpath = '/dev/disk/by-uuid'
|
|
|
|
|
if not os.access(uuidpath,os.R_OK):
|
|
|
|
|
return ""
|
|
|
|
|
uuidDevs = filter(os.path.islink,map(lambda x: os.path.join(uuidpath,x),
|
|
|
|
|
listDirectory(uuidpath)))
|
|
|
|
|
mapDevUuid = dict(map(lambda x:(os.path.normpath(os.path.join(uuidpath,
|
|
|
|
|
os.readlink(x))),
|
|
|
|
|
os.path.basename(x)),
|
|
|
|
|
uuidDevs))
|
|
|
|
|
if self.Get('os_install_root_dev') in mapDevUuid:
|
|
|
|
|
return mapDevUuid[self.Get('os_install_root_dev')][:8]
|
|
|
|
|
else:
|
|
|
|
|
return ""
|
|
|
|
|
mapDevUuid = getUUIDDict(revers=True)
|
|
|
|
|
return mapDevUuid.get(self.Get('os_install_root_dev'),"")[5:13]
|
|
|
|
|
|
|
|
|
|
def get_os_nvidia_mask(self):
|
|
|
|
|
nvidiaeclass = pathJoin(self.Get('cl_chroot_path'),
|
|
|
|
|