From d89de1ad200f945e6387cf3b82ee5e98ac410f6b Mon Sep 17 00:00:00 2001 From: Mike Hiretsky Date: Wed, 29 Sep 2010 18:54:37 +0000 Subject: [PATCH] Add check scratch mode for performing cl-image --- pym/cl_image_cmd.py | 8 ++++++++ scripts/cl-image | 2 ++ 2 files changed, 10 insertions(+) diff --git a/pym/cl_image_cmd.py b/pym/cl_image_cmd.py index a73c3e7..1a30760 100644 --- a/pym/cl_image_cmd.py +++ b/pym/cl_image_cmd.py @@ -49,6 +49,14 @@ class image_cmd(share_cmd): # "k", "e","dmraid","c","ebuild", # "symlink"] + def isScratch(self): + """Detect scartch system""" + if self.logicObj.clVars.Get('os_scratch') == 'on': + return True + else: + self.printERROR(_("You should load system in the builder mode.")) + return False + def checkOpts(self, values, args): """Check values all specified options.""" if len(args) > 1: diff --git a/scripts/cl-image b/scripts/cl-image index 9310ecf..716fe16 100644 --- a/scripts/cl-image +++ b/scripts/cl-image @@ -49,6 +49,8 @@ if __name__ == "__main__": # check root if not image.isRoot(): sys.exit(1) + if not image.isScratch(): + sys.exit(1) if not image.performActionByCommand(options,args): sys.exit(1) sys.exit(0)