@ -15,6 +15,7 @@
# limitations under the License.
import os
import sys
import re
from crypt import crypt
import cl_overriding
@ -29,6 +30,11 @@ from cl_template import _terms
from subprocess import PIPE , Popen
from cl_install import convertDictOpt
from cl_lang import lang
tr = lang ( )
tr . setLocalDomain ( ' cl_install ' )
tr . setLanguage ( sys . modules [ __name__ ] )
class fillVars ( object , glob_attr ) :
nonTransferedDirs = [ " / " , " /bin " , " /dev " , " /etc " ,
" /lib " , " /lib32 " , " /lib64 " ,
@ -134,10 +140,15 @@ class fillVars(object, glob_attr):
curDevice = None
# getting id
execStr = ' /sbin/fdisk -l '
execProg = ' /sbin/fdisk '
execStr = ' %s -l ' % execProg
if not path . exists ( execProg ) :
cl_overriding . printERROR ( _ ( " Command not found ' %s ' " ) % execProg )
cl_overriding . exit ( 1 )
execStr = ' %s -l ' % execProg
res = self . _runos ( execStr , env = { " LANG " : " C " } )
if res is False :
cl_overriding . printERROR ( " Cann ' t execute ' %s ' " % execStr )
cl_overriding . printERROR ( _ ( " Cann ' t execute ' %s ' " ) % execStr )
cl_overriding . exit ( 1 )
partedLines = filter ( lambda x : x . startswith ( ' /dev/ ' ) , res or [ ] )
partedMatrix = map ( lambda x : filter ( lambda y : y and y != " * " ,
@ -149,10 +160,14 @@ class fillVars(object, glob_attr):
disk_hash [ part ] [ ' id ' ] = sysid
# parse all parted lines started with Disk and started with number
execStr = ' /usr/sbin/parted -l '
execProg = ' /usr/sbin/parted '
execStr = ' %s -l ' % execProg
if not path . exists ( execProg ) :
cl_overriding . printERROR ( _ ( " Command not found ' %s ' " ) % execProg )
cl_overriding . exit ( 1 )
res = self . _runos ( execStr , env = { " LANG " : " C " } )
if res is False :
cl_overriding . printERROR ( " Cann ' t execute ' %s ' " % execStr )
cl_overriding . printERROR ( _ ( " Cann ' t execute ' %s ' " ) % execStr )
cl_overriding . exit ( 1 )
partedLines = filter ( lambda x : x . startswith ( " Disk " ) or
x . strip ( ) [ : 1 ] . isdigit ( ) , res )
@ -174,9 +189,12 @@ class fillVars(object, glob_attr):
disk_hash [ partition ] [ ' size ' ] = parts [ 3 ]
# fill format, name and uuid
execStr = ' /sbin/blkid '
if not path . exists ( execStr ) :
cl_overriding . printERROR ( _ ( " Command not found ' %s ' " ) % execStr )
cl_overriding . exit ( 1 )
res = self . _runos ( execStr )
if res is False :
cl_overriding . printERROR ( " Cann ' t execute ' %s ' " % execStr )
cl_overriding . printERROR ( _ ( " Cann ' t execute ' %s ' " ) % execStr )
cl_overriding . exit ( 1 )
# map attribute name of blkid to disk_hash
blkid_hash = { ' LABEL ' : ' name ' ,