mkinitrd unification across distributions
 help / color / mirror / Atom feed
From: "Amadeusz Żołnowski" <aidecoe-2qtfh70TtYba5EbDDlwbIw@public.gmane.org>
To: Karel Zak <kzak-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: initramfs <initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [RFC] 90crypt: key on rem. device enhancements
Date: Sun, 03 Oct 2010 22:04:36 +0200	[thread overview]
Message-ID: <1286135266-sup-5987@etiriah> (raw)
In-Reply-To: <20100930232719.GC6389-sHeGUpI7y9L/9pzu0YdTqQ@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 2231 bytes --]

Excerpts from Karel Zak's message of Fri Oct 01 01:28:09 +0200 2010:
> On Fri, Sep 24, 2010 at 11:18:07PM +0200, Amadeusz Żołnowski wrote:
> > +# Evaluate command for every given device.  Every single device must be
> > +# specified either by path, by label prefixed with 'LABEL=' or UUID prefixed
> > +# with 'UUID='.  UUIDs are processed by 'foreach_uuid_until'.  List elements'
> > +# order is preserved.
> > +#
> > +# foreach_dev_until command devices
> > +#
> > +# command - command to be evaluated
> > +# devices - list of devices separated by space
> > +#
> > +# The function returns after *first successful evaluation* of the given command
> > +# with status 0.  If evaluation fails for every device, function returns with
> > +# status 1.
> > +#
> > +# Example:
> > +# foreach_dev_until "echo \$___; false" "/dev/sda1 LABEL=boot UUID=123a"
> > +foreach_dev_until() {
> > +    local cmd="$1"; shift; local devs_list="$*"
> > +    local dev; local ___
> > +
> > +    [ -n "${cmd}" ] || return 1
> > +
> > +    if [ -n "${devs_list}" ]; then
> > +        for dev in ${devs_list}; do
> > +            if strstarts "${dev}" 'UUID='; then
> > +                foreach_uuid_until -p 'UUID=' "${cmd}" "${dev#UUID=*}" && \
> > +                        return 0
> > +            else
> > +                [ -e "${dev}" ] || [ -e "/dev/disk/by-label/${dev#LABEL=}" ] \
> 
>  hmm.. how does it work with blank or non-ascii chars in LABELs?

Thank you for pointing this out!

It doesn't work with non-printable or spaces. Moreover 'getargs' doesn't
expect spaces (even quoted with ""), so you cannot specify LABEL
including those chars.

I've just fixed issues around 'foreach_dev_until'. (I'll send patch in a
moment.)  Label may contain spaces, tabs, greek letters or whatever now.
I still left 'getopts' as is, so this new feature isn't easly available
yet, but I'll fix that - don't worry. :-)

>  mount(8) supports LABEL= and UUID= tags, for example
>  
>     mount LABEL=boot /mnt/test
>  
>  so, you does not need to convert these tags to -L or -U options.

I'm amazed I've missed that feature.  Thank you for highlighting it!
I've removed the redundant 'do_mount'.


Cheers,
-- 
Amadeusz Żołnowski

PGP key: 1024D/C284750D

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

      parent reply	other threads:[~2010-10-03 20:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-24 21:18 [RFC] 90crypt: key on rem. device enhancements Amadeusz Żołnowski
     [not found] ` <4c9e7c0d.d39ccc0a.676a.684a-ATjtLOhZ0NVl57MIdRCFDg@public.gmane.org>
2010-09-30 23:28   ` Karel Zak
     [not found]     ` <20100930232719.GC6389-sHeGUpI7y9L/9pzu0YdTqQ@public.gmane.org>
2010-10-03 20:04       ` Amadeusz Żołnowski [this message]

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=1286135266-sup-5987@etiriah \
    --to=aidecoe-2qtfh70ttyba5ebddlwbiw@public.gmane.org \
    --cc=initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=kzak-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    /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