All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Cryptroot-ask.sh: Use variables consistently
@ 2014-02-09  8:08 Till Maas
       [not found] ` <1391933322-17308-1-git-send-email-opensource-44rtNO6TQJOzQB+pC5nmwQ@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Till Maas @ 2014-02-09  8:08 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: Till Maas

- Always use $luksname instead of sometimes $2
- define $asked_file instead of using the same path twice
---
 modules.d/90crypt/cryptroot-ask.sh | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/modules.d/90crypt/cryptroot-ask.sh b/modules.d/90crypt/cryptroot-ask.sh
index 9665e48..1ab03bc 100755
--- a/modules.d/90crypt/cryptroot-ask.sh
+++ b/modules.d/90crypt/cryptroot-ask.sh
@@ -8,19 +8,21 @@ NEWROOT=${NEWROOT:-"/sysroot"}
 # do not ask, if we already have root
 [ -f $NEWROOT/proc ] && exit 0
 
+# default luksname - luks-UUID
+luksname=$2
+
 # check if destination already exists
-[ -b /dev/mapper/$2 ] && exit 0
+[ -b /dev/mapper/luksname ] && exit 0
 
 # we already asked for this device
-[ -f /tmp/cryptroot-asked-$2 ] && exit 0
+asked_file=/tmp/cryptroot-asked-$luksname
+[ -f $asked_file ] && exit 0
 
 # load dm_crypt if it is not already loaded
 [ -d /sys/module/dm_crypt ] || modprobe dm_crypt
 
 . /lib/dracut-crypt-lib.sh
 
-# default luksname - luks-UUID
-luksname=$2
 
 # fallback to passphrase
 ask_passphrase=1
@@ -45,7 +47,7 @@ if [ -f /etc/crypttab ] && getargbool 1 rd.luks.crypttab -d -n rd_NO_CRYPTTAB; t
 
         # UUID used in crypttab
         if [ "${dev%%=*}" = "UUID" ]; then
-            if [ "luks-${dev##UUID=}" = "$2" ]; then
+            if [ "luks-${dev##UUID=}" = "$luksname" ]; then
                 luksname="$name"
                 break
             fi
@@ -157,7 +159,7 @@ fi
 unset device luksname luksfile
 
 # mark device as asked
->> /tmp/cryptroot-asked-$2
+>> $asked_file
 
 need_shutdown
 udevsettle
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Cryptroot-ask.sh: Use variables consistently
       [not found] ` <1391933322-17308-1-git-send-email-opensource-44rtNO6TQJOzQB+pC5nmwQ@public.gmane.org>
@ 2014-02-09 13:13   ` Harald Hoyer
       [not found]     ` <52F77EFA.2070600-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  2014-02-09 19:37   ` Alexander Tsoy
  1 sibling, 1 reply; 4+ messages in thread
From: Harald Hoyer @ 2014-02-09 13:13 UTC (permalink / raw)
  To: Till Maas, initramfs-u79uwXL29TY76Z2rM5mHXA

On 02/09/2014 09:08 AM, Till Maas wrote:
> - Always use $luksname instead of sometimes $2
> - define $asked_file instead of using the same path twice
> ---
>  modules.d/90crypt/cryptroot-ask.sh | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
> 

Thanks! Pushed.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Cryptroot-ask.sh: Use variables consistently
       [not found]     ` <52F77EFA.2070600-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2014-02-09 15:19       ` Till Maas
  0 siblings, 0 replies; 4+ messages in thread
From: Till Maas @ 2014-02-09 15:19 UTC (permalink / raw)
  To: Harald Hoyer; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA

On Sun, Feb 09, 2014 at 02:13:30PM +0100, Harald Hoyer wrote:
> On 02/09/2014 09:08 AM, Till Maas wrote:
> > - Always use $luksname instead of sometimes $2
> > - define $asked_file instead of using the same path twice
> > ---
> >  modules.d/90crypt/cryptroot-ask.sh | 14 ++++++++------
> >  1 file changed, 8 insertions(+), 6 deletions(-)
> > 
> 
> Thanks! Pushed.

Thank you. Unluckily the patch did not apply as intended since someone
else did some similar changes since I created the patch. Please apply
the patch I just sent to the mailing list to clean this up. Sorry for
the trouble.

Regards
Till

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Cryptroot-ask.sh: Use variables consistently
       [not found] ` <1391933322-17308-1-git-send-email-opensource-44rtNO6TQJOzQB+pC5nmwQ@public.gmane.org>
  2014-02-09 13:13   ` Harald Hoyer
@ 2014-02-09 19:37   ` Alexander Tsoy
  1 sibling, 0 replies; 4+ messages in thread
