tools/pygrub: store kernels in /var/run/xen/pygrub
authorOlaf Hering <olaf@aepfle.de>
Mon, 22 Sep 2014 12:59:55 +0000 (14:59 +0200)
committerIan Campbell <ian.campbell@citrix.com>
Tue, 23 Sep 2014 09:13:45 +0000 (10:13 +0100)
Move location of temporary bootfiles from /var/run/xend/boot to
/var/run/xen/pygrub. Create the subdirectory if does not exist.
The <dir> argument --output-directory must be an existing directory.

The reason for this change is that all entrys below /var/run have to be
created at runtime in case /var/run is cleared on every boot.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
tools/pygrub/src/pygrub

index 2618e11b965bd66f2670e67c13e95a25011f45ac..e73a17487f4f471239c7f94b3a2383534013cf6e 100644 (file)
@@ -778,7 +778,7 @@ if __name__ == "__main__":
     debug = False
     not_really = False
     output_format = "sxp"
-    output_directory = "/var/run/xend/boot"
+    output_directory = "/var/run/xen/pygrub"
 
     # what was passed in
     incfg = { "kernel": None, "ramdisk": None, "args": "" }
@@ -829,11 +829,17 @@ if __name__ == "__main__":
                 sys.exit(1)
             output_format = a
         elif o in ("--output-directory",):
+            if not os.path.isdir(a):
+                print "%s is not an existing directory" % a
+                sys.exit(1)
             output_directory = a
 
     if debug:
        logging.basicConfig(level=logging.DEBUG)
 
+    if not os.path.isdir(output_directory):
+        os.mkdir(output_directory, 0700)
+
     if output is None or output == "-":
         fd = sys.stdout.fileno()
     else: