summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xmic/imager/baseimager.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/mic/imager/baseimager.py b/mic/imager/baseimager.py
index 257af8e..d9bc2cf 100755
--- a/mic/imager/baseimager.py
+++ b/mic/imager/baseimager.py
@@ -1210,6 +1210,9 @@ class BaseImageCreator(object):
dir = self._instroot + "/tmp")
s.script = s.script.replace("\r", "")
os.write(fd, s.script)
+ if s.interp == '/bin/sh' or s.interp == '/bin/bash':
+ os.write(fd, '\n')
+ os.write(fd, 'exit 0\n')
os.close(fd)
os.chmod(path, 0700)
for item in os.listdir(self._imgdir):
@@ -1226,6 +1229,9 @@ class BaseImageCreator(object):
stderr = subprocess.STDOUT)
while p.poll() == None:
msger.info(p.stdout.readline().strip())
+ if p.returncode != 0:
+ raise CreatorError("Failed to execute %%sign script "
+ "with '%s'" % (s.interp))
except OSError, (err, msg):
raise CreatorError("Failed to execute %%sign script "
"with '%s' : %s" % (s.interp, msg))
@@ -1246,6 +1252,9 @@ class BaseImageCreator(object):
s.script = s.script.replace("\r", "")
os.write(fd, s.script)
+ if s.interp == '/bin/sh' or s.interp == '/bin/bash':
+ os.write(fd, '\n')
+ os.write(fd, 'exit 0\n')
os.close(fd)
os.chmod(path, 0700)
@@ -1273,6 +1282,9 @@ class BaseImageCreator(object):
end_time = time.time()
if (end_time - start_time)/60 > MAX_RUN_TIME:
raise CreatorError("Your post script is executed more than "+MAX_RUN_TIME+"mins, please check it!")
+ if p.returncode != 0:
+ raise CreatorError("Failed to execute %%post script "
+ "with '%s'" % (s.interp))
except OSError, (err, msg):
raise CreatorError("Failed to execute %%post script "
"with '%s' : %s" % (s.interp, msg))