From: Alexander Tsoy @ 2014-02-09 19:37 UTC (permalink / raw)
  To: Till Maas, initramfs-u79uwXL29TY76Z2rM5mHXA

On Sun Feb   9 12:08:42 2014 Till Maas <opensource-44rtNO6TQJOzQB+pC5nmwQ@public.gmane.org> wrote:
> - Always use $luksname instead of sometimes $2
> - define $asked_file instead of using the same path twice
> ---
>   modules.d/90crypt/cryptroot-ask.sh | 14 ++++++++------
>   1 file changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/modules.d/90crypt/cryptroot-ask.sh
> b/modules.d/90crypt/cryptroot-ask.sh index 9665e48..1ab03bc 100755
> --- a/modules.d/90crypt/cryptroot-ask.sh
> +++ b/modules.d/90crypt/cryptroot-ask.sh
> @@ -8,19 +8,21 @@ NEWROOT=${NEWROOT:-"/sysroot"}
>   # do not ask, if we already have root
>   [ -f $NEWROOT/proc ] && exit 0
>   
> +# default luksname - luks-UUID
> +luksname=$2
> +
>   # check if destination already exists
> -[ -b /dev/mapper/$2 ] && exit 0
> +[ -b /dev/mapper/luksname ] && exit 0

Here is a typo.

[ -b /dev/mapper/$luksname ] && exit 0

>   
>   # we already asked for this device
> -[ -f /tmp/cryptroot-asked-$2 ] && exit 0
> +asked_file=/tmp/cryptroot-asked-$luksname
> +[ -f $asked_file ] && exit 0
>   
>   # load dm_crypt if it is not already loaded
>   [ -d /sys/module/dm_crypt ] || modprobe dm_crypt
>   
>   . /lib/dracut-crypt-lib.sh
>   
> -# default luksname - luks-UUID
> -luksname=$2
>   
>   # fallback to passphrase
>   ask_passphrase=1
> @@ -45,7 +47,7 @@ if [ -f /etc/crypttab ] && getargbool 1
> rd.luks.crypttab -d -n rd_NO_CRYPTTAB; t 
>                   # UUID used in crypttab
>                   if [ "${dev%%=*}" = "UUID" ]; then
> -                       if [ "luks-${dev##UUID=}" = "$2" ]; then
> +                       if [ "luks-${dev##UUID=}" = "$luksname" ]; then
>                                   luksname="$name"
>                                   break
>                           fi
> @@ -157,7 +159,7 @@ fi
>   unset device luksname luksfile
>   
>   # mark device as asked
> ->> /tmp/cryptroot-asked-$2
> +>> $asked_file
>   
>   need_shutdown
>   udevsettle
> -- 
> 1.8.3.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe initramfs" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at   http://vger.kernel.org/majordomo-info.html

-- 
Alexander Tsoy

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-02-09 19:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-09  8:08 [PATCH] Cryptroot-ask.sh: Use variables consistently Till Maas
     [not found] ` <1391933322-17308-1-git-send-email-opensource-44rtNO6TQJOzQB+pC5nmwQ@public.gmane.org>
2014-02-09 13:13   ` Harald Hoyer
     [not found]     ` <52F77EFA.2070600-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-02-09 15:19       ` Till Maas
2014-02-09 19:37   ` Alexander Tsoy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.