mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: ptxdist@pengutronix.de
Subject: Re: [ptxdist] [PATCH 2/2] barebox_mlo: use images/barebox-*-mlo.img as images
Date: Wed, 14 May 2014 11:04:01 +0200	[thread overview]
Message-ID: <20140514090401.GG16662@pengutronix.de> (raw)
In-Reply-To: <20140514084735.GA13402@omega>

On Wed, May 14, 2014 at 10:47:38AM +0200, Alexander Aring wrote:
> On Wed, May 14, 2014 at 09:54:32AM +0200, Teresa Gámez wrote:
> > New barebox versions may create multiple MLO images.
> > Adapted barebox_mlo rule to handle this.
> > 
> > Signed-off-by: Teresa Gámez <t.gamez@phytec.de>
> > ---
> >  rules/barebox_mlo.make |   17 ++++++++++++++---
> >  1 files changed, 14 insertions(+), 3 deletions(-)
> > 
> > diff --git a/rules/barebox_mlo.make b/rules/barebox_mlo.make
> > index 3c53575..8b2bce4 100644
> > --- a/rules/barebox_mlo.make
> > +++ b/rules/barebox_mlo.make
> > @@ -76,9 +76,20 @@ $(STATEDIR)/barebox_mlo.install:
> >  $(STATEDIR)/barebox_mlo.targetinstall:
> >  	@$(call targetinfo)
> >  #	#barebox renamed barebox.bin.ift to MLO, so fall back to barebox.bin.ift
> > -	@ptxd_get_path "$(BAREBOX_MLO_DIR)/MLO" \
> > -		"$(BAREBOX_MLO_DIR)/barebox.bin.ift" && \
> > -	install -D -m644 "$${ptxd_reply}" "$(IMAGEDIR)/MLO"
> > +	@rm -f $(IMAGEDIR)/MLO
> > +	@for image in `ls $(BAREBOX_MLO_DIR)/images/barebox-*-mlo.img`; do \
> > +		install -D -m644 $$image $(IMAGEDIR)/`basename $$image`; \
> > +		if [ ! -e $(IMAGEDIR)/MLO ]; then \
> > +			ln -sf `basename $$image` $(IMAGEDIR)/MLO; \
> > +		fi; \
> > +	done
> > +	@if [ -e $(IMAGEDIR)/MLO ]; then \
> > +		:; \
> > +	else \
> > +		ptxd_get_path "$(BAREBOX_MLO_DIR)/MLO" \
> > +			"$(BAREBOX_MLO_DIR)/barebox.bin.ift" && \
> > +		install -D -m644 "$${ptxd_reply}" "$(IMAGEDIR)/MLO"; \
> > +	fi
> negative logic here, without explicit do nothing [if -e $(IMAGEDIR)/MLO] ?
> Or we should call "exit 1" here? I don't know if ptxdist can handle this
> as error or this case can ever happen.
> 
> And why ":;"?
You need a command in the then branch:

$ sh -c 'if true; then
   # nothing
else
   echo jippie
fi'
sh: 3: Syntax error: "else" unexpected

Using ":" instead of "# nothing" works fine.

An option is [ ! -e $(IMAGEDIR)/MLO ];.
ISTR that

	if ! $somecommand; then ...

isn't portable, but I think [ supports ! everywhere.

Apart from that, there are missing quotes, better write

	if [ ! -e "$(IMAGEDIR)/MLO" ]; then \

but the surrounding code seems affected, too.

Best regards
Uwe


-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

-- 
ptxdist mailing list
ptxdist@pengutronix.de

  reply	other threads:[~2014-05-14  9:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-14  7:54 [ptxdist] [PATCH 1/2] dtc: Seperate path and filename of dts Teresa Gámez
2014-05-14  7:54 ` [ptxdist] [PATCH 2/2] barebox_mlo: use images/barebox-*-mlo.img as images Teresa Gámez
2014-05-14  8:47   ` Alexander Aring
2014-05-14  9:04     ` Uwe Kleine-König [this message]
2014-05-14  9:22       ` Alexander Aring
2014-05-14  8:49 ` [ptxdist] [PATCH 1/2] dtc: Seperate path and filename of dts Alexander Aring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140514090401.GG16662@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox