|
|
|
@ -465,7 +465,7 @@ class convertDictOpt:
|
|
|
|
|
# detect duplicate options
|
|
|
|
|
dupOptions = filter(lambda x: realOptions.count(x)>1, set(realOptions))
|
|
|
|
|
if dupOptions:
|
|
|
|
|
raise InstallError(_("Duplicate options %s")%", ".join(dupOptions))
|
|
|
|
|
raise InstallError(_("Duplicated options %s")%", ".join(dupOptions))
|
|
|
|
|
realOptions = map(lambda x: x.split("=")[0], realOptions)
|
|
|
|
|
self._checkExistsOptions(realFileSystem, realOptions)
|
|
|
|
|
data = self._getFileSystemData(realFileSystem)
|
|
|
|
@ -500,7 +500,7 @@ class convertDictOpt:
|
|
|
|
|
# detect duplicate options
|
|
|
|
|
dupOptions = filter(lambda x: realOptions.count(x)>1, set(realOptions))
|
|
|
|
|
if dupOptions:
|
|
|
|
|
raise InstallError(_("Duplicate options %s")%", ".join(dupOptions))
|
|
|
|
|
raise InstallError(_("Duplicated options %s")%", ".join(dupOptions))
|
|
|
|
|
splOptions = map(lambda x: x.split("=")[0], realOptions)
|
|
|
|
|
self._checkExistsOptions(realFileSystem, splOptions)
|
|
|
|
|
dictOpt = {}
|
|
|
|
@ -666,7 +666,7 @@ class convertDictOpt:
|
|
|
|
|
if optFileSystem:
|
|
|
|
|
# if specified wrong fs
|
|
|
|
|
if not optFileSystem in supportedFS:
|
|
|
|
|
raise InstallError(_("Wrong file system options '%s'")\
|
|
|
|
|
raise InstallError(_("Wrong file system option '%s'")\
|
|
|
|
|
%optFileSystem)
|
|
|
|
|
if not optFileSystem in availableFS:
|
|
|
|
|
raise InstallError(_("File system '%s' is not available")\
|
|
|
|
@ -679,7 +679,8 @@ class convertDictOpt:
|
|
|
|
|
raise InstallError(
|
|
|
|
|
_("File system for '%(mp)s' should not be '%(opt)s'")
|
|
|
|
|
%{'mp':mp, 'opt':optFileSystem})
|
|
|
|
|
if not "fileSystem" in dictOptions or optFileSystem == "default":
|
|
|
|
|
if not "fileSystem" in dictOptions or \
|
|
|
|
|
optFileSystem == "default":
|
|
|
|
|
dictOptions.update(
|
|
|
|
|
self.getDefaultOptFileSystem(optFileSystem,
|
|
|
|
|
self._getDeviceType(dev)))
|
|
|
|
@ -755,7 +756,7 @@ class cltCopy(scanDirectory):
|
|
|
|
|
os.makedirs(targetDir)
|
|
|
|
|
copy2(pathname,pathJoin(self.target,pathname))
|
|
|
|
|
except Exception,e:
|
|
|
|
|
raise InstallError(_("Can not copy '%(src)s' to '%(dst)s'")%
|
|
|
|
|
raise InstallError(_("Failed to copy '%(src)s' to '%(dst)s'")%
|
|
|
|
|
{'src':pathname,'dst':pathJoin(self.target,pathname)})
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
@ -781,7 +782,7 @@ class otherfilesCopy(scanDirectory):
|
|
|
|
|
os.makedirs(targetDir)
|
|
|
|
|
copy2(pathname,pathJoin(self.target,pathname))
|
|
|
|
|
except Exception,e:
|
|
|
|
|
raise InstallError(_("Can not copy '%(src)s' to '%(dst)s'")%
|
|
|
|
|
raise InstallError(_("Failed to copy '%(src)s' to '%(dst)s'")%
|
|
|
|
|
{'src':pathname,'dst':pathJoin(self.target,pathname)})
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
@ -891,7 +892,7 @@ class cl_install(color_print, SignalInterrupt):
|
|
|
|
|
addonMbrInfo = ""
|
|
|
|
|
mbrdisk = "%s%s"%(clGet('os_install_mbr'),addonMbrInfo)
|
|
|
|
|
else:
|
|
|
|
|
mbrdisk = _("not changed")
|
|
|
|
|
mbrdisk = _("will not be changed")
|
|
|
|
|
|
|
|
|
|
flash = clGet('os_install_root_type')=="flash"
|
|
|
|
|
usbhdd = clGet('os_install_root_type')=="usb-hdd"
|
|
|
|
@ -932,7 +933,7 @@ class cl_install(color_print, SignalInterrupt):
|
|
|
|
|
[(_("Hardware"),True),
|
|
|
|
|
(_("Machine hardware name"),
|
|
|
|
|
clGet('os_install_arch_machine'),True),
|
|
|
|
|
(_("Quantity processors"),clGet('hr_cpu_num'),hdd),
|
|
|
|
|
(_("Number of processors"),clGet('hr_cpu_num'),hdd),
|
|
|
|
|
(_("Videocard"),clGet('hr_video_name'),hdd),
|
|
|
|
|
(_("{0} video driver").format("Xorg"),
|
|
|
|
|
clGet('os_install_x11_video_drv'),hdd),
|
|
|
|
@ -991,13 +992,13 @@ class cl_install(color_print, SignalInterrupt):
|
|
|
|
|
else:
|
|
|
|
|
deviceName = " " + _("on")+" USB Flash (%s)"%image
|
|
|
|
|
|
|
|
|
|
self.printSUCCESS(_("Found update")+deviceName+": %s %s%s%s\n"%
|
|
|
|
|
self.printSUCCESS(_("An update found")+deviceName+": %s %s%s%s\n"%
|
|
|
|
|
(self.clVars.Get('os_install_linux_name'),
|
|
|
|
|
self.clVars.Get('os_install_linux_ver'),
|
|
|
|
|
subname,build))
|
|
|
|
|
else:
|
|
|
|
|
if update and cmpres == -2:
|
|
|
|
|
self.printWARNING(_("Update already has installed."))
|
|
|
|
|
self.printWARNING(_("Update already installed."))
|
|
|
|
|
else:
|
|
|
|
|
self.printWARNING(_("No update available."))
|
|
|
|
|
|
|
|
|
@ -1155,7 +1156,7 @@ class cl_install(color_print, SignalInterrupt):
|
|
|
|
|
keydata = map(key,datalist)
|
|
|
|
|
dupKey = set(filter(lambda x:keydata.count(x)>1, keydata))
|
|
|
|
|
if dupKey:
|
|
|
|
|
self.printERROR(_("Duplicate {keyname}: {keylist}").format(
|
|
|
|
|
self.printERROR(_("Duplicated {keyname}: {keylist}").format(
|
|
|
|
|
keyname=name,keylist=",".join(dupKey)))
|
|
|
|
|
return False
|
|
|
|
|
return True
|
|
|
|
@ -1217,7 +1218,7 @@ class cl_install(color_print, SignalInterrupt):
|
|
|
|
|
filter(lambda x:not x[SRC] in ipAddrs,
|
|
|
|
|
filter(lambda x:x[SRC],routes)))
|
|
|
|
|
if wrongIps:
|
|
|
|
|
raise InstallError(_("Wrong ip addresses %s in source IP")%
|
|
|
|
|
raise InstallError(_("Wrong ip addresse %s in source IP")%
|
|
|
|
|
(",".join(wrongIps)))
|
|
|
|
|
newroutes = []
|
|
|
|
|
for network,gw,dev,src in routedata+routes:
|
|
|
|
@ -1227,7 +1228,7 @@ class cl_install(color_print, SignalInterrupt):
|
|
|
|
|
routedata+newroutes)
|
|
|
|
|
if not dev:
|
|
|
|
|
raise InstallError(
|
|
|
|
|
_("Can not determine device for network %s")%
|
|
|
|
|
_("Failed to determine the device for network %s")%
|
|
|
|
|
network)
|
|
|
|
|
dev = dev[0][DEV]
|
|
|
|
|
if not gw and not src:
|
|
|
|
@ -1257,7 +1258,7 @@ class cl_install(color_print, SignalInterrupt):
|
|
|
|
|
wrongIface = set(specifiedIface+routeIface)-set(interfaces)
|
|
|
|
|
# check correct iface
|
|
|
|
|
if wrongIface:
|
|
|
|
|
self.printERROR(_("Wrong interfaces: %s")%",".join(wrongIface))
|
|
|
|
|
self.printERROR(_("Wrong interface: %s")%",".join(wrongIface))
|
|
|
|
|
return False
|
|
|
|
|
# check dup iface
|
|
|
|
|
if not self.checkDuplicate(specifiedIface,_("interfaces")):
|
|
|
|
@ -1326,7 +1327,7 @@ class cl_install(color_print, SignalInterrupt):
|
|
|
|
|
if filter(lambda x: x != '/', usedMP):
|
|
|
|
|
if self.clVars.Get('os_install_scratch') == "on":
|
|
|
|
|
self.printERROR(
|
|
|
|
|
_("Builder mode is not support multipartition install"))
|
|
|
|
|
_("Builder mode does not support multipartition install"))
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
# check specified devices
|
|
|
|
@ -1346,7 +1347,7 @@ class cl_install(color_print, SignalInterrupt):
|
|
|
|
|
usingExtPart = list(set(usedDevices)&set(extendedPartitions))
|
|
|
|
|
if usingExtPart:
|
|
|
|
|
self.printERROR(
|
|
|
|
|
_("Imposible to use extended partition %s for installation")%
|
|
|
|
|
_("Unable to use the extended partition %s for installation")%
|
|
|
|
|
usingExtPart[0])
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
@ -1357,7 +1358,7 @@ class cl_install(color_print, SignalInterrupt):
|
|
|
|
|
self.clVars.Get('os_disk_dev'))))
|
|
|
|
|
usingCdromPart = list(set(usedDevices)&set(cdromPartitions))
|
|
|
|
|
if usingCdromPart:
|
|
|
|
|
self.printERROR(_("Imposible to use CDROM %s for installation")%
|
|
|
|
|
self.printERROR(_("Unable to use CDROM %s for installation")%
|
|
|
|
|
usingCdromPart[0])
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
@ -1372,11 +1373,11 @@ class cl_install(color_print, SignalInterrupt):
|
|
|
|
|
raidMemberData)[0][0]
|
|
|
|
|
raidMemberData = raidMemberData.rpartition("raidmember(")[2]
|
|
|
|
|
raidMemberData = raidMemberData.partition(")")[0]
|
|
|
|
|
self.printERROR(_("Imposible to use active {typepart} member"
|
|
|
|
|
" {part} for installation").format(
|
|
|
|
|
self.printERROR(_("Unable to use active {typepart} member {part} "
|
|
|
|
|
"for installation").format(
|
|
|
|
|
typepart="RAID",part=usingRaidMemberPart[0]))
|
|
|
|
|
self.printERROR(
|
|
|
|
|
_("For using this partition need to stop RAID %s")%
|
|
|
|
|
_("To use this partition, you have to stop RAID %s")%
|
|
|
|
|
raidMemberData)
|
|
|
|
|
self.printERROR(" mdadm -S %s"%raidMemberData)
|
|
|
|
|
return False
|
|
|
|
@ -1394,11 +1395,11 @@ class cl_install(color_print, SignalInterrupt):
|
|
|
|
|
lvmMemberData = lvmMemberData.partition(")")[0]
|
|
|
|
|
prop = getUdevDeviceInfo(name=lvmMemberData)
|
|
|
|
|
vgName = prop.get('DM_VG_NAME','')
|
|
|
|
|
self.printERROR(_("Imposible to use active {typepart} member"
|
|
|
|
|
" {part} for installation").format(
|
|
|
|
|
self.printERROR(_("Unable to use active {typepart} member {part} "
|
|
|
|
|
"for installation").format(
|
|
|
|
|
typepart="LVM",part=usingLvmMemberPart[0]))
|
|
|
|
|
self.printERROR(
|
|
|
|
|
_("For using this partition need to remove LVM %s")%
|
|
|
|
|
_("To use this partition, you have to remove LVM %s")%
|
|
|
|
|
lvmMemberData)
|
|
|
|
|
self.printERROR(" vgremove %s"%vgName)
|
|
|
|
|
self.printERROR(" pvremove %s"%usingLvmMemberPart[0])
|
|
|
|
@ -1410,8 +1411,8 @@ class cl_install(color_print, SignalInterrupt):
|
|
|
|
|
if wrongBind:
|
|
|
|
|
incompBind = filter(lambda x:x[1]==wrongBind[0],
|
|
|
|
|
zip(srcMountPoints,destMountPoints))
|
|
|
|
|
self.printERROR(_("Source directory %(src)s already use "\
|
|
|
|
|
"for bind '%(bindSrc)s' to '%(bindDst)s'")\
|
|
|
|
|
self.printERROR(_("Source directory %(src)s already used "
|
|
|
|
|
"for binding '%(bindSrc)s' to '%(bindDst)s'")\
|
|
|
|
|
%{'src':wrongBind[0],
|
|
|
|
|
'bindSrc':incompBind[0][0],
|
|
|
|
|
'bindDst':incompBind[0][1]})
|
|
|
|
@ -1472,7 +1473,8 @@ class cl_install(color_print, SignalInterrupt):
|
|
|
|
|
return ""
|
|
|
|
|
|
|
|
|
|
builderMode = self.clVars.Get('os_install_scratch') == "on"
|
|
|
|
|
clearBuilder = lambda data,isswap: "" if builderMode and isswap != "swap" else data
|
|
|
|
|
clearBuilder = lambda data,isswap: \
|
|
|
|
|
"" if builderMode and isswap != "swap" else data
|
|
|
|
|
# get hash from current variables
|
|
|
|
|
DEV,MOUNT,FS,OPTS = 0,1,2,3
|
|
|
|
|
devMount = dict(map(lambda x:(x[DEV],
|
|
|
|
@ -1501,7 +1503,7 @@ class cl_install(color_print, SignalInterrupt):
|
|
|
|
|
curMP = curDevMount[dev]
|
|
|
|
|
if curMP and ( curMP != mountPoint and isFormat or curMP == '/' ):
|
|
|
|
|
self.printERROR(_("Specified disk '%s' mounted to")\
|
|
|
|
|
%dev + " " + _("'%s' in current system")\
|
|
|
|
|
%dev + " " + _("'%s' in the current system")\
|
|
|
|
|
%curMP)
|
|
|
|
|
return False
|
|
|
|
|
else:
|
|
|
|
@ -1541,7 +1543,7 @@ class cl_install(color_print, SignalInterrupt):
|
|
|
|
|
# update install root dev
|
|
|
|
|
rootDev = filter(lambda x:x[1]['mountPoint']=='/',devMount.items())
|
|
|
|
|
if not rootDev:
|
|
|
|
|
self.printERROR(_("Need specify root partition"))
|
|
|
|
|
self.printERROR(_("The root partition must be specified"))
|
|
|
|
|
return False
|
|
|
|
|
self.clVars.Set('os_install_root_dev',rootDev[0][0],True)
|
|
|
|
|
osInstallRootType = self.clVars.Get('os_install_root_type')
|
|
|
|
@ -1558,15 +1560,18 @@ class cl_install(color_print, SignalInterrupt):
|
|
|
|
|
new_bind_src = []
|
|
|
|
|
if filter(lambda x: x != '/', usedMP):
|
|
|
|
|
self.printERROR(
|
|
|
|
|
_("Installation to flash disk is not support multipartition"))
|
|
|
|
|
_("Installation to flash disk is not supported for "
|
|
|
|
|
"multipartition install"))
|
|
|
|
|
return False
|
|
|
|
|
if filter(lambda x:x['dev']!="none",listSwaps):
|
|
|
|
|
self.printERROR(
|
|
|
|
|
_("Installation to flash disk is not support swap disks"))
|
|
|
|
|
_("Installation to flash disk is not "
|
|
|
|
|
"supported for swap disks"))
|
|
|
|
|
return False
|
|
|
|
|
if builderMode:
|
|
|
|
|
self.printERROR(
|
|
|
|
|
_("Installation to flash disk is not support builder mode"))
|
|
|
|
|
_("Installation to flash disk is not supported"
|
|
|
|
|
" in builder mode"))
|
|
|
|
|
return False
|
|
|
|
|
# receive substitution func. Discard all mp, exclude '/' for flash
|
|
|
|
|
if osInstallRootType != "flash":
|
|
|
|
@ -1614,15 +1619,16 @@ class cl_install(color_print, SignalInterrupt):
|
|
|
|
|
grubDiskType = bootDiskType or rootDiskType
|
|
|
|
|
if "lvm-raid" in grubDiskType:
|
|
|
|
|
self.printERROR(
|
|
|
|
|
_("Grub not support boot from RAID assembled from LVM.")
|
|
|
|
|
_("Grub does not support booting from a RAID assembled from LVM.")
|
|
|
|
|
+ " " +
|
|
|
|
|
_("Try use separate /boot partition"))
|
|
|
|
|
_("Try to use a separate /boot partition"))
|
|
|
|
|
return False
|
|
|
|
|
if grubDiskType.count("raid")>1:
|
|
|
|
|
self.printERROR(
|
|
|
|
|
_("Grub not support boot from RAID assembled from another RAID.")
|
|
|
|
|
_("Grub does not support booting from a RAID assembled "
|
|
|
|
|
"from another RAID.")
|
|
|
|
|
+ " " +
|
|
|
|
|
_("Try use separate /boot partition"))
|
|
|
|
|
_("Try to use a separate /boot partition"))
|
|
|
|
|
return False
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
@ -1641,13 +1647,13 @@ class cl_install(color_print, SignalInterrupt):
|
|
|
|
|
bootDiskFormat = bootDiskFormat or rootDiskFormat
|
|
|
|
|
if "lvm" in bootDiskType or "raid" in bootDiskType:
|
|
|
|
|
self.printERROR(
|
|
|
|
|
_("Legacy grub not support boot from raid or lvm without"
|
|
|
|
|
" separate /boot partition"))
|
|
|
|
|
_("Legacy grub does not support boot from raid or lvm "
|
|
|
|
|
"without separate /boot partition"))
|
|
|
|
|
return False
|
|
|
|
|
if bootDiskFormat in ("btrfs","nilfs2"):
|
|
|
|
|
self.printERROR(
|
|
|
|
|
_("Legacy grub not support boot from %s without"
|
|
|
|
|
" separate /boot partition")%bootDiskFormat)
|
|
|
|
|
_("Legacy grub does not support booting from %s without "
|
|
|
|
|
"separate /boot partition")%bootDiskFormat)
|
|
|
|
|
return False
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
@ -1679,7 +1685,7 @@ class cl_install(color_print, SignalInterrupt):
|
|
|
|
|
self.clVars.Get('os_device_dev')):
|
|
|
|
|
self.clVars.Set('os_install_mbr', mbrDisk, force=True)
|
|
|
|
|
else:
|
|
|
|
|
self.printERROR(_("Cann't found disk '%s'")%mbrDisk)
|
|
|
|
|
self.printERROR(_("Failed to find disk '%s'")%mbrDisk)
|
|
|
|
|
return False
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
@ -1767,12 +1773,12 @@ class cl_install(color_print, SignalInterrupt):
|
|
|
|
|
device = filter(lambda x:x in partition,
|
|
|
|
|
self.clVars.Get('os_device_dev'))
|
|
|
|
|
if not device:
|
|
|
|
|
raise DistributiveError(_("Cann't get parent device"))
|
|
|
|
|
raise DistributiveError(_("Failed to find the parent device"))
|
|
|
|
|
device = device[0]
|
|
|
|
|
|
|
|
|
|
fdiskProcess = process("/sbin/fdisk","-l",device)
|
|
|
|
|
if fdiskProcess.failed():
|
|
|
|
|
raise DistributiveError(_("Cann't get device information\n%s")%
|
|
|
|
|
raise DistributiveError(_("Failed to get device information\n%s")%
|
|
|
|
|
fdiskProcess.read())
|
|
|
|
|
if not filter(reActive.search,fdiskProcess):
|
|
|
|
|
grubDisk = self.getFieldByField("grub","mount","/",
|
|
|
|
@ -1786,7 +1792,7 @@ class cl_install(color_print, SignalInterrupt):
|
|
|
|
|
if filter(reActive.search,process("/sbin/fdisk",
|
|
|
|
|
"-l",device)):
|
|
|
|
|
return True
|
|
|
|
|
raise DistributiveError(_("Cann't set active partition"))
|
|
|
|
|
raise DistributiveError(_("Failed to set the active partition"))
|
|
|
|
|
else:
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
@ -1799,14 +1805,15 @@ class cl_install(color_print, SignalInterrupt):
|
|
|
|
|
"of=%s"%self.clVars.Get('os_install_mbr'),
|
|
|
|
|
stderr=STDOUT)
|
|
|
|
|
if ddProcess.failed():
|
|
|
|
|
raise DistributiveError(_("Cann't write master boot record\n%s")%
|
|
|
|
|
raise DistributiveError(
|
|
|
|
|
_("Failed to write the master boot record\n%s")%
|
|
|
|
|
ddProcess.read())
|
|
|
|
|
target.close()
|
|
|
|
|
installRootDev = self.clVars.Get('os_install_root_dev')
|
|
|
|
|
syslinuxProcess = process("/usr/bin/syslinux",
|
|
|
|
|
installRootDev, stderr=STDOUT)
|
|
|
|
|
if syslinuxProcess.failed():
|
|
|
|
|
raise DistributiveError(_("Cann't install syslinux\n%s")%
|
|
|
|
|
raise DistributiveError(_("Failed to install syslinux\n%s")%
|
|
|
|
|
syslinuxProcess.read())
|
|
|
|
|
# is partition active
|
|
|
|
|
return self.setActivePartition(self.clVars.Get('os_install_root_dev'))
|
|
|
|
@ -1864,9 +1871,9 @@ class cl_install(color_print, SignalInterrupt):
|
|
|
|
|
cmdGrubInstall = self.clVars.Get('os_grub2_path')
|
|
|
|
|
#if not self.setBiosGrubForBootPartition():
|
|
|
|
|
# raise DistributiveError(
|
|
|
|
|
# _("Cann't set bios_grub flag for boot partition"))
|
|
|
|
|
# _("Failed to set bios_grub flag for the boot partition"))
|
|
|
|
|
if not cmdGrubInstall:
|
|
|
|
|
raise DistributiveError(_("Cann't install bootloader"))
|
|
|
|
|
raise DistributiveError(_("Failed to install the bootloader"))
|
|
|
|
|
|
|
|
|
|
mbrDisk = self.clVars.Get('os_install_mbr')
|
|
|
|
|
process("sync").success()
|
|
|
|
@ -1874,7 +1881,7 @@ class cl_install(color_print, SignalInterrupt):
|
|
|
|
|
"--boot-directory=%s"%target.getBootDirectory(),
|
|
|
|
|
mbrDisk, "-f", stderr=STDOUT,envdict=os.environ)
|
|
|
|
|
if grubProcess.failed():
|
|
|
|
|
raise DistributiveError(_("Cann't install bootloader"))
|
|
|
|
|
raise DistributiveError(_("Failed to install the bootloader"))
|
|
|
|
|
|
|
|
|
|
def installLegacyGrubBootloader(self,target):
|
|
|
|
|
"""Install boot loader
|
|
|
|
@ -1883,7 +1890,7 @@ class cl_install(color_print, SignalInterrupt):
|
|
|
|
|
"""
|
|
|
|
|
cmdGrub = varsShare().getProgPath('/sbin/grub')
|
|
|
|
|
if not cmdGrub:
|
|
|
|
|
raise DistributiveError(_("Cann't install bootloader"))
|
|
|
|
|
raise DistributiveError(_("Failed to install the bootloader"))
|
|
|
|
|
grubProcess = process(cmdGrub,
|
|
|
|
|
"--device-map=%s/boot/grub/device.map"%target.getDirectory(),
|
|
|
|
|
"--batch",stderr=STDOUT)
|
|
|
|
@ -1897,13 +1904,13 @@ class cl_install(color_print, SignalInterrupt):
|
|
|
|
|
mbrDiskNum = self.varSelect(
|
|
|
|
|
"os_device_map",where="os_device_dev",eq=mbrDisk)
|
|
|
|
|
if not mbrDiskNum and mbrDiskNum != 0:
|
|
|
|
|
raise DistributiveError(_("Cann't determine mbr disk"))
|
|
|
|
|
raise DistributiveError(_("Failed to determine mbr"))
|
|
|
|
|
for line in ("root (hd%s)"%bootDisk,
|
|
|
|
|
"setup (hd%d)"%mbrDiskNum,
|
|
|
|
|
"quit"):
|
|
|
|
|
grubProcess.write("%s\n"%line)
|
|
|
|
|
if grubProcess.failed():
|
|
|
|
|
raise DistributiveError(_("Cann't install bootloader"))
|
|
|
|
|
raise DistributiveError(_("Failed to install the bootloader"))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def convertTypeToScheme(self,data):
|
|
|
|
@ -2066,7 +2073,8 @@ class cl_install(color_print, SignalInterrupt):
|
|
|
|
|
except EOFError:
|
|
|
|
|
raise KeyboardInterrupt()
|
|
|
|
|
else:
|
|
|
|
|
cl_overriding.printSUCCESS(_("Enter password for user %s")%userName)
|
|
|
|
|
cl_overriding.printSUCCESS(_("Enter the password for user %s")%
|
|
|
|
|
userName)
|
|
|
|
|
try:
|
|
|
|
|
userPwd = getUserPassword()
|
|
|
|
|
while userPwd is False:
|
|
|
|
@ -2079,7 +2087,7 @@ class cl_install(color_print, SignalInterrupt):
|
|
|
|
|
raise KeyboardInterrupt()
|
|
|
|
|
encryptObj = encrypt()
|
|
|
|
|
if not userPwd:
|
|
|
|
|
raise InstallError(_("Unable to find the password for user %s")\
|
|
|
|
|
raise InstallError(_("Failed to find the password for user %s")\
|
|
|
|
|
%userName)
|
|
|
|
|
return False
|
|
|
|
|
pwdHash = encryptObj.getHashPasswd(userPwd, "shadow_ssha256")
|
|
|
|
@ -2239,8 +2247,8 @@ class cl_install(color_print, SignalInterrupt):
|
|
|
|
|
self.stderrHide = None
|
|
|
|
|
|
|
|
|
|
def configureSystem(self,autologin):
|
|
|
|
|
"""configure current system"""
|
|
|
|
|
configureMessage = _("Configure system")
|
|
|
|
|
"""configuring the current system"""
|
|
|
|
|
configureMessage = _("Configure the system")
|
|
|
|
|
error = None
|
|
|
|
|
keyInter = None
|
|
|
|
|
try:
|
|
|
|
@ -2248,7 +2256,7 @@ class cl_install(color_print, SignalInterrupt):
|
|
|
|
|
if autologin:
|
|
|
|
|
objUsers = currentUsers()
|
|
|
|
|
if not objUsers.hasUsers(autologin):
|
|
|
|
|
self.printERROR(_("User %s is not exists")%autologin)
|
|
|
|
|
self.printERROR(_("User %s does not exist")%autologin)
|
|
|
|
|
else:
|
|
|
|
|
self.setUsers([],autologin)
|
|
|
|
|
# install this package
|
|
|
|
@ -2264,7 +2272,8 @@ class cl_install(color_print, SignalInterrupt):
|
|
|
|
|
sys.path.insert(0, path.abspath(desktopLib))
|
|
|
|
|
from cl_desktop import desktop
|
|
|
|
|
self.printMessageForTest(
|
|
|
|
|
_("Link calculate-desktop to package configuration"))
|
|
|
|
|
_("Enable calculate-desktop "
|
|
|
|
|
"for package configuration"))
|
|
|
|
|
self.hideStdout()
|
|
|
|
|
objDesktop = desktop()
|
|
|
|
|
objDesktop.createClVars()
|
|
|
|
@ -2279,7 +2288,7 @@ class cl_install(color_print, SignalInterrupt):
|
|
|
|
|
sys.path.insert(0, path.abspath(clientLib))
|
|
|
|
|
from cl_client import client
|
|
|
|
|
self.printMessageForTest(
|
|
|
|
|
_("Link calculate-client to package configuration"))
|
|
|
|
|
_("Enable calculate-client for package configuration"))
|
|
|
|
|
objClient = client()
|
|
|
|
|
objClient.createClVars()
|
|
|
|
|
self.hideStdout()
|
|
|
|
@ -2308,7 +2317,7 @@ class cl_install(color_print, SignalInterrupt):
|
|
|
|
|
'intel':'i915',
|
|
|
|
|
'nouveau':'nouveau'}.get(installDrv,'uvesafb')
|
|
|
|
|
if not InitRamFs(initrdPath).isModuleInside(needMod):
|
|
|
|
|
self.printMessageForTest(_("Restore initramfs"))
|
|
|
|
|
self.printMessageForTest(_("Restoring initramfs"))
|
|
|
|
|
self.printByResult(InitRamFs(initrdInstallPath)\
|
|
|
|
|
.cleanInitRamFs(initrdPath))
|
|
|
|
|
oldXdrv = self.clVars.Get('os_x11_video_drv')
|
|
|
|
@ -2318,11 +2327,11 @@ class cl_install(color_print, SignalInterrupt):
|
|
|
|
|
self.defaultPrint("\n")
|
|
|
|
|
if oldXdrv in kmsDrv or newXdrv in kmsDrv:
|
|
|
|
|
self.defaultPrint(
|
|
|
|
|
_("To apply changes you must reboot the system")
|
|
|
|
|
_("To apply the changes, reboot the system")
|
|
|
|
|
+".\n")
|
|
|
|
|
else:
|
|
|
|
|
self.defaultPrint(
|
|
|
|
|
_("To apply changes you must restart the X server")
|
|
|
|
|
_("To apply the changes, restart the X server")
|
|
|
|
|
+".\n")
|
|
|
|
|
except (InstallError,DistributiveError),e:
|
|
|
|
|
error = e
|
|
|
|
@ -2341,8 +2350,8 @@ class cl_install(color_print, SignalInterrupt):
|
|
|
|
|
if self.startMessage:
|
|
|
|
|
self.printByResult(False)
|
|
|
|
|
self.defaultPrint("\n")
|
|
|
|
|
self.printWARNING(_("Interrupting the configuration"))
|
|
|
|
|
error = _("Configuration manually interrupt")
|
|
|
|
|
self.printWARNING(_("System configuration interrupted"))
|
|
|
|
|
error = _("Configuration manually interrupted")
|
|
|
|
|
if self.startMessage:
|
|
|
|
|
self.printByResult(False)
|
|
|
|
|
if error:
|
|
|
|
@ -2367,13 +2376,14 @@ class cl_install(color_print, SignalInterrupt):
|
|
|
|
|
migrateUsers):
|
|
|
|
|
"""Action performed after distributive copy for hdd install"""
|
|
|
|
|
# copy clt files from current system
|
|
|
|
|
self.printMessageForTest(_("Coping clt templates to new system"))
|
|
|
|
|
self.printMessageForTest(_("Coping clt templates to the new system"))
|
|
|
|
|
cltCpy = cltCopy(target=targetDistr.getDirectory())
|
|
|
|
|
for directory in self.clVars.Get('cl_template_clt_path'):
|
|
|
|
|
cltCpy.performCopy(directory)
|
|
|
|
|
self.printByResult(True)
|
|
|
|
|
|
|
|
|
|
self.printMessageForTest(_("Coping configuration files to new system"))
|
|
|
|
|
self.printMessageForTest(
|
|
|
|
|
_("Coping configuration files to the new system"))
|
|
|
|
|
fileMask = r"/etc/udev/rules\.d/70-persistent-net\.rules"
|
|
|
|
|
if self.clVars.Get('os_root_type') != "livecd":
|
|
|
|
|
fileMask = "(%s|/etc/ssh/ssh_host_.*)"%fileMask
|
|
|
|
@ -2384,11 +2394,11 @@ class cl_install(color_print, SignalInterrupt):
|
|
|
|
|
|
|
|
|
|
# optimize initrd
|
|
|
|
|
self.clVars.Set("cl_chroot_path",targetDistr.getDirectory(), True)
|
|
|
|
|
self.printMessageForTest(_("Creating new initrd file"))
|
|
|
|
|
self.printMessageForTest(_("Creating a new initrd file"))
|
|
|
|
|
self.printByResult(self.cleanInitrd())
|
|
|
|
|
|
|
|
|
|
# join templates
|
|
|
|
|
self.printMessageForTest(_("Updating config"))
|
|
|
|
|
self.printMessageForTest(_("Updating configuration"))
|
|
|
|
|
self.applyTemplates(targetDistr.getDirectory(),
|
|
|
|
|
targetDistr.getBootDirectory()[:-4])
|
|
|
|
|
# mount bind mount points
|
|
|
|
@ -2403,7 +2413,7 @@ class cl_install(color_print, SignalInterrupt):
|
|
|
|
|
self.printMessageForTest(_("Migrate users"))
|
|
|
|
|
objMigrate = migrate(targetDistr.getDirectory())
|
|
|
|
|
if not objMigrate.migrate(addUsers,changePwdUsers,migrateUsers):
|
|
|
|
|
raise InstallError(_("Can not migrate users to new system"))
|
|
|
|
|
raise InstallError(_("Failed to migrate users to the new system"))
|
|
|
|
|
self.printByResult(True)
|
|
|
|
|
|
|
|
|
|
def checkCorrectBootRecordDisk(self):
|
|
|
|
@ -2414,8 +2424,8 @@ class cl_install(color_print, SignalInterrupt):
|
|
|
|
|
tableOnBootDisk = self.varSelect('os_device_table',
|
|
|
|
|
where="os_device_dev",eq=mbr)
|
|
|
|
|
if not tableOnBootDisk:
|
|
|
|
|
self.printERROR(_("Disk '%s' without partition table can't "
|
|
|
|
|
"contains boot record")%mbr)
|
|
|
|
|
self.printERROR(_("Disk '%s' without partition table "
|
|
|
|
|
"contains no boot record")%mbr)
|
|
|
|
|
return False
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
@ -2454,8 +2464,8 @@ class cl_install(color_print, SignalInterrupt):
|
|
|
|
|
distName = self.clVars.Get('cl_image')
|
|
|
|
|
if distName and instver < getTupleVersion(minver):
|
|
|
|
|
self.printERROR(
|
|
|
|
|
_("Installation is supported for system not less version"
|
|
|
|
|
" %s")%minver)
|
|
|
|
|
_("Installation is supported for "
|
|
|
|
|
"system version %s or higher")%minver)
|
|
|
|
|
distName = ""
|
|
|
|
|
if distName and (not update or self.cmpInstallVersion()>0):
|
|
|
|
|
# print info
|
|
|
|
@ -2470,7 +2480,7 @@ the system") + " (yes/no)"
|
|
|
|
|
self.defaultPrint("\n")
|
|
|
|
|
raise KeyboardInterrupt
|
|
|
|
|
if dialogRes in (None,False):
|
|
|
|
|
self.printERROR(_("Interrupting the installation"))
|
|
|
|
|
self.printERROR(_("Installation interrupted"))
|
|
|
|
|
return False
|
|
|
|
|
# set Users passwords
|
|
|
|
|
if self.clVars.Get('os_install_root_type') != "flash":
|
|
|
|
@ -2481,7 +2491,7 @@ the system") + " (yes/no)"
|
|
|
|
|
mntpath = '/mnt'
|
|
|
|
|
if not os.access(mntpath,os.W_OK):
|
|
|
|
|
raise InstallError(
|
|
|
|
|
_("Impossible create directory in '%s'")%mntpath)
|
|
|
|
|
_("Enable to create the directory in '%s'")%mntpath)
|
|
|
|
|
# cmd options
|
|
|
|
|
self.printMessageForTest(_("Formating partitions"))
|
|
|
|
|
targetDistr.performFormat()
|
|
|
|
@ -2489,7 +2499,7 @@ the system") + " (yes/no)"
|
|
|
|
|
|
|
|
|
|
# install distributive
|
|
|
|
|
self.printMessageForTest(
|
|
|
|
|
_("Unpacking system image into target"))
|
|
|
|
|
_("Unpacking the system image into target"))
|
|
|
|
|
self.defaultPrint(" ")
|
|
|
|
|
self.lenStartMessage += 1
|
|
|
|
|
self.clVars.Get('os_grub_conf')
|
|
|
|
@ -2504,7 +2514,7 @@ the system") + " (yes/no)"
|
|
|
|
|
else:
|
|
|
|
|
# join templates
|
|
|
|
|
self.printMessageForTest(
|
|
|
|
|
_("Configure of flash installation"))
|
|
|
|
|
_("Configure flash installation"))
|
|
|
|
|
self.applyTemplatesFlash(targetDistr.getDirectory())
|
|
|
|
|
self.printByResult(True)
|
|
|
|
|
self.closeClTemplate()
|
|
|
|
@ -2529,18 +2539,18 @@ the system") + " (yes/no)"
|
|
|
|
|
except KeyboardInterrupt,e:
|
|
|
|
|
self.setSignalInterrupt()
|
|
|
|
|
self.printByResult(False)
|
|
|
|
|
self.printWARNING(_("Interrupting the installation"))
|
|
|
|
|
error = _("Installation manually interrupt")
|
|
|
|
|
self.printWARNING(_("Installation interrupted"))
|
|
|
|
|
error = _("Installation manually interrupted")
|
|
|
|
|
if error:
|
|
|
|
|
self.printByResult(False)
|
|
|
|
|
try:
|
|
|
|
|
self.closeClTemplate()
|
|
|
|
|
if sourceDistr and sourceDistr.childs:
|
|
|
|
|
self.printMessageForTest(_("Releasing source distributive"))
|
|
|
|
|
self.printMessageForTest(_("Releasing the source distribution"))
|
|
|
|
|
sourceDistr.close()
|
|
|
|
|
self.printByResult(True)
|
|
|
|
|
if targetDistr and targetDistr.childs:
|
|
|
|
|
self.printMessageForTest(_("Unmount target system volume"))
|
|
|
|
|
self.printMessageForTest(_("Unmount the target system volume"))
|
|
|
|
|
targetDistr.close()
|
|
|
|
|
self.printByResult(True)
|
|
|
|
|
except (InstallError,DistributiveError),e:
|
|
|
|
@ -2597,12 +2607,12 @@ the system") + " (yes/no)"
|
|
|
|
|
def installPackage(self):
|
|
|
|
|
"""Install this package. Convert Gentoo system to Calculate"""
|
|
|
|
|
error = None
|
|
|
|
|
self.printSUCCESS(_('Package installation'))
|
|
|
|
|
self.printSUCCESS(_("Package installed"))
|
|
|
|
|
try:
|
|
|
|
|
self.printMessageForTest(
|
|
|
|
|
_("Link calculate-install to package configuration"))
|
|
|
|
|
_("Enable calculate-install for package configuration"))
|
|
|
|
|
self.printByResult(appendProgramToEnvFile(__app__, self.clVars),
|
|
|
|
|
failMessage= _("Can not save '%(app)s' to %(path)s")
|
|
|
|
|
failMessage= _("Failed to save '%(app)s' to %(path)s")
|
|
|
|
|
%{'app':__app__,
|
|
|
|
|
'path':self.clVars.Get("cl_env_path")[0]})
|
|
|
|
|
except (InstallError,DistributiveError),e:
|
|
|
|
@ -2616,13 +2626,13 @@ the system") + " (yes/no)"
|
|
|
|
|
if self.startMessage:
|
|
|
|
|
self.printByResult(False)
|
|
|
|
|
self.defaultPrint("\n")
|
|
|
|
|
error = _("Package installation manually interrupt")
|
|
|
|
|
error = _("Package installation interrupted manually")
|
|
|
|
|
if self.startMessage:
|
|
|
|
|
self.printByResult(False)
|
|
|
|
|
if error:
|
|
|
|
|
for line in filter(lambda x: x,str(error).split('\n')):
|
|
|
|
|
self.printERROR(line)
|
|
|
|
|
self.printERROR(_("Package installation failed"))
|
|
|
|
|
self.printERROR(_("Failed to install the package"))
|
|
|
|
|
return False
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
@ -2632,9 +2642,9 @@ the system") + " (yes/no)"
|
|
|
|
|
self.printSUCCESS(_('Package uninstallation'))
|
|
|
|
|
try:
|
|
|
|
|
self.printMessageForTest(
|
|
|
|
|
_("Unlink calculate-install from package configuration"))
|
|
|
|
|
_("Disable calculate-install for package configuration"))
|
|
|
|
|
self.printByResult(removeProgramToEnvFile(__app__, self.clVars),
|
|
|
|
|
failMessage = _("Can not remove '%(app)s' to %(path)s")\
|
|
|
|
|
failMessage = _("Failed to remove '%(app)s' to %(path)s")\
|
|
|
|
|
%{'app':__app__,
|
|
|
|
|
'path':self.clVars.Get("cl_env_path")[0]})
|
|
|
|
|
except (InstallError,DistributiveError),e:
|
|
|
|
@ -2648,7 +2658,7 @@ the system") + " (yes/no)"
|
|
|
|
|
if self.startMessage:
|
|
|
|
|
self.printByResult(False)
|
|
|
|
|
self.defaultPrint("\n")
|
|
|
|
|
error = _("Package uninstallation manually interrupt")
|
|
|
|
|
error = _("Package uninstallation interrupted manually")
|
|
|
|
|
if self.startMessage:
|
|
|
|
|
self.printByResult(False)
|
|
|
|
|
if error:
|
|
|
|
@ -2683,10 +2693,10 @@ the system") + " (yes/no)"
|
|
|
|
|
not video in ("auto","other"):
|
|
|
|
|
self.printERROR(_("%s videodriver is unavailable")%video)
|
|
|
|
|
if video == "nvidia":
|
|
|
|
|
self.printERROR(_("Install %s driver by command:")%"NVidia")
|
|
|
|
|
self.printERROR(_("Install %s driver with:")%"NVidia")
|
|
|
|
|
self.printERROR(" emerge x11-drivers/nvidia-drivers")
|
|
|
|
|
if video == "fglrx":
|
|
|
|
|
self.printERROR(_("Install %s driver by command:")%"ATI")
|
|
|
|
|
self.printERROR(_("Install %s driver with:")%"ATI")
|
|
|
|
|
self.printERROR(" emerge x11-drivers/ati-drivers")
|
|
|
|
|
return False
|
|
|
|
|
self.clVars.Set('os_install_x11_video_drv',video,force=True)
|
|
|
|
|