Message ID | 1327608411-722-1-git-send-email-vanhoof@canonical.com |
---|---|
State | Rejected |
Headers | show |
On 26/01/12 20:06, Chris Van Hoof wrote: > Signed-off-by: Chris Van Hoof<vanhoof@canonical.com> > --- > 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 /me being picky but how about using? if [ $EUID -ne 0 ]; then ... > + > +# > # 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() Otherwise, it looks good. Colin
On 01/27/2012 04:44 AM, Colin Ian King wrote: > > > On 26/01/12 20:06, Chris Van Hoof wrote: >> Signed-off-by: Chris Van Hoof<vanhoof@canonical.com> >> --- >> 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 > > /me being picky but how about using? > > if [ $EUID -ne 0 ]; then > ... Completely reasonable -- Sent over v2 for review >> + >> +# >> # 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() > > Otherwise, it looks good. > > Colin >
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()
Signed-off-by: Chris Van Hoof <vanhoof@canonical.com> --- live-image/fwts-frontend-text | 19 ++++++++++++++++--- 1 files changed, 16 insertions(+), 3 deletions(-)