Add check for run command cl-image.

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

@ -22,7 +22,7 @@ import re
import sys import sys
import traceback import traceback
from os import path 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 subprocess import STDOUT,PIPE
from cl_print import color_print from cl_print import color_print
from cl_datavars import DataVars from cl_datavars import DataVars
@ -264,8 +264,11 @@ class cl_builder(color_print):
if path.realpath(self.clVars.Get('cl_builder_path')) == "/": if path.realpath(self.clVars.Get('cl_builder_path')) == "/":
self.printERROR(_("Source system should not be '/'")) self.printERROR(_("Source system should not be '/'"))
return False return False
if self.clVars.Get('os_builder_linux_ver') == "0": minver = "10.8"
self.printERROR(_("Can not found distributive version")) 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 return False
elif not self.clVars.Get('os_builder_linux_shortname') in \ elif not self.clVars.Get('os_builder_linux_shortname') in \
varsShare.dictNameSystem.keys(): varsShare.dictNameSystem.keys():

@ -94,6 +94,7 @@ class image_cmd(share_cmd):
return True return True
def createImagePaths(self): def createImagePaths(self):
"""Create path, which contains images"""
imagepath = self.logicObj.clVars.Get('cl_builder_image_path') imagepath = self.logicObj.clVars.Get('cl_builder_image_path')
if type(imagepath) != ListType: if type(imagepath) != ListType:
imagepath = [imagepath] imagepath = [imagepath]
@ -103,3 +104,10 @@ class image_cmd(share_cmd):
os.makedirs(pathname,mode=0755) os.makedirs(pathname,mode=0755)
except: except:
pass 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 options, args = ret
# set color/nocolor for display messages # set color/nocolor for display messages
image.setPrintNoColor(options) image.setPrintNoColor(options)
# check chroot status
if not image.checkChrootStatus():
sys.exit(1)
# set values to variables # set values to variables
if not image.setVars(options): if not image.setVars(options):
sys.exit(1) sys.exit(1)

Loading…
Cancel
Save