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@xxxxxxxxxx>
diff -r e021832644f4 tools/pygrub/src/pygrub
--- a/tools/pygrub/src/pygrub Fri Jul 02 14:07:18 2010 +0100
+++ b/tools/pygrub/src/pygrub Fri Jul 02 14:21:59 2010 +0100
@@ -631,13 +631,13 @@
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)
@@ -651,6 +651,7 @@
entry = None
interactive = True
isconfig = False
+ not_really = False
# what was passed in
incfg = { "kernel": None, "ramdisk": None, "args": "" }
@@ -664,6 +665,8 @@
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()
@@ -712,18 +715,24 @@
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 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"]:
- 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)
+ 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
pygrub-notreally
Description: Text document
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|