Add new option of --run_script
[tools/mic.git] / plugins / imager / raw_plugin.py
index 09a9714..554eac7 100755 (executable)
@@ -16,6 +16,7 @@
 # Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 import os
+import subprocess
 import shutil
 import re
 import tempfile
@@ -113,6 +114,17 @@ class RawPlugin(ImagerPlugin):
         finally:
             creator.cleanup()
 
+        #Run script of --run_script after image created
+        if creatoropts['run_script']:
+            cmd = creatoropts['run_script']
+            msger.info("Running command in parameter run_script: "+"".join(cmd))
+            try:
+                p = subprocess.Popen(cmd, stdout=subprocess.PIPE,stderr=subprocess.STDOUT)
+                p.communicate()
+            except OSError,err:
+                msger.warning(str(err))
+
+
         msger.info("Finished.")
         return 0