From: Olaf Hering Subject: [PATCH 06/46] tools/pygrub: store kernels in /var/run/xen/pygrub Date: Mon, 22 Sep 2014 14:59:55 +0200 Message-ID: <1411390835-7348-7-git-send-email-olaf@aepfle.de> References: <1411390835-7348-1-git-send-email-olaf@aepfle.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1411390835-7348-1-git-send-email-olaf@aepfle.de> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: Olaf Hering , Keir Fraser , David Scott , Stefano Stabellini , George Dunlap , Tim Deegan , Ian Jackson , Jan Beulich , Samuel Thibault , Ian Campbell List-Id: xen-devel@lists.xenproject.org Move location of temporary bootfiles from /var/run/xend/boot to /var/run/xen/pygrub. Create the subdirectory if does not exist. The 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 Acked-by: Ian Campbell --- tools/pygrub/src/pygrub | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/pygrub/src/pygrub b/tools/pygrub/src/pygrub index 2618e11..e73a174 100644 --- a/tools/pygrub/src/pygrub +++ b/tools/pygrub/src/pygrub @@ -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: