Fix english messages. (Sync with i18n).

master
Mike Hiretsky 13 years ago
parent 617071e617
commit b638a0f0eb

@ -74,7 +74,7 @@ class updateConfFiles(color_print):
realPath = "/usr/lib/calculate-2.2/calculate-install" realPath = "/usr/lib/calculate-2.2/calculate-install"
pymPath = os.path.join(realPath,"pym") pymPath = os.path.join(realPath,"pym")
if not "calculate-install" in self.installProgs: if not "calculate-install" in self.installProgs:
self.printERROR(_("Can not installed %s") self.printERROR(_("Failed to install %s")
%"calculate-install") %"calculate-install")
self.printWARNING(\ self.printWARNING(\
_("To install the program, run 'cl-install --install'")) _("To install the program, run 'cl-install --install'"))
@ -96,7 +96,7 @@ subdirectories %s")%', '.join(dirsTemplates))
self.printERROR(_("Permission denied: '%s'")%cltTemplatePath) self.printERROR(_("Permission denied: '%s'")%cltTemplatePath)
return False return False
if not os.path.isfile(cltTemplatePath): if not os.path.isfile(cltTemplatePath):
self.printERROR(_("'%s' is not file")%cltTemplatePath) self.printERROR(_("'%s' is not a file")%cltTemplatePath)
return False return False
clTempl = templateClt(self.clVars) clTempl = templateClt(self.clVars)
if not cltTemplatePath.endswith(clTempl.extFileTemplate): if not cltTemplatePath.endswith(clTempl.extFileTemplate):
@ -135,7 +135,7 @@ subdirectories %s")%', '.join(dirsTemplates))
def applyAllTemplates(self, location="all", package=None): def applyAllTemplates(self, location="all", package=None):
"""Обновление конфигурационных файлов""" """Обновление конфигурационных файлов"""
if not "calculate-install" in self.installProgs: if not "calculate-install" in self.installProgs:
self.printERROR(_("Can not installed %s") self.printERROR(_("Failed to install %s")
%"calculate-install") %"calculate-install")
self.printWARNING(\ self.printWARNING(\
_("To install the program, run 'cl-install --install'")) _("To install the program, run 'cl-install --install'"))

