Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Yann E. MORIN <yann.morin.1998@free.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 4/5] fs/custom: add support for squashfs
Date: Sat, 4 Jan 2014 18:01:58 +0100	[thread overview]
Message-ID: <20140104170157.GA3417@free.fr> (raw)
In-Reply-To: <CAGduivx8F02CaJ52nnv6pFKPTJ_4LCBAKymu0RQeoBhtrC8NOg@mail.gmail.com>

Maxime, All,

Thanks for the review! :-)

On 2014-01-04 17:43 +0100, Maxime Hadjinlian spake thusly:
> On Fri, Jan 3, 2014 at 6:19 PM, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> > From: "Yann E. MORIN" <yann.morin.1998@free.fr>
> >
> > Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> > Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> > Cc: Ryan Barnett <rjbarnet@rockwellcollins.com>
> > ---
> >  docs/manual/partition-layout.txt | 11 ++++++++++-
> >  fs/custom/fs/squashfs            | 19 +++++++++++++++++++
> >  2 files changed, 29 insertions(+), 1 deletion(-)
> >  create mode 100644 fs/custom/fs/squashfs
> >
[--SNIP--]
> > diff --git a/fs/custom/fs/squashfs b/fs/custom/fs/squashfs
> > new file mode 100644
> > index 0000000..132d3ef
> > --- /dev/null
> > +++ b/fs/custom/fs/squashfs
> > @@ -0,0 +1,19 @@
> > +# Create a squashfs filesystem
> > +
> > +#-----------------------------------------------------------------------------
> > +DEPENDS+=( squashfs )
> > +
> > +#-----------------------------------------------------------------------------
> > +do_image() {
> > +    local root_dir="${1}"
> > +    local img="${2}"
> > +    local -a fs_opts
> > +
> > +    fs_opts+=( -no-progress -noappend )
> > +    [ -z "${squashfs_comp}"  ] || fs_opts+=( -comp "${squashfs_comp}" )
> It just a question of taste, but I really do prefer to read something like:
> [ -n "${squashfs_comp}"  ] && fs_opts+=( -comp "${squashfs_comp}" )
> But that's just a personal taste.

The genimages script runs with 'set -e -E', which means to exit as soon
as one command exits with a !0 exit code.

If we do as you suggested:
    [ -n "${squashfs_comp}"  ] && fs_opts+=( -comp "${squashfs_comp}" )

and "${squashfs_comp}" is empty, then the test is false, and the whole
list also is false, which amkes the shell error out.

If we do the way I did:
    [ -z "${squashfs_comp}"  ] || fs_opts+=( -comp "${squashfs_comp}" )

then it ensures that the list is never false, and thus there is no
error.

If this construct is not welcome, then we have to use if...fi blocks
instead:
    if [ -n "${squashfs_comp}" ]; then
        fs_opts+=( -comp "${squashfs_comp}" )
    fi

This is a bit more verbose, but maybe more explicit. I prefer concise,
since I know why it is written this way, but I don't really care.

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

  reply	other threads:[~2014-01-04 17:01 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-03 17:19 [Buildroot] [PATCH 0/5 v4] SUBJECT Yann E. MORIN
2014-01-03 17:19 ` [Buildroot] [PATCH 1/5] package/squashfs: add selection for the host variant Yann E. MORIN
2014-02-03 14:53   ` Thomas De Schampheleire
2014-02-08 22:20   ` Peter Korsgaard
2014-01-03 17:19 ` [Buildroot] [PATCH 2/5] fs/custom: generate complete, partition-based device images Yann E. MORIN
2014-01-04 16:38   ` Maxime Hadjinlian
2014-01-04 17:43     ` Yann E. MORIN
2014-01-04 17:52       ` Maxime Hadjinlian
2014-04-09 13:28   ` Andreas Naumann
2014-04-09 17:09     ` Yann E. MORIN
2014-04-10 13:53       ` Andreas Naumann
2014-01-03 17:19 ` [Buildroot] [PATCH 3/5] board/raspberrypi: provide partition description for the new genimages Yann E. MORIN
2014-01-04 16:40   ` Maxime Hadjinlian
2014-01-04 17:05     ` Yann E. MORIN
2014-01-04 17:12       ` Maxime Hadjinlian
2014-01-04 17:50         ` Yann E. MORIN
2014-01-04 17:57           ` Maxime Hadjinlian
2014-01-03 17:19 ` [Buildroot] [PATCH 4/5] fs/custom: add support for squashfs Yann E. MORIN
2014-01-04 16:43   ` Maxime Hadjinlian
2014-01-04 17:01     ` Yann E. MORIN [this message]
2014-01-03 17:19 ` [Buildroot] [PATCH 5/5] fs/custom: add support for raw device/partition content Yann E. MORIN
2014-01-03 17:22 ` [Buildroot] [PATCH 0/5 v4] SUBJECT Yann E. MORIN

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=20140104170157.GA3417@free.fr \
    --to=yann.morin.1998@free.fr \
    --cc=buildroot@busybox.net \
    /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