[pkg-cryptsetup-devel] Bug#597583: Bug#597583: initramfs-tools

Ian Jackson ijackson at chiark.greenend.org.uk
Fri May 20 10:30:20 UTC 2011


Thanks for your reply.

Jonas Meurer writes ("Re: [pkg-cryptsetup-devel] Bug#597583: initramfs-tools"):
> On 21/09/2010 Ian Jackson wrote:
> > This could be done by replacing this test
> >         if [ -n "$cryptkeyscript" ] && [ ! -x "$cryptkeyscript" ]; then
> > with something like
> > 	if ! type "$cryptkeyscript >/dev/null; then
> > with the added benefit of getting a slightly better error message too.
> 
> While I like your idea, it doesn't work. $cryptkeyscript might contain a
> whole commandline, with arguments and options as well. Actually the
> initramfs cryproot script even does it that way. See line 270 of the
> script:
> 
> cryptkeyscript="plymouth ask-for-password --prompt"

It's been a while since I looked at this, and I don't have the code in
front of me, but I'm puzzled, because if
  cryptkeyscript="plymouth ask-for-password --prompt"
then
  if [ -n "$cryptkeyscript" ] && [ ! -x "$cryptkeyscript" ]; then
would be true, just like my proposed test
  if ! type "$cryptkeyscript" >/dev/null; then
(err, with the syntax fixed...)

$ cryptkeyscript="plymouth ask-for-password --prompt"
$ if [ -n "$cryptkeyscript" ] && [ ! -x "$cryptkeyscript" ]; then echo
y; fi
y
$ if ! type "$cryptkeyscript" >/dev/null; then echo y; fi
bash: type: plymouth ask-for-password --prompt: not found
y
$

> That one clearly doesn't work with type, as type checks for all
> arguments, and errors out for the second and third one.

The same is true for test -x.

Ian.





More information about the pkg-cryptsetup-devel mailing list