@ -24,13 +24,13 @@ from cl_utils import listDirectory,pathJoin
from os import path from os import path
lang().setLanguage(sys.modules[__name__]) lang().setLanguage(sys.modules[__name__])
USAGE = _("%prog [options] path_clt_file") USAGE = _("%prog [options] path_to_clt_file")
COMMENT_EXAMPLES = _("Apply all of the templates for all packages") COMMENT_EXAMPLES = _("Apply all templates to all packages")
EXAMPLES = _("%prog --locate all") EXAMPLES = _("%prog --locate all")
DESCRIPTION = _("The Calculate Linux utility to use templates") DESCRIPTION = _("Calculate Linux templates utility")
CMD_OPTIONS = [{'shortOption':"l", CMD_OPTIONS = [{'shortOption':"l",
'longOption':"locate", 'longOption':"locate",
@ -41,11 +41,11 @@ CMD_OPTIONS = [{'shortOption':"l",
'all','clt','local','remote'")}, 'all','clt','local','remote'")},
{'longOption':'merge', {'longOption':'merge',
'optVal':"PACKAGE", 'optVal':"PACKAGE",
'help':_("apply templates for specified package only") 'help':_("apply templates to specified package only")
}, },
{'longOption':"clt", {'longOption':"clt",
'optVal':"CLT_TEMPLATE", 'optVal':"CLT_TEMPLATE",
'help':_("process clt template (default)") 'help':_("process the clt template (by default)")
}] }]
class apply_template_cmd(share_cmd): class apply_template_cmd(share_cmd):
@ -94,7 +94,7 @@ class apply_template_cmd(share_cmd):
if len(args) == 0: if len(args) == 0:
if not optObj.clt and not optObj.l: if not optObj.clt and not optObj.l:
errMsg = _("required option")+": --clt "+_("or")+" --locate" errMsg = _("option required")+": --clt "+_("or")+" --locate"
self.optobj.error(errMsg) self.optobj.error(errMsg)
return False return False
elif len(args) == 1: elif len(args) == 1:
@ -109,7 +109,7 @@ class apply_template_cmd(share_cmd):
self.optobj.error(errMsg) self.optobj.error(errMsg)
return False return False
else: else:
errMsg = _("incorrect arguments") + ":" + " %s" %" ".join(args) errMsg = _("incorrect argument") + ":" + " %s" %" ".join(args)
self.optobj.error(errMsg) self.optobj.error(errMsg)
return False return False
self.optobj.checkVarSyntax(optObj) self.optobj.checkVarSyntax(optObj)

@ -277,7 +277,7 @@ class DistributiveRepository:
else: else:
return DirectoryDistributive(filename) return DirectoryDistributive(filename)
else: else:
raise DistributiveError(_("Wrong distributive") + " '%s':\n%s"\ raise DistributiveError(_("Wrong distribution") + " '%s':\n%s"\
%(filename,ftype)) %(filename,ftype))
def extcomparator(self,*exts): def extcomparator(self,*exts):
@ -354,7 +354,7 @@ class DistributiveRepository:
class Distributive(object, SignalInterrupt): class Distributive(object, SignalInterrupt):
"""Distributive object. Parent object for all distributive.""" """Distributive object. Parent object for all distributive."""
mountError = _("Cann't mount") + " %s:\n%s" mountError = _("Failed to mount") + " %s:\n%s"
reLive = re.compile(r"^live[^.]*\.squashfs(\.(\d+))?$",re.S) reLive = re.compile(r"^live[^.]*\.squashfs(\.(\d+))?$",re.S)
flagSpinner=True flagSpinner=True
@ -418,7 +418,7 @@ class Distributive(object, SignalInterrupt):
def convertToDirectory(self): def convertToDirectory(self):
"""Default c raise error about impossible convert object""" """Default c raise error about impossible convert object"""
raise DistributiveError(_("Cann't convert") + " '%s' "\ raise DistributiveError(_("Failed to convert") + " '%s' "\
%self.__class__.__name__ + _("to") +\ %self.__class__.__name__ + _("to") +\
" '%s'" %"DirectoryDistributive") " '%s'" %"DirectoryDistributive")
@ -454,41 +454,41 @@ class Distributive(object, SignalInterrupt):
os.mkdir(pathname) os.mkdir(pathname)
return True return True
except Exception, e: except Exception, e:
raise DistributiveError(_("Cann't create directory") +" '%s':\n%s" raise DistributiveError(_("Failed to create the directory") +
%(pathname,str(e))) " '%s':\n%s" %(pathname,str(e)))
except KeyboardInterrupt, e: except KeyboardInterrupt, e:
self.setSignalInterrupt() self.setSignalInterrupt()
raise DistributiveError(_("Cann't create directory") +" '%s':\n%s" raise DistributiveError(_("Failed to create the directory") +
%(pathname,str(e))) " '%s':\n%s" %(pathname,str(e)))
def _removeDirectory(self,directory): def _removeDirectory(self,directory):
"""Remove directory and files contained in it""" """Remove directory and files contained in it"""
try: try:
removeDir(directory) removeDir(directory)
except Exception, e: except Exception, e:
raise DistributiveError(_("Unable remove directory from") +\ raise DistributiveError(_("Failed to remove the directory from") +\
" '%s':\n%s" %(directory,str(e))) " '%s':\n%s" %(directory,str(e)))
except KeyboardInterrupt, e: except KeyboardInterrupt, e:
self.setSignalInterrupt() self.setSignalInterrupt()
raise DistributiveError(_("Unable remove directory from") +\ raise DistributiveError(_("Failed to remove the directory from") +\
" '%s':\n%s" %(directory,str(e))) " '%s':\n%s" %(directory,str(e)))
def _copyfile(self,infile,outfile): def _copyfile(self,infile,outfile):
try: try:
copyfile(infile,outfile) copyfile(infile,outfile)
except (Exception),e: except (Exception),e:
raise DistributiveError(_("Cann't copy") + " '%s' to '%s':\n%s"\ raise DistributiveError(_("Failed to copy") + " '%s' to '%s':\n%s"\
%(infile,outfile,str(e))) %(infile,outfile,str(e)))
def _copytree(self,indir,outdir): def _copytree(self,indir,outdir):
try: try:
copytree(indir,outdir,symlinks=True) copytree(indir,outdir,symlinks=True)
except Exception ,e: except Exception ,e:
raise DistributiveError(_("Cann't copy") + " '%s' to '%s':\n%s"\ raise DistributiveError(_("Failed to copy") + " '%s' to '%s':\n%s"\
%(indir,outdir,str(e))) %(indir,outdir,str(e)))
except KeyboardInterrupt, e: except KeyboardInterrupt, e:
self.setSignalInterrupt() self.setSignalInterrupt()
raise DistributiveError(_("Cann't copy") + " '%s' to '%s':\n%s"\ raise DistributiveError(_("Failed to copy") + " '%s' to '%s':\n%s"\
%(indir,outdir,str(e))) %(indir,outdir,str(e)))
def rsync(self,fromdir,todir,hideSpin=False): def rsync(self,fromdir,todir,hideSpin=False):
@ -505,7 +505,7 @@ class Distributive(object, SignalInterrupt):
spin.start() spin.start()
rsyncCmd = varsShare().getProgPath('/usr/bin/rsync') rsyncCmd = varsShare().getProgPath('/usr/bin/rsync')
if not rsyncCmd: if not rsyncCmd:
raise DistributiveError(_("Can not find '%s' command")%"rsync") raise DistributiveError(_("Failed to find '%s' command")%"rsync")
try: try:
rsyncProcess = process(rsyncCmd, "-a", "-x", rsyncProcess = process(rsyncCmd, "-a", "-x",
"%s/"%fromdir,"%s/"%todir,stderr=STDOUT) "%s/"%fromdir,"%s/"%todir,stderr=STDOUT)
@ -527,7 +527,7 @@ class Distributive(object, SignalInterrupt):
else: else:
if "No space left on device" in errmes: if "No space left on device" in errmes:
errmes = "No space left on device" errmes = "No space left on device"
raise DistributiveError(_("Cann't copy files from") +\ raise DistributiveError(_("Failed to copy files from") +\
" '%s' " %fromdir + _("to") +\ " '%s' " %fromdir + _("to") +\
" '%s':\n%s" %(todir,errmes)) " '%s':\n%s" %(todir,errmes))
@ -575,7 +575,7 @@ class Distributive(object, SignalInterrupt):
"""Mount squashfs to directory""" """Mount squashfs to directory"""
NO_SUCH_DEVICE = 2816 NO_SUCH_DEVICE = 2816
if isMount(directory): if isMount(directory):
raise DistributiveError(_("Cann't mount to directory: %s\n")\ raise DistributiveError(_("Failed to mount to the directory: %s\n")\
%directory+ _("Directory already mounted")) %directory+ _("Directory already mounted"))
mountopts = filter(lambda x:x, mountopts = filter(lambda x:x,
mountopts.split(" ")) mountopts.split(" "))
@ -584,7 +584,7 @@ class Distributive(object, SignalInterrupt):
if mountProcess.success(): if mountProcess.success():
return True return True
else: else:
# 2816 code return by mount if device is absent (update /dev by udev) #2816 code return by mount if device is absent (update /dev by udev)
# try mount 3 times with interval 0.5 second # try mount 3 times with interval 0.5 second
if mountProcess.returncode() == NO_SUCH_DEVICE and count: if mountProcess.returncode() == NO_SUCH_DEVICE and count:
sleep(0.5) sleep(0.5)
@ -604,7 +604,7 @@ class Distributive(object, SignalInterrupt):
processUmount = process('/bin/umount',directory,stderr=STDOUT) processUmount = process('/bin/umount',directory,stderr=STDOUT)
if processUmount.success(): if processUmount.success():
return True return True
raise DistributiveError(_("Cann't umount") + " %s:\n%s"% raise DistributiveError(_("Failed to umount") + " %s:\n%s"%
(directory,processUmount.read())) (directory,processUmount.read()))
else: else:
return True return True
@ -657,8 +657,8 @@ class DirectoryDistributive(Distributive):
if res == 0: if res == 0:
return True return True
else: else:
raise DistributiveError(_("Cann't format partition") + " %s:\n%s"% raise DistributiveError(_("Failed to format the partition") +
(dev,errmes)) " %s:\n%s"%(dev,errmes))
self._makeDirectory(self.directory) self._makeDirectory(self.directory)
def installFrom(self, source): def installFrom(self, source):
@ -699,12 +699,13 @@ class MultiPartitions:
if set(argv.keys()) != set(dictDataPart.keys()): if set(argv.keys()) != set(dictDataPart.keys()):
notFoundAttr = set(dictDataPart.keys()) - set(argv.keys()) notFoundAttr = set(dictDataPart.keys()) - set(argv.keys())
if notFoundAttr: if notFoundAttr:
raise DistributiveError(_("Were not specified attributes (%s)")\ raise DistributiveError(_("The following attributes "
%", ".join(map(lambda x:"DataPartition.%s"%x, notFoundAttr))) "(%s) are not specified")\
%", ".join(map(lambda x:"DataPartition.%s"%x, notFoundAttr)))
unnecessaryAttr = (set(dictDataPart.keys()) ^ set(argv.keys())) -\ unnecessaryAttr = (set(dictDataPart.keys()) ^ set(argv.keys())) -\
set(dictDataPart.keys()) set(dictDataPart.keys())
if unnecessaryAttr: if unnecessaryAttr:
raise DistributiveError(_("Not used attributes (%s)")\ raise DistributiveError(_("Failed to use attributes (%s)")\
%", ".join(map(lambda x:"DataPartition.%s"%x, unnecessaryAttr))) %", ".join(map(lambda x:"DataPartition.%s"%x, unnecessaryAttr)))
else: else:
partObj = DataPartition() partObj = DataPartition()
@ -935,19 +936,19 @@ class PartitionDistributive(Distributive):
"""Format partition""" """Format partition"""
if not format in self.formatUtilities: if not format in self.formatUtilities:
raise DistributiveError( raise DistributiveError(
_("Specified '%s' format is not supported")%format) _("Specified format of '%s' not supported")%format)
if dev in map(lambda y: y.split(" ")[0], if dev in map(lambda y: y.split(" ")[0],
filter(lambda x: x.startswith("/"), filter(lambda x: x.startswith("/"),
open("/proc/swaps"))): open("/proc/swaps"))):
raise DistributiveError(\ raise DistributiveError(\
_("Cann't format partition %s, because it is used as swap")% _("Failed to format partition %s, because it is used as swap")%
dev) dev)
if isMount(dev): if isMount(dev):
raise DistributiveError( raise DistributiveError(
_("Cann't format partition %s, because it is mounted")%dev) _("Failed to format partition %s, because it is mounted")%dev)
if not os.access(dev,os.W_OK): if not os.access(dev,os.W_OK):
raise DistributiveError(_("Cann't format partition") + " %s:\n%s"% raise DistributiveError(_("Failed to format the partition") +
(dev,_("Permission denied"))) " %s:\n%s"%(dev,_("Permission denied")))
if label: if label:
labelStr = self.labelForUtilities.get(format,"") labelStr = self.labelForUtilities.get(format,"")
if labelStr: if labelStr:
@ -959,8 +960,8 @@ class PartitionDistributive(Distributive):
if res == 0: if res == 0:
return True return True
else: else:
raise DistributiveError(_("Cann't format partition") + " %s:\n%s"% raise DistributiveError(_("Failed to format the partition") +
(dev,errmes)) " %s:\n%s"%(dev,errmes))
def performFormat(self): def performFormat(self):
"""Perform format for all partition of this distributive""" """Perform format for all partition of this distributive"""
@ -975,16 +976,17 @@ class PartitionDistributive(Distributive):
deviceName = detectDeviceForPartition(dev) deviceName = detectDeviceForPartition(dev)
if deviceName is None: if deviceName is None:
raise DistributiveError( raise DistributiveError(
_("Can not determine parent device for %s")%dev) _("Failed to determine the parent device for %s")%dev)
# device hasn't any partition # device hasn't any partition
elif deviceName == "": elif deviceName == "":
return True return True
fdiskProg, gdiskProg = checkUtils('/sbin/fdisk','/usr/sbin/gdisk') fdiskProg, gdiskProg = checkUtils('/sbin/fdisk','/usr/sbin/gdisk')
partitionNumber = getUdevDeviceInfo(name=dev).get('ID_PART_ENTRY_NUMBER','') partitionNumber = \
getUdevDeviceInfo(name=dev).get('ID_PART_ENTRY_NUMBER','')
devicePartitionCount = countPartitions(deviceName) devicePartitionCount = countPartitions(deviceName)
if deviceName and not partitionNumber: if deviceName and not partitionNumber:
raise DistributiveError( raise DistributiveError(
_("Can not determine partition number for %s")%dev) _("Failed to determine the partition number for %s")%dev)
if parttable == "dos": if parttable == "dos":
fdisk = process(fdiskProg,deviceName,stderr=STDOUT) fdisk = process(fdiskProg,deviceName,stderr=STDOUT)
pipe = Popen([fdiskProg,deviceName], pipe = Popen([fdiskProg,deviceName],
@ -1012,7 +1014,7 @@ class PartitionDistributive(Distributive):
else: else:
sleep(waittime) sleep(waittime)
raise DistributiveError( raise DistributiveError(
_("Can not found partition %s after change system id")%dev) _("Failed to found partition %s after changing the system id")%dev)
def formatSwapPartition(self, dev): def formatSwapPartition(self, dev):
"""Format swap partition""" """Format swap partition"""
@ -1020,17 +1022,17 @@ class PartitionDistributive(Distributive):
filter(lambda x: x.startswith("/"), filter(lambda x: x.startswith("/"),
open("/proc/swaps"))): open("/proc/swaps"))):
raise DistributiveError(\ raise DistributiveError(\
_("Cann't 'mkswap %s', swap partition is used in the \ _("Failed to execute 'mkswap %s', the swap partition is used "
current system") %dev) "by the current system") %dev)
if isMount(dev): if isMount(dev):
raise DistributiveError( raise DistributiveError(
_("Cann't format partition %s, because it is mounted") %dev) _("Failed to format partition %s, because it is mounted") %dev)
execStr = self.formatUtilities["swap"]%dev execStr = self.formatUtilities["swap"]%dev
res,errmes = self.runOsCommand(execStr) res,errmes = self.runOsCommand(execStr)
if res == 0: if res == 0:
return True return True
else: else:
raise DistributiveError(_("Cann't execute '%s'")%execStr +\ raise DistributiveError(_("Failed to execute '%s'")%execStr +\
"\n%s" %errmes) "\n%s" %errmes)
def installFrom(self, source): def installFrom(self, source):
@ -1121,8 +1123,8 @@ class ArchiveDistributive(Distributive):
def packToArchive(self,directory,file): def packToArchive(self,directory,file):
res,errmes = self.runOsCommand("tar cf %s -C %s ."%(file,directory)) res,errmes = self.runOsCommand("tar cf %s -C %s ."%(file,directory))
if res != 0: if res != 0:
raise DistributiveError(_("Cann't create archive") + " '%s':\n%s"% raise DistributiveError(_("Failed to create the archive") +
(file,errmes)) " '%s':\n%s"%(file,errmes))
def installFrom(self, source): def installFrom(self, source):
"""Install distributive to partition from source distributive""" """Install distributive to partition from source distributive"""
@ -1170,7 +1172,7 @@ class SquashDistributive(Distributive):
def packToSquash(self,directory,file): def packToSquash(self,directory,file):
mksquashfsUtil = '/usr/bin/mksquashfs' mksquashfsUtil = '/usr/bin/mksquashfs'
if not path.exists(mksquashfsUtil): if not path.exists(mksquashfsUtil):
raise DistributiveError(_("Cann't create squash") + raise DistributiveError(_("Failed to create squash") +
" : %s"%_("command '%s' not found")%mksquashfsUtil) " : %s"%_("command '%s' not found")%mksquashfsUtil)
cmd = [mksquashfsUtil, "%s/"%directory,file, "-no-progress"] cmd = [mksquashfsUtil, "%s/"%directory,file, "-no-progress"]
if self.exclude: if self.exclude:
@ -1179,8 +1181,8 @@ class SquashDistributive(Distributive):
cmd += ["-comp",self.compress] cmd += ["-comp",self.compress]
processMkSquash = process(*cmd) processMkSquash = process(*cmd)
if processMkSquash.failed(): if processMkSquash.failed():
raise DistributiveError(_("Cann't create squashfs") + " '%s':\n%s"% raise DistributiveError(_("Failed to create squashfs") +
(file,processMkSquash.read())) " '%s':\n%s"%(file,processMkSquash.read()))
def installFrom(self, source): def installFrom(self, source):
"""Install distributive to partition from source distributive""" """Install distributive to partition from source distributive"""
@ -1243,7 +1245,7 @@ class IsoDistributive(Distributive):
fileLive = self._getLastLive(mdirectory) fileLive = self._getLastLive(mdirectory)
if not fileLive: if not fileLive:
self._umountIso(mdirectory) self._umountIso(mdirectory)
raise DistributiveError(_("Iso %s doesn't contain live image") % raise DistributiveError(_("Iso %s contains no live image") %
self.file) self.file)
return SquashDistributive(path.join(mdirectory,fileLive), return SquashDistributive(path.join(mdirectory,fileLive),
parent=self,exclude=self.exclude, parent=self,exclude=self.exclude,
@ -1269,16 +1271,16 @@ class IsoDistributive(Distributive):
if path.exists(file): if path.exists(file):
os.unlink(file) os.unlink(file)
except Exception, e: except Exception, e:
raise DistributiveError(_("Can not remove") +\ raise DistributiveError(_("Failed to remove") +\
" %s:\n%s"%(file,str(e))) " %s:\n%s"%(file,str(e)))
except KeyboardInterrupt, e: except KeyboardInterrupt, e:
self.setSignalInterrupt() self.setSignalInterrupt()
raise DistributiveError(_("Can not remove") +\ raise DistributiveError(_("Failed to remove") +\
" %s:\n%s"%(file,str(e))) " %s:\n%s"%(file,str(e)))
mkisoUtil = '/usr/bin/mkisofs' mkisoUtil = '/usr/bin/mkisofs'
if not path.exists(mkisoUtil): if not path.exists(mkisoUtil):
raise DistributiveError(_("Cann't create iso image") + raise DistributiveError(_("Failed to create the iso image") +
" : %s"%_("command '%s' not found")%mkisoUtil) " : %s"%_("command '%s' not found")%mkisoUtil)
res,errmes = self.runOsCommand( res,errmes = self.runOsCommand(
"%(progname)s %(params)s -o %(target)s %(source)s/"% "%(progname)s %(params)s -o %(target)s %(source)s/"%
@ -1291,12 +1293,12 @@ class IsoDistributive(Distributive):
if res == 0: if res == 0:
return True return True
else: else:
raise DistributiveError(_("Can not create iso image") + " %s:\n%s"% raise DistributiveError(_("Failed to create the iso image") +
(file,errmes)) " %s:\n%s"%(file,errmes))
def prepareIso(self): def prepareIso(self):
raise DistributiveError( raise DistributiveError(
_("Iso image can not be created without overriding prepareIso")) _("Iso image cannot be created without overriding prepareIso"))
def installFrom(self, source): def installFrom(self, source):
"""Install distributive to partition from source distributive""" """Install distributive to partition from source distributive"""
@ -1331,7 +1333,7 @@ class IsoDistributive(Distributive):
raise e raise e
except KeyboardInterrupt,e: except KeyboardInterrupt,e:
self.setSignalInterrupt() self.setSignalInterrupt()
raise DistributiveError(_("Keyboard interrupt")) raise DistributiveError(_("Keyboard interruption"))
def close(self): def close(self):
# close all child # close all child
@ -1351,7 +1353,7 @@ class FlashDistributive(PartitionDistributive):
self.rsync(source.getIsoContentDirectory(),distrTo.directory) self.rsync(source.getIsoContentDirectory(),distrTo.directory)
else: else:
raise DistributiveError( raise DistributiveError(
_("Installation to flash not support %s"% _("Installation to flash does not support %s"%
source.__class__.__name__)) source.__class__.__name__))
class ScratchDistributive(Distributive): class ScratchDistributive(Distributive):
@ -1364,7 +1366,7 @@ class ScratchDistributive(Distributive):
path.exists(path.join(directory,"delta")) and \ path.exists(path.join(directory,"delta")) and \
path.exists(path.join(directory,"calculate"))): path.exists(path.join(directory,"calculate"))):
raise DistributiveError( raise DistributiveError(
_("Wrong scratch distributive in '%s'")%directory) _("Wrong scratch distribution in '%s'")%directory)
def _mountLayers(self,source,target): def _mountLayers(self,source,target):
"""Mount squashfs to directory""" """Mount squashfs to directory"""
@ -1475,4 +1477,4 @@ class ScratchPartitionDistributive(PartitionDistributive):
raise e raise e
except KeyboardInterrupt,e: except KeyboardInterrupt,e:
self.setSignalInterrupt() self.setSignalInterrupt()
raise DistributiveError(_("Keyboard interrupt")) raise DistributiveError(_("Keyboard interruption"))

@ -264,7 +264,7 @@ class fillVars(object, glob_attr):
return prop.get("ID_TYPE","")=="disk" and \ return prop.get("ID_TYPE","")=="disk" and \
prop.get("DEVTYPE","")=="disk" prop.get("DEVTYPE","")=="disk"
# get usb device by '/dev/disk/by-id' (usb devices contain 'usb' in name) # get usb device by '/dev/disk/by-id'(usb devices contain 'usb' in name)
diskIdPath = '/dev/disk/by-id' diskIdPath = '/dev/disk/by-id'
if path.exists(diskIdPath): if path.exists(diskIdPath):
usbdevices = \ usbdevices = \
@ -272,7 +272,7 @@ class fillVars(object, glob_attr):
filter(lambda x: x.startswith('usb-'),listDirectory(diskIdPath))) filter(lambda x: x.startswith('usb-'),listDirectory(diskIdPath)))
else: else:
usbdevices = [] usbdevices = []
# get devices from /sys/block directories (discard mem,sr,loop and other) # get devices from /sys/block directories(discard mem,sr,loop and other)
sysBlockPath = '/sys/block' sysBlockPath = '/sys/block'
devices = map(lambda x:path.join(sysBlockPath,x), devices = map(lambda x:path.join(sysBlockPath,x),
filter(lambda x: onlyDisk(path.join(sysBlockPath,x)), filter(lambda x: onlyDisk(path.join(sysBlockPath,x)),
@ -288,7 +288,8 @@ class fillVars(object, glob_attr):
# DEVNAME - /dev/(device_name) # DEVNAME - /dev/(device_name)
device = props['DEVNAME'] device = props['DEVNAME']
device_hash[device] = {} device_hash[device] = {}
# get partition table (if PART_TABLE_TYPE absent then get by child partition) # get partition table
# (if PART_TABLE_TYPE absent then get by child partition)
device_hash[device]['table'] = props.get('ID_PART_TABLE_TYPE', device_hash[device]['table'] = props.get('ID_PART_TABLE_TYPE',
self.getTableByChild(device)) self.getTableByChild(device))
# enumerate disk for legecy grub # enumerate disk for legecy grub
@ -356,7 +357,8 @@ class fillVars(object, glob_attr):
dev_hash['table'] = props.get('ID_PART_ENTRY_SCHEME','') dev_hash['table'] = props.get('ID_PART_ENTRY_SCHEME','')
# schema device (disk-partition or disk-partition-raid and etc) # schema device (disk-partition or disk-partition-raid and etc)
dev_hash['type'] = getDeviceType(disk) dev_hash['type'] = getDeviceType(disk)
dev_hash['id'] = props.get('ID_PART_ENTRY_TYPE','').rpartition("x")[2] dev_hash['id'] = \
props.get('ID_PART_ENTRY_TYPE','').rpartition("x")[2]
dev_hash['id'] = mapTypeUUID.get(dev_hash['id'],dev_hash['id']) dev_hash['id'] = mapTypeUUID.get(dev_hash['id'],dev_hash['id'])
devParent = getPartitionDevice(disk) devParent = getPartitionDevice(disk)
dev_hash['parent'] = devParent dev_hash['parent'] = devParent
@ -372,15 +374,18 @@ class fillVars(object, glob_attr):
else: else:
dev_hash['grub'] = "" dev_hash['grub'] = ""
disk_hash[devName] = dev_hash disk_hash[devName] = dev_hash
# if device raid then get its partition and add to raid partitions list # if device raid then get its partition and
# add to raid partitions list
if "raid" in dev_hash['type']: if "raid" in dev_hash['type']:
raidUsedDisks.extend(map(lambda x:(devName,x),getRaidPartitions(disk))) raidUsedDisks.extend(map(lambda x:(devName,x),
# if device lvm then get its partition and add to lvm partitions list getRaidPartitions(disk)))
# if device lvm then get its partition and
# add to lvm partitions list
if dev_hash['type'].endswith("lvm"): if dev_hash['type'].endswith("lvm"):
prop = getUdevDeviceInfo(path=disk) prop = getUdevDeviceInfo(path=disk)
lvmUsedDisks.extend(map(lambda x:(devName,x), lvmUsedDisks.extend(map(lambda x:(devName,x),
getLvmPartitions(prop.get('DM_VG_NAME',''), getLvmPartitions(prop.get('DM_VG_NAME',''),
prop.get('DM_LV_NAME','')))) prop.get('DM_LV_NAME',''))))
# fix type information for raid disks # fix type information for raid disks
for disk,part in raidUsedDisks: for disk,part in raidUsedDisks:
if part in disk_hash: if part in disk_hash:
@ -650,7 +655,7 @@ class fillVars(object, glob_attr):
#execStr = 'route -n' #execStr = 'route -n'
#res = self._runos(execStr,env={"LANG":"C"}) #res = self._runos(execStr,env={"LANG":"C"})
#if res is False: #if res is False:
#cl_overriding.printERROR("Cann't execute '%s'"%execStr) #cl_overriding.printERROR("Failed to execute '%s'"%execStr)
#cl_overriding.exit(1) #cl_overriding.exit(1)
#flagData = False #flagData = False
## retData = {'eth0':'10.0.0.1' ...} ## retData = {'eth0':'10.0.0.1' ...}

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

@ -30,15 +30,16 @@ lang().setLanguage(sys.modules[__name__])
OSSYSTEM_LIST=sorted(varsShare.dictNameSystem.keys()) OSSYSTEM_LIST=sorted(varsShare.dictNameSystem.keys())
NM_LIST=sorted(varsShare.dictNetworkManagers.keys()) NM_LIST=sorted(varsShare.dictNetworkManagers.keys())
DESCRIPTION = _("The Calculate Linux installation and configuration utility") DESCRIPTION = _("Calculate Linux installation and configuration utility")
CMD_OPTIONS = [{'shortOption':"d", CMD_OPTIONS = [{'shortOption':"d",
'longOption':"disk", 'longOption':"disk",
'optVal':"DISK[:[DIR:FILESYSTEM:OPTIONS]]", 'optVal':"DISK[:[DIR:FILESYSTEM:OPTIONS]]",
'action':'append', 'action':'append',
'help':_("the DISK for installation, which mounted to DIR") + 'help':_("DISK for installation, will be mounted to DIR") +
". " + ". " +
_("DIR with value 'none' will cancels the mount point transfer") _("DIR set to 'none' will cancel the mount point transfer")
+ ". " +_("For creating bind mount point need specify source directory as DISK") + ". " +_("For creating bind mount point you have to specify"
" the source directory as DISK")
}, },
{'shortOption':"w", {'shortOption':"w",
'longOption':"swap", 'longOption':"swap",
@ -48,14 +49,14 @@ CMD_OPTIONS = [{'shortOption':"d",
}, },
{'longOption':"mbr", {'longOption':"mbr",
'optVal':"DEVICE", 'optVal':"DEVICE",
'help':_("boot disk for the installed system \ 'help':_("boot disk for the system bound for install "
(to be recorded MBR), off - disable MBR writing") "(for recording MBR), off - disable MBR writing")
}, },
{'longOption':"type", {'longOption':"type",
'optVal':"DISKTYPE", 'optVal':"DISKTYPE",
'type':'choice', 'type':'choice',
'choices':['flash','hdd','usb-hdd'], 'choices':['flash','hdd','usb-hdd'],
'help':_("device type for installed system") 'help':_("device type for the system bound for install")
}, },
{'longOption':'iso', {'longOption':'iso',
'optVal':"ISO", 'optVal':"ISO",
@ -65,37 +66,37 @@ CMD_OPTIONS = [{'shortOption':"d",
'optVal':"SYSTEM", 'optVal':"SYSTEM",
'type':'choice', 'type':'choice',
'choices_regignore': OSSYSTEM_LIST, 'choices_regignore': OSSYSTEM_LIST,
'help':_("select operation system") 'help':_("select the operation system")
}, },
{'longOption':"march", {'longOption':"march",
'optVal':"ARCH", 'optVal':"ARCH",
'type':'choice', 'type':'choice',
'choices':['i686','x86_64','auto'], 'choices':['i686','x86_64','auto'],
'help':_("select processor architecture")+ \ 'help':_("select the processor architecture")+ \
" (i686,x86_64 or auto)" " (i686,x86_64 or auto)"
}, },
{'longOption':"build", {'longOption':"build",
'help':_("installation for assembling") 'help':_("installation for assemble")
}, },
{'shortOption':"l", {'shortOption':"l",
'longOption':"lang", 'longOption':"lang",
'optVal':"LANG", 'optVal':"LANG",
'help':_("set language") 'help':_("set the language")
}, },
{'shortOption':"u", {'shortOption':"u",
'longOption':"user", 'longOption':"user",
'optVal':"USER", 'optVal':"USER",
'action':'append', 'action':'append',
'help':_("add user to installed system") 'help':_("add a user to the installed system")
}, },
{'shortOption':"A", {'shortOption':"A",
'longOption':"autologin", 'longOption':"autologin",
'optVal':"USER", 'optVal':"USER",
'help':_("add autologin user to installed system") 'help':_("add an autologin user to the installed system")
}, },
{'longOption':"hostname", {'longOption':"hostname",
'optVal':"HOSTNAME", 'optVal':"HOSTNAME",
'help':_("set short hostname of full hostname") 'help':_("set the short hostname of the full hostname")
}, },
{'longOption':"netconf", {'longOption':"netconf",
'optVal':"NETMANAGER", 'optVal':"NETMANAGER",
@ -106,7 +107,8 @@ CMD_OPTIONS = [{'shortOption':"d",
{'longOption':"dhcp", {'longOption':"dhcp",
'optVal':"IFACE", 'optVal':"IFACE",
'action':'append', 'action':'append',
'help':_("get ip address by %s for specified interface")%"DHCP" 'help':_("get the ip address by %s for "
"the specified interface")%"DHCP"
}, },
{'longOption':"ip", {'longOption':"ip",
'optVal':"[IFACE:]IP", 'optVal':"[IFACE:]IP",
@ -116,23 +118,23 @@ CMD_OPTIONS = [{'shortOption':"d",
{'longOption':"route", {'longOption':"route",
'optVal':"NETWORK:[GATEWAY][:DEV[:SOURCE]]", 'optVal':"NETWORK:[GATEWAY][:DEV[:SOURCE]]",
'action':'append', 'action':'append',
'help':_("add routing rule") 'help':_("add a routing rule")
}, },
{'longOption':"dns", {'longOption':"dns",
'optVal':"DNS", 'optVal':"DNS",
'help':_("domain name servers (comma delimeter)") 'help':_("domain name servers (comma-separated)")
}, },
{'longOption':"proxy", {'longOption':"proxy",
'optVal':"PROXY", 'optVal':"PROXY",
'help':_("set proxy server for system") 'help':_("set the proxy server for the system")
}, },
{'longOption':"ntp", {'longOption':"ntp",
'optVal':"NTP", 'optVal':"NTP",
'help':_("set ntp server for system") 'help':_("set the ntp server for the system")
}, },
{'longOption':"video", {'longOption':"video",
'optVal':"VIDEODRV", 'optVal':"VIDEODRV",
'help':_("set video driver") 'help':_("set the video driver")
}, },
{'shortOption':"X", {'shortOption':"X",
'optVal':"<width>x<height>", 'optVal':"<width>x<height>",
@ -144,7 +146,7 @@ CMD_OPTIONS = [{'shortOption':"d",
}, },
{'longOption':"timezone", {'longOption':"timezone",
'optVal':"TIMEZONE", 'optVal':"TIMEZONE",
'help':_("set timezone") 'help':_("set the timezone")
}, },
{'longOption':"nouuid", {'longOption':"nouuid",
'help':_("do not use UUID") 'help':_("do not use UUID")
@ -152,30 +154,30 @@ CMD_OPTIONS = [{'shortOption':"d",
{'longOption':'set'}, {'longOption':'set'},
{'shortOption':"U", {'shortOption':"U",
'longOption':"update", 'longOption':"update",
'help':_("install only newer images")}, 'help':_("install newer images only")},
{'shortOption':"f", {'shortOption':"f",
'longOption':"force", 'longOption':"force",
'help':_("no questions during the install process") 'help':_("no questions during installation")
}, },
{'longOption':"startup", {'longOption':"startup",
'help':_("configure current system") 'help':_("configuring the current system")
}, },
{'longOption':"live", {'longOption':"live",
'help':_("configure only mutable parameters, is used" 'help':_("configure only mutable parameters, "
" in conjunction with the option '--startup'") "used in conjunction with the option '--startup'")
}, },
{'longOption':"install", {'longOption':"install",
'help':_("install package") 'help':_("install the package")
}, },
{'longOption':"uninstall", {'longOption':"uninstall",
'help':_("uninstall package") 'help':_("uninstall the package")
}, },
{'longOption':"nospinner", {'longOption':"nospinner",
'help':_("disable spinner") 'help':_("disable the spinner")
}, },
{'shortOption':"P", {'shortOption':"P",
'help':_("use passwords for the users accounts \ 'help':_("use passwords for the users accounts "
(from standard input)") "(from standard input)")
}, },
{'shortOption':'p', {'shortOption':'p',
'longOption':"show-partitions", 'longOption':"show-partitions",
@ -261,7 +263,7 @@ class install_cmd(share_cmd):
if not values.startup: if not values.startup:
if values.live: if values.live:
errMsg = _("incorrect option") + ":" + " %s" %"--live" +\ errMsg = _("incorrect option") + ":" + " %s" %"--live" +\
": " + _("use with option '--startup'") ": " + _("used with option '--startup'")
self.optobj.error(errMsg) self.optobj.error(errMsg)
if values.install or values.uninstall: if values.install or values.uninstall:
self.checkIncompatibleInstallUninstall() self.checkIncompatibleInstallUninstall()
@ -270,7 +272,7 @@ class install_cmd(share_cmd):
if values.dhcp: if values.dhcp:
self.checkIncompatibleDhcp() self.checkIncompatibleDhcp()
if values.A == "root": if values.A == "root":
self.optobj.error(_("Autologin user can not be root")) self.optobj.error(_("The autologin user cannot be root"))
if not values.v: if not values.v:
if values.filter: if values.filter:
errMsg = _("incorrect option") + ":" + " %s" %"--filter" +\ errMsg = _("incorrect option") + ":" + " %s" %"--filter" +\
@ -294,7 +296,8 @@ class install_cmd(share_cmd):
value=ipaddr, value=ipaddr,
example="eth0:192.168.0.21/16")) example="eth0:192.168.0.21/16"))
if not values.dns is None: if not values.dns is None:
if not re.match("(^{0}(,{0})*|)$".format(iputils.IP_ADDR),values.dns): if not re.match("(^{0}(,{0})*|)$".format(iputils.IP_ADDR),
values.dns):
self.optobj.error(self.errorWithExample.format( self.optobj.error(self.errorWithExample.format(
optname="--dns", optname="--dns",
errormess=_("%s specifing error")%"dns", errormess=_("%s specifing error")%"dns",
@ -354,7 +357,7 @@ class install_cmd(share_cmd):
if self.logicObj.setAllLocaleByLang(lang): if self.logicObj.setAllLocaleByLang(lang):
return True return True
else: else:
self.printERROR(_("specified lang %s is unsupported")%lang) self.printERROR(_("specified language %s is unsupported")%lang)
return False return False
def setProxyNtpHostname(self,proxy,ntp,hostname): def setProxyNtpHostname(self,proxy,ntp,hostname):
@ -562,7 +565,7 @@ class install_cmd(share_cmd):
flagSpinner=flagSpinner,update=update): flagSpinner=flagSpinner,update=update):
if self.logicObj.clVars.Get('os_install_root_type') != "flash": if self.logicObj.clVars.Get('os_install_root_type') != "flash":
self.defaultPrint("\n") self.defaultPrint("\n")
self.defaultPrint(_("To apply changes you have to reboot")+ self.defaultPrint(_("To apply the changes you have to reboot")+
".\n") ".\n")
return True return True
else: else:

@ -52,13 +52,15 @@ class migrateGroups(_shareData):
def getThisData(self): def getThisData(self):
"""Get data migrate groups in this system""" """Get data migrate groups in this system"""
return filter(lambda x:\ return filter(lambda x:\
self._reNumb.match(x[2]) and self.minGid<=int(x[2])<=self.maxGid, self.getData()) self._reNumb.match(x[2]) and self.minGid<=int(x[2])<=self.maxGid,
self.getData())
def getNewData(self): def getNewData(self):
"""Get data migrate groups in new system""" """Get data migrate groups in new system"""
fileName = pathJoin(self.prefixNewSystem, self.fileGroups) fileName = pathJoin(self.prefixNewSystem, self.fileGroups)
return filter(lambda x:\ return filter(lambda x:\
self._reNumb.match(x[2]) and self.minGid<=int(x[2])<=self.maxGid, self.getData(fileName=fileName)) self._reNumb.match(x[2]) and self.minGid<=int(x[2])<=self.maxGid,
self.getData(fileName=fileName))
def getNewDataSystemGroups(self): def getNewDataSystemGroups(self):
"""Get data system groups in new system""" """Get data system groups in new system"""
@ -107,27 +109,31 @@ class migrateUsers(_shareData):
def getThisData(self): def getThisData(self):
"""Get data migrate users in this system""" """Get data migrate users in this system"""
return filter(lambda x:\ return filter(lambda x:\
self._reNumb.match(x[2]) and self.minId<=int(x[2])<=self.maxId, self.getData()) self._reNumb.match(x[2]) and self.minId<=int(x[2])<=self.maxId,
self.getData())
def getNewData(self): def getNewData(self):
"""Get data migrate users in new system""" """Get data migrate users in new system"""
fileName = pathJoin(self.prefixNewSystem, self.filePasswd) fileName = pathJoin(self.prefixNewSystem, self.filePasswd)
return filter(lambda x:\ return filter(lambda x:\
self._reNumb.match(x[2]) and self.minId<=int(x[2])<=self.maxId, self.getData(fileName=fileName)) self._reNumb.match(x[2]) and self.minId<=int(x[2])<=self.maxId,
self.getData(fileName=fileName))
def getNewDataSystemUsers(self): def getNewDataSystemUsers(self):
"""Get data system users in new system""" """Get data system users in new system"""
fileName = pathJoin(self.prefixNewSystem, self.filePasswd) fileName = pathJoin(self.prefixNewSystem, self.filePasswd)
return filter(lambda x:\ return filter(lambda x:\
self._reNumb.match(x[2]) and\ self._reNumb.match(x[2]) and\
(int(x[2]>self.maxId) or int(x[2])<self.minId), self.getData(fileName=fileName)) (int(x[2]>self.maxId) or int(x[2])<self.minId),
self.getData(fileName=fileName))
def getThisDataSystemUsers(self): def getThisDataSystemUsers(self):
"""Get data system users in this system""" """Get data system users in this system"""
fileName = self.filePasswd fileName = self.filePasswd
return filter(lambda x:\ return filter(lambda x:\
self._reNumb.match(x[2]) and\ self._reNumb.match(x[2]) and\
(int(x[2]>self.maxId) or int(x[2])<self.minId), self.getData(fileName=fileName)) (int(x[2]>self.maxId) or int(x[2])<self.minId),
self.getData(fileName=fileName))
def getNewProcessedData(self, migrateUsers=[]): def getNewProcessedData(self, migrateUsers=[]):
"""Get processed data migrate users in new system""" """Get processed data migrate users in new system"""
@ -326,7 +332,7 @@ class migrate(color_print):
def changePassword(self, userName, pwdHash, maxDays="99999", warnDays="7"): def changePassword(self, userName, pwdHash, maxDays="99999", warnDays="7"):
if not filter(lambda x: x[0]==userName, self.dataUsers): if not filter(lambda x: x[0]==userName, self.dataUsers):
self.printERROR(_("Not found user %s")%userName) self.printERROR(_("User %s not found")%userName)
return False return False
indexFoundUser = False indexFoundUser = False
for i, data in enumerate(self.dataShadow): for i, data in enumerate(self.dataShadow):
@ -391,12 +397,12 @@ class migrate(color_print):
notWrite = lambda x: not os.access(x, os.W_OK) notWrite = lambda x: not os.access(x, os.W_OK)
filesNotRead = filter(notRead,checkThisFiles) filesNotRead = filter(notRead,checkThisFiles)
if filesNotRead: if filesNotRead:
self.printERROR(_("Can not read files") + ": " +\ self.printERROR(_("Failed to read files") + ": " +\
", ".join(filesNotRead)) ", ".join(filesNotRead))
return False return False
filesNotWrite = filter(notWrite,checkNewFiles) filesNotWrite = filter(notWrite,checkNewFiles)
if filesNotWrite: if filesNotWrite:
self.printERROR(_("Can not write to files") + ": " +\ self.printERROR(_("Failed to write to files") + ": " +\
", ".join(filesNotWrite)) ", ".join(filesNotWrite))
return False return False
# Check permissions backup files # Check permissions backup files
@ -407,7 +413,7 @@ class migrate(color_print):
not os.access(os.path.dirname(x), os.W_OK)) not os.access(os.path.dirname(x), os.W_OK))
filesNotWrite = filter(notWriteBackup, checkNewBackupFiles) filesNotWrite = filter(notWriteBackup, checkNewBackupFiles)
if filesNotWrite: if filesNotWrite:
self.printERROR(_("Can not write to files") + ": " +\ self.printERROR(_("Failed to write to files") + ": " +\
", ".join(filesNotWrite)) ", ".join(filesNotWrite))
return False return False
return True return True
@ -456,7 +462,8 @@ class migrate(color_print):
try: try:
map(createHome,filter(lambda x:x[0] in users, self.dataUsers)) map(createHome,filter(lambda x:x[0] in users, self.dataUsers))
except Exception,e: except Exception,e:
raise DistributiveError(_("Cann't create user home directory")) raise DistributiveError(
_("Failed to create the user's home directory"))
def migrate(self, addUsersList=[], pwdUsersList=[], existsMigrateUsers=[]): def migrate(self, addUsersList=[], pwdUsersList=[], existsMigrateUsers=[]):
"""Migrate users ang groups to new system""" """Migrate users ang groups to new system"""

@ -81,7 +81,7 @@ class share_cmd(color_print, _error):
errMsg = self.getError() errMsg = self.getError()
if errMsg: if errMsg:
self.printERROR(errMsg.strip()) self.printERROR(errMsg.strip())
self.printERROR(_('Can not write template variables')) self.printERROR(_("Failed to write template variables"))
return False return False
return True return True

Loading…
Cancel
Save