Patchwork [3/5] Adding a bit of conditional logic to fwts-frontend-text to better detect if executed in a live image and setting defaults which make the script easier to control

login
register
mail settings
Submitter Chris Van Hoof
Date Dec. 5, 2011, 10:54 p.m.
Message ID <1323125699-25351-4-git-send-email-vanhoof@canonical.com>
Download mbox | patch
Permalink /patch/129458/
State Accepted
Headers show

Comments

Chris Van Hoof - Dec. 5, 2011, 10:54 p.m.
---
 live-image/fwts-frontend-text |   22 +++++++++++++++++++---
 1 files changed, 19 insertions(+), 3 deletions(-)
Colin King - Dec. 5, 2011, 11:53 p.m.
On 05/12/11 22:54, Chris Van Hoof wrote:
> ---
>   live-image/fwts-frontend-text |   22 +++++++++++++++++++---
>   1 files changed, 19 insertions(+), 3 deletions(-)
>
> diff --git a/live-image/fwts-frontend-text b/live-image/fwts-frontend-text
> index 9b92eb8..dbf6635 100755
> --- a/live-image/fwts-frontend-text
> +++ b/live-image/fwts-frontend-text
> @@ -19,18 +19,34 @@
>   FWTS="Firmware Test Suite"
>   OPTIONS="/tmp/options.$$"
>   DIALOG_CMD="/tmp/fwts.cmd.$$"
> +export DIALOGRC="/usr/share/fwts/fwts-live-dialogrc"
>
>   FWTS_DATE=`date +%d%m%Y`
>   FWTS_TIME=`date +%H%M`
>
> -WORK_DIR=/cdrom/fwts/$FWTS_DATE/$FWTS_TIME
> -
>   #
>   # for debugging, use:
> -# WORK_DIR=./fwts/$FWTS_DATE/$FWTS_TIME
> +# -  WORK_DIR=./fwts/$FWTS_DATE/$FWTS_TIME
> +# if booting in fwts-live
> +# - change FWTS_AUTO_SHUTDOWN= to alter default shutdown after testing completion
>   #
> +WORK_DIR=/fwts/$FWTS_DATE/$FWTS_TIME
>   SHUTDOWN_AT_END=1
>
> +#
> +# set WORK_DIR to /cdrom/fwts if booting via casper
> +#
> +if [ `grep -qs boot=casper /proc/cmdline; echo $?` -eq 0 ]; then
> +	CASPER_DETECTED=1
> +	WORK_DIR=/cdrom/fwts/$FWTS_DATE/$FWTS_TIME
> +fi
> +
> +#
> +# check /proc/cmdline for FWTS_AUTO_SHUTDOWN to toggle auto shutdown
> +#
> +if [ `grep -qs FWTS_AUTO_SHUTDOWN=1 /proc/cmdline; echo $?` -ne 0 -a $CASPER_DETECTED -eq 1 ]; then
> +	SHUTDOWN_AT_END=0
> +fi
>
>   do_help()
>   {
Ack, good idea.

Colin

Patch

diff --git a/live-image/fwts-frontend-text b/live-image/fwts-frontend-text
index 9b92eb8..dbf6635 100755
--- a/live-image/fwts-frontend-text
+++ b/live-image/fwts-frontend-text
@@ -19,18 +19,34 @@ 
 FWTS="Firmware Test Suite"
 OPTIONS="/tmp/options.$$"
 DIALOG_CMD="/tmp/fwts.cmd.$$"
+export DIALOGRC="/usr/share/fwts/fwts-live-dialogrc"
 
 FWTS_DATE=`date +%d%m%Y`
 FWTS_TIME=`date +%H%M`
 
-WORK_DIR=/cdrom/fwts/$FWTS_DATE/$FWTS_TIME
-
 #
 # for debugging, use:
-# WORK_DIR=./fwts/$FWTS_DATE/$FWTS_TIME
+# -  WORK_DIR=./fwts/$FWTS_DATE/$FWTS_TIME
+# if booting in fwts-live
+# - change FWTS_AUTO_SHUTDOWN= to alter default shutdown after testing completion
 #
+WORK_DIR=/fwts/$FWTS_DATE/$FWTS_TIME
 SHUTDOWN_AT_END=1
 
+#
+# set WORK_DIR to /cdrom/fwts if booting via casper 
+#
+if [ `grep -qs boot=casper /proc/cmdline; echo $?` -eq 0 ]; then
+	CASPER_DETECTED=1
+	WORK_DIR=/cdrom/fwts/$FWTS_DATE/$FWTS_TIME
+fi
+
+#
+# check /proc/cmdline for FWTS_AUTO_SHUTDOWN to toggle auto shutdown
+#
+if [ `grep -qs FWTS_AUTO_SHUTDOWN=1 /proc/cmdline; echo $?` -ne 0 -a $CASPER_DETECTED -eq 1 ]; then
+	SHUTDOWN_AT_END=0
+fi
 
 do_help()
 {