aboutsummaryrefslogtreecommitdiffstats
path: root/tools/pygrub
diff options
context:
space:
mode:
authorIan Jackson <Ian.Jackson@eu.citrix.com>2010-07-02 17:57:53 +0100
committerIan Jackson <Ian.Jackson@eu.citrix.com>2010-07-02 17:57:53 +0100
commitc55f511297e804637d41ed176ac3f6cc7e6cc472 (patch)
treebd89bbba46fefc68d94a5e8b979e0f60e5d65c0d /tools/pygrub
parent79b518480a830fe29a3814a8dd7c9129ff8cd03f (diff)
downloadxen-c55f511297e804637d41ed176ac3f6cc7e6cc472.tar.gz
xen-c55f511297e804637d41ed176ac3f6cc7e6cc472.tar.bz2
xen-c55f511297e804637d41ed176ac3f6cc7e6cc472.zip
tools/pygrub: --not-really option for debugging
Add a --not-really option to pygrub that lets us see what files it would have extracted instead of actually extracting them. Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Diffstat (limited to 'tools/pygrub')
-rw-r--r--tools/pygrub/src/pygrub39
1 files changed, 24 insertions, 15 deletions
diff --git a/tools/pygrub/src/pygrub b/tools/pygrub/src/pygrub
index 9c99ba8ce6..0c1619da5e 100644
--- a/tools/pygrub/src/pygrub
+++ b/tools/pygrub/src/pygrub
@@ -634,13 +634,13 @@ if __name__ == "__main__":
sel = None
def usage():
- print >> sys.stderr, "Usage: %s [-q|--quiet] [-i|--interactive] [--output=] [--kernel=] [--ramdisk=] [--args=] [--entry=] <image>" %(sys.argv[0],)
+ print >> sys.stderr, "Usage: %s [-q|--quiet] [-i|--interactive] [-n|--not-really] [--output=] [--kernel=] [--ramdisk=] [--args=] [--entry=] <image>" %(sys.argv[0],)
try:
- opts, args = getopt.gnu_getopt(sys.argv[1:], 'qih::',
- ["quiet", "interactive", "help", "output=",
- "entry=", "kernel=", "ramdisk=", "args=",
- "isconfig"])
+ opts, args = getopt.gnu_getopt(sys.argv[1:], 'qinh::',
+ ["quiet", "interactive", "not-really",
+ "help", "output=", "entry=", "kernel=",
+ "ramdisk=", "args=", "isconfig"])
except getopt.GetoptError:
usage()
sys.exit(1)
@@ -654,6 +654,7 @@ if __name__ == "__main__":
entry = None
interactive = True
isconfig = False
+ not_really = False
# what was passed in
incfg = { "kernel": None, "ramdisk": None, "args": "" }
@@ -667,6 +668,8 @@ if __name__ == "__main__":
interactive = False
elif o in ("-i", "--interactive"):
interactive = True
+ elif o in ("-n", "--not-really"):
+ not_really = True
elif o in ("-h", "--help"):
usage()
sys.exit()
@@ -715,18 +718,24 @@ if __name__ == "__main__":
if not chosencfg["kernel"]:
chosencfg = run_grub(file, entry, fs, incfg["args"])
- data = fs.open_file(chosencfg["kernel"]).read()
- (tfd, bootcfg["kernel"]) = tempfile.mkstemp(prefix="boot_kernel.",
- dir="/var/run/xend/boot")
- os.write(tfd, data)
- os.close(tfd)
-
- if chosencfg["ramdisk"]:
- data = fs.open_file(chosencfg["ramdisk"],).read()
- (tfd, bootcfg["ramdisk"]) = tempfile.mkstemp(prefix="boot_ramdisk.",
- dir="/var/run/xend/boot")
+ if not_really:
+ bootcfg["kernel"] = "<kernel:%s>" % chosencfg["kernel"]
+ else:
+ data = fs.open_file(chosencfg["kernel"]).read()
+ (tfd, bootcfg["kernel"]) = tempfile.mkstemp(prefix="boot_kernel.",
+ dir="/var/run/xend/boot")
os.write(tfd, data)
os.close(tfd)
+
+ if chosencfg["ramdisk"]:
+ if not_really:
+ bootcfg["ramdisk"] = "<ramdisk:%s>" % chosencfg["ramdisk"]
+ else:
+ data = fs.open_file(chosencfg["ramdisk"],).read()
+ (tfd, bootcfg["ramdisk"]) = tempfile.mkstemp(
+ prefix="boot_ramdisk.", dir="/var/run/xend/boot")
+ os.write(tfd, data)
+ os.close(tfd)
else:
initrd = None