[ipxe-devel] Patch: Add support for pausedelay

Earl Chew earl_chew at yahoo.com
Thu Nov 5 15:10:00 UTC 2015




commit 8d01bb98b47a7dc8e49cfdd19fb428acddfb057f
Author: Earl Chew <earl_chew at yahoo.com>
Date:   Sun Nov 1 16:14:46 2015 -0800

     [pausedelay] Add support for pausedelay

     Signed-off-by: Earl Chew <earl_chew at yahoo.com>

diff --git a/src/cmdline.c b/src/cmdline.c
index 952d903..ddab14e 100644
--- a/src/cmdline.c
+++ b/src/cmdline.c
@@ -50,6 +50,9 @@ unsigned int cmdline_index;
  /** Delay before reboot */
  unsigned int cmdline_rebootdelay;

+/** Delay before boot */
+unsigned int cmdline_pausedelay;
+
  /**
   * Process command line
   *
@@ -112,6 +115,15 @@ void process_cmdline ( char *cmdline ) {
  			if ( *endp )
  				die ( "Invalid rebootdelay \"%s\"\n", value );
  			cmdline_rebootdelay = delay;
+		} else if ( strcmp ( key, "pausedelay" ) == 0 ) {
+			unsigned int delay;
+			if ( ( ! value ) || ( ! value[0] ) )
+				die ( "Argument \"pausedelay\" "
+						"needs a value\n" );
+			delay = strtoul ( value, &endp, 0 );
+			if ( *endp )
+				die ( "Invalid pausedelay \"%s\"\n", value );
+			cmdline_pausedelay = delay;
  		} else if ( strcmp ( key, "initrdfile" ) == 0 ) {
  			/* Ignore this keyword to allow for use with syslinux */
  		} else if ( key == cmdline ) {
diff --git a/src/cmdline.h b/src/cmdline.h
index aae5af8..09bec0a 100644
--- a/src/cmdline.h
+++ b/src/cmdline.h
@@ -33,6 +33,7 @@ extern int cmdline_pause;
  extern int cmdline_pause_quiet;
  extern unsigned int cmdline_index;
  extern unsigned int cmdline_rebootdelay;
+extern unsigned int cmdline_pausedelay;
  extern void process_cmdline ( char *cmdline );

  #endif /* _CMDLINE_H */
diff --git a/src/pause.c b/src/pause.c
index 5f5cec5..2bf0726 100644
--- a/src/pause.c
+++ b/src/pause.c
@@ -38,14 +38,25 @@
   */
  void pause ( void ) {

-	/* Wait for keypress, prompting unless inhibited */
-	if ( cmdline_pause_quiet ) {
-		getchar();
-	} else {
-		printf ( "Press any key to continue booting..." );
-		getchar();
+	int wait;
+
+	wait = 1;
+	if ( cmdline_pausedelay ) {
+		printf ( "Press a key to pause boot..." );
+		wait = revocable_pause( cmdline_pausedelay );
  		printf ( "\n" );
  	}
+
+	/* Wait for keypress, prompting unless inhibited */
+	if ( wait ) {
+		if ( cmdline_pause_quiet && !cmdline_pausedelay ) {
+			getchar();
+		} else {
+			printf ( "Press any key to continue booting..." );
+			getchar();
+			printf ( "\n" );
+		}
+	}
  }

  /**




More information about the ipxe-devel mailing list