Add check for run command cl-image.

Add block execute from chroot mode and denied build system with
version less 10.8.
master
Mike Hiretsky 14 years ago
parent db4de25a12
commit 5394dd3af3

@ -22,7 +22,7 @@ import re
import sys
import traceback
from os import path
from cl_utils import process,pathJoin,getRunCommands
from cl_utils import process,pathJoin,getRunCommands,getTupleVersion
from subprocess import STDOUT,PIPE
from cl_print import color_print
from cl_datavars import DataVars
@ -264,8 +264,11 @@ class cl_builder(color_print):
if path.realpath(self.clVars.Get('cl_builder_path')) == "/":
self.printERROR(_("Source system should not be '/'"))
return False
if self.clVars.Get('os_builder_linux_ver') == "0":
self.printERROR(_("Can not found distributive version"))
minver = "10.8"
if getTupleVersion(self.clVars.Get('os_builder_linux_ver')) < \
getTupleVersion(minver):
self.printERROR(_("Command is supported for system not less version"
" %s") % minver )
return False
elif not self.clVars.Get('os_builder_linux_shortname') in \
varsShare.dictNameSystem.keys():

@ -94,6 +94,7 @@ class image_cmd(share_cmd):
return True
def createImagePaths(self):
"""Create path, which contains images"""
imagepath = self.logicObj.clVars.Get('cl_builder_image_path')
if type(imagepath) != ListType:
imagepath = [imagepath]
@ -103,3 +104,10 @@ class image_cmd(share_cmd):
os.makedirs(pathname,mode=0755)
except:
pass
def checkChrootStatus(self):
if self.logicObj.clVars.Get('cl_chroot_status') == 'off':
return True
else:
self.printERROR(_("This program can't be run from Scratch layer"))
return False

@ -39,6 +39,9 @@ if __name__ == "__main__":
options, args = ret
# set color/nocolor for display messages
image.setPrintNoColor(options)
# check chroot status
if not image.checkChrootStatus():
sys.exit(1)
# set values to variables
if not image.setVars(options):
sys.exit(1)

Loading…
Cancel
Save