From patchwork Thu Jan 26 20:06:51 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Van Hoof X-Patchwork-Id: 138027 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id 230D4B6F67 for ; Fri, 27 Jan 2012 07:07:34 +1100 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1RqVbZ-0004eD-O4 for incoming@patchwork.ozlabs.org; Thu, 26 Jan 2012 20:07:33 +0000 Received: from cdptpa-omtalb.mail.rr.com ([75.180.132.120]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1RqVbX-0004e0-Nq for fwts-devel@lists.ubuntu.com; Thu, 26 Jan 2012 20:07:31 +0000 X-Authority-Analysis: v=2.0 cv=TqVkdUrh c=1 sm=0 a=jrUOvm/RFT1SBfzjC7VLzg==:17 a=jz97lrOvneUA:10 a=1XB9yynOT10A:10 a=DfNHnWVPAAAA:8 a=BMJK3IPKImPvmRPAT90A:9 a=lBRciGGoxdUA:10 a=jrUOvm/RFT1SBfzjC7VLzg==:117 X-Cloudmark-Score: 0 X-Originating-IP: 174.109.107.185 Received: from [174.109.107.185] ([174.109.107.185:64191] helo=haddonfield.itb.ouwish.com) by cdptpa-oedge03.mail.rr.com (envelope-from ) (ecelerity 2.2.3.46 r()) with ESMTP id 91/87-20593-282B12F4; Thu, 26 Jan 2012 20:07:30 +0000 Received: from haddonfield.itb.ouwish.com (localhost [127.0.0.1]) by haddonfield.itb.ouwish.com (8.14.4/8.14.4/Debian-2ubuntu2) with ESMTP id q0QK7CxY000772; Thu, 26 Jan 2012 15:07:12 -0500 Received: (from vanhoof@localhost) by haddonfield.itb.ouwish.com (8.14.4/8.14.4/Submit) id q0QK7C4O000771; Thu, 26 Jan 2012 15:07:12 -0500 From: Chris Van Hoof To: fwts-devel@lists.ubuntu.com Subject: [PATCH] fwts-frontend: update to conditional logic to better detect if we're booted via casper and additional logic to toggle auto shutdown behaviour when testing Date: Thu, 26 Jan 2012 15:06:51 -0500 Message-Id: <1327608411-722-1-git-send-email-vanhoof@canonical.com> X-Mailer: git-send-email 1.7.8.3 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: fwts-devel-bounces@lists.ubuntu.com Errors-To: fwts-devel-bounces@lists.ubuntu.com Signed-off-by: Chris Van Hoof --- live-image/fwts-frontend-text | 19 ++++++++++++++++--- 1 files changed, 16 insertions(+), 3 deletions(-) diff --git a/live-image/fwts-frontend-text b/live-image/fwts-frontend-text index dbf6635..02b01f7 100755 --- a/live-image/fwts-frontend-text +++ b/live-image/fwts-frontend-text @@ -25,12 +25,21 @@ FWTS_DATE=`date +%d%m%Y` FWTS_TIME=`date +%H%M` # +# Check if executed as root or with sudo +# +if [ `id -u` -ne 0 ]; then + echo "`basename $0`: must be executed with sudo" + exit 1 +fi + +# # for debugging, use: # - 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 +FWTS_AUTO_SHUTDOWN="$1" SHUTDOWN_AT_END=1 # @@ -42,10 +51,14 @@ if [ `grep -qs boot=casper /proc/cmdline; echo $?` -eq 0 ]; then fi # -# check /proc/cmdline for FWTS_AUTO_SHUTDOWN to toggle auto shutdown +# check /proc/cmdline and argv[1] 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 +if [ `grep -qs FWTS_AUTO_SHUTDOWN=1 /proc/cmdline; echo $?` -ne 0 ]; then + if [ -n "${CASPER_DETECTED:+x}" ]; then + SHUTDOWN_AT_END=0 + elif [ -n "${FWTS_AUTO_SHUTDOWN:+x}" ]; then + SHUTDOWN_AT_END=0 + fi fi do_help()