From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from sender163-mail.zoho.com (sender163-mail.zoho.com [74.201.84.163]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3rgbry3y28zDqmw for ; Fri, 1 Jul 2016 09:50:42 +1000 (AEST) Received: from localhost (172.110.7.206 [172.110.7.206]) by mx.zohomail.com with SMTPS id 1467330637939931.7754122110392; Thu, 30 Jun 2016 16:50:37 -0700 (PDT) From: OpenBMC Patches To: openbmc@lists.ozlabs.org Subject: [PATCH openbmc 04/16] initfs: update: Don't exec sh or sulogin on error just exit 1 Date: Thu, 30 Jun 2016 18:50:21 -0500 Message-Id: <20160630235033.17091-5-openbmc-patches@stwcx.xyz> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20160630235033.17091-1-openbmc-patches@stwcx.xyz> References: <20160630235033.17091-1-openbmc-patches@stwcx.xyz> X-BeenThere: openbmc@lists.ozlabs.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Development list for OpenBMC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jun 2016 23:50:43 -0000 From: Milton Miller When update was written it was exec'd from the shutdown script and hence took over pid 1. Since exiting in that environment was a panic situation, the script instead started a rescue shell with its output presumably on the console. The calling convention was updated to be a simple invocation in commit dbacf104885c ("obmc-initfs: run update as a sub-script") but the error handling was not updated. That error handling is now becoming a hindrance to use from additional environments so change it. Signed-off-by: Milton Miller --- .../obmc-phosphor-initfs/files/obmc-update.sh | 23 ++++++---------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh index aa8fd89..f8e551c 100755 --- a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh +++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-update.sh @@ -2,9 +2,6 @@ echo update: "$@" -export PS1=update-sh#\ -# exec /bin/sh - cd / if ! test -r /proc/mounts || ! test -f /proc/mounts then @@ -21,12 +18,12 @@ then mkdir -p /dev mount -t devtmpfs dev dev fi -while grep mtd /proc/mounts -do + +if grep mtd /proc/mounts +then echo 1>&2 "Error: A mtd device is mounted." - sulogin - # exec /bin/sh -done + exit 1 +fi findmtd() { m=$(grep -xl "$1" /sys/class/mtd/*/name) @@ -130,7 +127,7 @@ do if test -z "$m" then echo 1>&2 "Unable to find mtd partiton for ${f##*/}." - exec /bin/sh + exit 1 fi done @@ -173,11 +170,3 @@ then fi exit - -# NOT REACHED without edit -# NOT REACHED without edit - -echo "Flash completed. Inspect, cleanup and reboot -f to continue." - -export PS1=update-sh#\ -exec /bin/sh -- 2.9.0