[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Fedora-livecd-list] [PATCH]: Make timeout configurable



All,
     Attached is a patch to make the bootloader timeout configurable via a
--timeout=x command-line option.  This is useful for some people (like me) who
don't want to wait the full 60 seconds for the bootloader to do the default
action.  I've only tested it on x86; I think I did the PPC parts right, but I
don't have any PPC boxes locally to test with.

Signed-off-by: Chris Lalancette <clalance redhat com>
diff -up livecd-tools-012/creator/livecd-creator.orig livecd-tools-012/creator/livecd-creator
--- livecd-tools-012/creator/livecd-creator.orig	2007-10-23 17:53:05.000000000 -0400
+++ livecd-tools-012/creator/livecd-creator	2007-10-23 18:01:26.000000000 -0400
@@ -337,6 +337,7 @@ class ImageCreator(object):
         self.fs_label = fs_label
         self.skip_compression = False
         self.tmpdir = "/var/tmp"
+        self.timeout = 60
 
         self._checkIsoMD5 = False
 
@@ -1148,7 +1149,7 @@ class x86ImageCreator(ImageCreator):
 
         cfg = """
 default %(menu)s
-timeout 600
+timeout %(timeout)d
 
 %(background)s
 menu title Welcome to %(label)s!
@@ -1164,7 +1165,7 @@ menu color timeout 0 #ffffffff #00000000
 menu color cmdline 0 #ffffffff #00000000
 menu hidden
 menu hiddenrow 5
-""" %{"menu" : syslinuxMenu, "label": self.fs_label, "background" : have_background}
+""" %{"menu" : syslinuxMenu, "label": self.fs_label, "background" : have_background, "timeout" : self.timeout*10}
 
         stanzas = [("linux", "Boot %s" %(self.fs_label,), "")]
         if self._checkIsoMD5:
@@ -1290,9 +1291,9 @@ class ppcImageCreator(ImageCreator):
         for bit in havekernel.keys():
             cfg = """
 init-message = "Welcome to %(label)s"
-timeout=6000
+timeout=$(timeout)d
 
-""" %{"label": self.fs_label}
+""" %{"label": self.fs_label, "timeout": self.timeout*1000}
 
             stanzas = [("linux", "Run from image", "")]
             if self._checkIsoMD5:
@@ -1328,7 +1329,7 @@ image=/ppc/ppc%(bit)s/vmlinuz
         else:
             cfg = """
 init-message = "\nWelcome to %(label)s!\nUse 'linux32' for 32-bit kernel.\n\n"
-timeout=6000
+timeout=%(timeout)d
 default=linux
 
 image=/ppc/ppc64/vmlinuz
@@ -1341,7 +1342,7 @@ image=/ppc/ppc32/vmlinuz
 	label=linux32
 	initrd=/ppc/ppc32/initrd.img
 	read-only
-""" %{"label": self.fs_label,}
+""" %{"label": self.fs_label, "timeout": self.timeout*1000}
 
             cfgf = open("%s/out/etc/yaboot.conf" %(self.build_dir,), "w")
             cfgf.write(cfg)
@@ -1392,6 +1393,8 @@ def parse_options(args):
                       help="Add packages to an existing live CD iso9660 image.")
     imgopt.add_option("-f", "--fslabel", type="string", dest="fs_label",
                       help="File system label (default based on config name)")
+    imgopt.add_option("", "--timeout", type="int", dest="timeout",
+                      help="Boot screen timeout in seconds (default is 60)")
     parser.add_option_group(imgopt)
 
     # options related to the config of your system
@@ -1465,6 +1468,7 @@ def main():
         print "Using label %s" % (fs_label,)
 
     target = getImageCreator(fs_label)
+    target.timeout = options.timeout
     target.skip_compression = options.skip_compression
     target.tmpdir = options.tmpdir
 

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]