[PATCH openbmc v6 16/18] initfs: update: handle no images to update
Andrew Jeffery
andrew at aj.id.au
Mon Jun 27 13:49:46 AEST 2016
On Sun, 2016-06-26 at 00:12 +0000, Milton Miller II wrote:
>
> On 06/23/2016 01:11AM Andrew Jeffery wrote:
> >
> >On Wed, 2016-06-22 at 19:30 -0500, OpenBMC Patches wrote:
> >> From: Milton Miller <miltonm at us.ibm.com>
> >>
> >> Notify the user if image wildcard expansion fails instead of
> >printing
> >> message about failing to find partition to flash.
> >>
> >
> >This kind of problem is why I have reservations about our early/late
> >shell scripts. I wonder how many more of these issues are lurking...
> >
> >> The update script errors with the message that it can't figure out
> >what
> >> partition to flash for /run/initramfs/image-* if there are no
> >images
> >> pending.
> >>
> >> Signed-off-by: Milton Miller <miltonm at us.ibm.com>
> >> ---
> >> .../obmc-phosphor-initfs/files/obmc-update.sh | 13
> >+++++++++++--
> >> 1 file changed, 11 insertions(+), 2 deletions(-)
> >>
> >> diff --git
> >a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/ob
> >mc-update.sh
> >b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/ob
> >mc-update.sh
> >> index 1dbf65f..7120a18 100755
> >> ---
> >a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/ob
> >mc-update.sh
> >> +++
> >b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/ob
> >mc-update.sh
> >> @@ -99,6 +99,7 @@ checkmount=y
> >> whitelist=/run/initramfs/whitelist
> >> image=/run/initramfs/image-
> >> E="ERROR:"
> >> +imglist=
> >>
> >> while test "$1" != "${1#-}"
> >> do
> >> @@ -184,7 +185,15 @@ then
> >> fi
> >> fi
> >>
> >> -for f in $image*
> >> +imglist=$(echo $image*)
> >
> >If there are no wildcard matches doesn't this expand to the string
> >"/run/initramfs/image-*"? Why are we using echo in a subshell?
> >
>
> Because that causes path expansion to be performed before
> assigning the output to the parameter.
>
> >> +if test "$imglist" = "$image*" -a ! -e "$imglist"
> >
> >What's the idea behind the first condition ("imglist" = "$image*")?
> >Won't they always be the same?
> >
>
> No, because parameter splitting and path expansion are
> suppressed by the double quotes here but path expansion
> occurred in the echo above.
Okay, I understand, but it still feels subtle. Can you add some
comments?
Cheers,
Andrew
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20160627/f2d826c4/attachment.sig>
More information about the openbmc
mailing list