Skip to contentSkip to conversation

99base/dracut-lib.sh: 5 new functions & 1 modified

PATCH In review Amadeusz Żołnowski 3 participants 8 messages Nov 12, 2010 – Nov 15, 2010 4 messages not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 99base/dracut-lib.sh: 5 new functions & 1 modified

New:
str_starts, str_replace
funiq - print new unique file name
mkuniqdir - create and print new unique dir
splitsep - splits given string 'str' with separator 'sep' into vars udevmatch - create udev rule match for a device

Modified:
foreach_uuid_until - use $___ as a place holder

---
 modules.d/99base/dracut-lib.sh |  137 +++++++++++++++++++++++++++++++++++++--
 1 files changed, 130 insertions(+), 7 deletions(-)
modules.d/99base/dracut-lib.sh +130 -7
index 596dae2..f0c030b 100755
@@ -6,6 +6,29 @@ strstr() {
     [ "${1#*$2*}" != "$1" ]
 }
 
+# returns OK if $1 contains $2 at the beginning
+str_starts() {
+    [ "${1#$2*}" != "$1" ]
+}
+
+# replaces all occurrences of 'search' in 'str' with 'replacement'
+#
+# str_replace str search replacement
+#
+# example:
+# str_replace '  one two  three  ' ' ' '_'
+str_replace() {
+    local in="$1"; local s="$2"; local r="$3"
+    local out=''
+
+    while strstr "${in}" "$s"; do
+        chop="${in%%$s*}"
+        out="${out}${chop# }$r"
+        in="${in#*$s}"
+    done
+    echo "${out}${in}"
+}
+
 _getcmdline() {
     local _line
     unset _line
@@ -142,6 +165,34 @@ getoptcomma() {
     return 1
 }
 
+# Splits given string 'str' with separator 'sep' into variables 'var1', 'var2',
+# 'varN'.  If number of fields is less than number of variables, remaining are
+# not set.  If number of fields is greater than number of variables, the last
+# variable takes remaining fields.  In short - it acts similary to 'read'.
+#
+# splitsep sep str var1 var2 varN
+#
+# example:
+#   splitsep ':' 'foo:bar:baz' v1 v2
+# in result:
+#   v1='foo', v2='bar:baz'
+#
+# TODO: ':' inside fields.
+splitsep() {
+    local sep="$1"; local str="$2"; shift 2
+    local tmp
+
+    while [ -n "$str" -a -n "$*" ]; do
+        tmp="${str%%:*}"
+        eval "$1=${tmp}"
+        str="${str#$tmp}"
+        str="${str#:}"
+        shift
+    done
+
+    return 0
+}
+
 setdebug() {
     if [ -z "$RDDEBUG" ]; then
         if [ -e /proc/cmdline ]; then
@@ -337,32 +388,104 @@ ip_to_var() {
     esac
 }
 
-# Evaluate command for UUIDs either given as arguments for this function or all
+# Create udev rule match for a device with its device name, or the udev property
+# ID_FS_UUID or ID_FS_LABEL
+#
+# example:
+#   udevmatch LABEL=boot
+# prints:
+#   ENV{ID_FS_LABEL}="boot"
+#
+# TOOD: symlinks
+udevmatch() {
+    case "$1" in
+    UUID=????????-????-????-????-????????????|LABEL=*)
+        printf 'ENV{ID_FS_%s}=="%s"' "${1%%=*}" "${1#*=}"
+        ;;
+    UUID=*)
+        printf 'ENV{ID_FS_UUID}=="%s*"' "${1#*=}"
+        ;;
+    /dev/?*) printf 'KERNEL=="%s"' "${1#/dev/}" ;;
+    *) return 255 ;;
+    esac
+}
+
+# Prints unique path for potential file inside specified directory.  It consists
+# of specified directory, prefix and number at the end which is incremented
+# until non-existing file is found.
+#
+# funiq dir prefix
+#
+# example:
+# # ls /mnt
+# cdrom0 cdrom1
+#
+# # funiq /mnt cdrom
+# /mnt/cdrom2
+funiq() {
+    local dir="$1"; local prefix="$2"
+    local i=0
+
+    [ -d "${dir}" ] || return 1
+
+    while [ -e "${dir}/${prefix}$i" ]; do
+        i=$(($i+1)) || return 1
+    done
+
+    echo "${dir}/${prefix}$i"
+}
+
+# Creates unique directory and prints its path.  It's using funiq to generate
+# path.
+#
+# mkuniqdir subdir new_dir_name
+mkuniqdir() {
+    local dir="$1"; local prefix="$2"
+    local retdir; local retdir_new
+
+    [ -d "${dir}" ] || mkdir -p "${dir}" || return 1
+
+    retdir=$(funiq "${dir}" "${prefix}") || return 1
+    until mkdir "${retdir}" 2>/dev/null; do
+        retdir_new=$(funiq "${dir}" "${prefix}") || return 1
+        [ "$retdir_new" = "$retdir" ] && return 1
+        retdir="$retdir_new"
+    done
+
+    echo "${retdir}"
+}
+
+# Evaluates command for UUIDs either given as arguments for this function or all
 # listed in /dev/disk/by-uuid.  UUIDs doesn't have to be fully specified.  If
-# beginning is given it is expanded to all matching UUIDs.  To pass full UUID
-# to your command use '${full_uuid}'.  Remember to escape '$'!
+# beginning is given it is expanded to all matching UUIDs.  To pass full UUID to
+# your command use '$___' as a place holder.  Remember to escape '$'!
+#
+# foreach_uuid_until [ -p prefix ] command UUIDs
 #
-# $1 = command to be evaluated
-# $2 = list of UUIDs separated by space
+# prefix - string to put just before $___
+# command - command to be evaluated
+# UUIDs - list of UUIDs separated by space
 #
 # The function returns after *first successful evaluation* of the given command
 # with status 0.  If evaluation fails for every UUID function returns with
 # status 1.
 #
 # Example:
-# foreach_uuid_until "mount -U \${full_uuid} /mnt; echo OK; umount /mnt" \
+# foreach_uuid_until "mount -U \$___ /mnt; echo OK; umount /mnt" \
 #       "01234 f512 a235567f-12a3-c123-a1b1-01234567abcb"
 foreach_uuid_until() (
     cd /dev/disk/by-uuid
 
+    [ "$1" = -p ] && local prefix="$2" && shift 2
     local cmd="$1"; shift; local uuids_list="$*"
-    local uuid; local full_uuid
+    local uuid; local full_uuid; local ___
 
     [ -n "${cmd}" ] || return 1
 
     for uuid in ${uuids_list:-*}; do
         for full_uuid in ${uuid}*; do
             [ -e "${full_uuid}" ] || continue
+            ___="${prefix}${full_uuid}"
             eval ${cmd} && return 0
         done
     done
Signature · 1 line
1.7.3.2
#2 lore raw

PATCH 2/3 90crypt: probe for keydev asynchronously; changed kernel arg

In reply to a message not in the archive

New kernel argument syntax for LUKS-keydev is introduced:

rd.luks.key=<key_path>[:<key_dev>[:<luks_dev>]]

Unfolding <key_dev> in BNF:

<key_dev> ::= "UUID=" <uuid> | "LABEL=" <label> | <kname>

Where <kname> matches following regular expression:

^/dev/.*

<kname> need to be a character device and not a symlink for now.

For every rd.luks.key argument udev rule is created. That rule runs test to check whether matching device contains <key_path>. If it does it's applied to matching <luks_dev>.

---
 modules.d/90crypt/crypt-lib.sh     |  119 ++++++++++++++++++++++++++++++++++++
 modules.d/90crypt/cryptroot-ask.sh |   79 ++++++------------------
 modules.d/90crypt/install          |    5 ++
 modules.d/90crypt/parse-crypt.sh   |    8 +--
 modules.d/90crypt/parse-keydev.sh  |   41 ++++++++++++
 modules.d/90crypt/probe-keydev.sh  |   15 +++++
 6 files changed, 201 insertions(+), 66 deletions(-)
 create mode 100644 modules.d/90crypt/crypt-lib.sh
 create mode 100644 modules.d/90crypt/parse-keydev.sh
 create mode 100755 modules.d/90crypt/probe-keydev.sh
modules.d/90crypt/crypt-lib.sh new file +119 -0
new file mode 100644
index 0000000..eee60fb
@@ -0,0 +1,119 @@
+#!/bin/sh
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+
+. /lib/dracut-lib.sh
+
+# Try to mount specified device (by path, by UUID or by label) and check
+# the path with 'test'.
+#
+# example:
+# test_dev -f LABEL="nice label" /some/file1
+test_dev() {
+    local test_op=$1; local dev="$2"; local f="$3"
+    local ret=1; local mount_point=$(mkuniqdir /mnt testdev)
+    local path
+
+    [ -n "$dev" -a -n "$*" ] || return 1
+    [ -d "$mount_point" ] || die 'Mount point does not exist!'
+
+    if mount -r "$dev" "$mount_point" >/dev/null 2>&1; then
+        test $test_op "${mount_point}/${f}"
+        ret=$?
+        umount "$mount_point"
+    fi
+
+    rmdir "$mount_point"
+
+    return $ret
+}
+
+# Get kernel name for given device.  Device may be the name too (then the same
+# is returned), a symlink (full path), UUID (prefixed with "UUID=") or label
+# (prefixed with "LABEL=").  If just a beginning of the UUID is specified or
+# even an empty, function prints all device names which UUIDs match - every in
+# single line.
+#
+# NOTICE: The name starts with "/dev/".
+#
+# Example:
+#   devnames UUID=123
+# May print:
+#   /dev/dm-1
+#   /dev/sdb1
+#   /dev/sdf3
+devnames() {
+    local dev="$1"; local d; local names
+
+    case "$dev" in
+    UUID=*)
+        dev="$(foreach_uuid_until '! blkid -U $___' "${dev#UUID=}")" \
+            && return 255
+        [ -z "$dev" ] && return 255
+        ;;
+    LABEL=*) dev="$(blkid -L "${dev#LABEL=}")" || return 255 ;;
+    /dev/?*) ;;
+    *) return 255 ;;
+    esac
+
+    for d in $dev; do
+        names="$names
+$(readlink -e -q "$d")" || return 255
+    done
+
+    echo "${names#
+}"
+}
+
+# match_dev devpattern dev
+#
+# Returns true if 'dev' matches 'devpattern'.  Both 'devpattern' and 'dev' are
+# expanded to kernel names and then compared.  If name of 'dev' is on list of
+# names of devices matching 'devpattern', the test is positive.  'dev' and
+# 'devpattern' may be anything which function 'devnames' recognizes.
+#
+# If 'devpattern' is empty or '*' then function just returns true.
+#
+# Example:
+#   match_dev UUID=123 /dev/dm-1
+# Returns true if /dev/dm-1 UUID starts with "123".
+match_dev() {
+    [ -z "$1" -o "$1" = '*' ] && return 0
+    local devlist; local dev
+
+    devlist="$(devnames "$1")" || return 255
+    dev="$(devnames "$2")" || return 255
+
+    strstr "
+$devlist
+" "
+$dev
+"
+}
+
+# getkey keysfile for_dev
+#
+# Reads file <keysfile> produced by probe-keydev and looks for first line to
+# which device <for_dev> matches.  The successful result is printed in format
+# "<keydev>|<keypath>".  When nothing found, just false is returned.
+#
+# Example:
+#   getkey /tmp/luks.keys /dev/sdb1
+# May print:
+#   /dev/sdc1|/keys/some.key
+getkey() {
+    local keys_file="$1"; local for_dev="$2"
+    local luks_dev; local key_dev; local key_path
+
+    [ -z "$keys_file" -o -z "$for_dev" ] && die 'getkey: wrong usage!'
+    [ -f "$keys_file" ] || return 1
+
+    while IFS='|' read luks_dev key_dev key_path; do
+        if match_dev "$luks_dev" "$for_dev"; then
+            echo "${key_dev}|${key_path}"
+            return 0
+        fi
+    done < "$keys_file"
+
+    return 1
+}
modules.d/90crypt/cryptroot-ask.sh +19 -60

104 lines not on this page · raw message

modules.d/90crypt/install +5 -0
index a518bc3..12b3555 100755
@@ -2,7 +2,12 @@
 # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
 # ex: ts=8 sw=4 sts=4 et filetype=sh
 inst cryptsetup 
+inst rmdir
+inst readlink
 inst "$moddir"/cryptroot-ask.sh /sbin/cryptroot-ask
+inst "$moddir"/probe-keydev.sh /sbin/probe-keydev
+inst_hook cmdline 10 "$moddir/parse-keydev.sh"
 inst_hook cmdline 30 "$moddir/parse-crypt.sh"
 inst_hook pre-pivot 30 "$moddir/crypt-cleanup.sh"
 inst /etc/crypttab
+inst "$moddir/crypt-lib.sh" "/lib/dracut-crypt-lib.sh"
modules.d/90crypt/parse-crypt.sh +2 -6
index 3baad5f..0dca0d3 100755
@@ -11,10 +11,6 @@ else
     } > /etc/udev/rules.d/70-luks.rules
 
     LUKS=$(getargs rd.luks.uuid rd_LUKS_UUID)
-    unset settled
-    [ -n "$(getargs rd.luks.keypath rd_LUKS_KEYPATH)" ] && \
-        [ -z "$(getargs rd.luks.keydev.uuid rd_LUKS_KEYDEV_UUID)" ] && \
-        settled='--settled'
 
     if [ -n "$LUKS" ]; then
         for luksid in $LUKS; do 
@@ -22,7 +18,7 @@ else
             {
                 printf 'ENV{ID_FS_TYPE}=="crypto_LUKS", '
                 printf 'ENV{ID_FS_UUID}=="*%s*", ' $luksid
-                printf 'RUN+="/sbin/initqueue --unique --onetime %s ' "$settled"
+                printf 'RUN+="/sbin/initqueue --unique --onetime '
                 printf -- '--name cryptroot-ask-%%k /sbin/cryptroot-ask '
                 printf '$env{DEVNAME} luks-$env{ID_FS_UUID}"\n'
             } >> /etc/udev/rules.d/70-luks.rules
@@ -35,7 +31,7 @@ else
             } >> /emergency/00-crypt.sh
         done
     else
-        echo 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="/sbin/initqueue' $settled \
+        echo 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="/sbin/initqueue' \
             '--unique --onetime --name cryptroot-ask-%k' \
             '/sbin/cryptroot-ask $env{DEVNAME} luks-$env{ID_FS_UUID}"' \
             >> /etc/udev/rules.d/70-luks.rules
modules.d/90crypt/parse-keydev.sh new file +41 -0

41 lines not on this page · raw message

modules.d/90crypt/probe-keydev.sh new file +15 -0
new file mode 100755
index 0000000..8fdbc1a
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+. /lib/dracut-crypt-lib.sh
+
+
+real_keydev="$1"; keypath="$2"; luksdev="$3"
+
+[ -z "$real_keydev" -o -z "$keypath" ] && die 'probe-keydev: wrong usage!'
+[ -z "$luksdev" ] && luksdev='*'
+
+info "Probing $real_keydev for $keypath..."
+test_dev -f "$real_keydev" "$keypath" || exit 1
+
+info "Found $keypath on $real_keydev"
+echo "$luksdev|$real_keydev|$keypath" >> /tmp/luks.keys
Signature · 1 line
1.7.3.2
#4 lore raw

PATCH 3/3 dracut.kernel.7: updated to latest changes in 90crypt

In reply to a message not in the archive
---
 dracut.kernel.7.xml |   23 +++++++++--------------
 1 files changed, 9 insertions(+), 14 deletions(-)
dracut.kernel.7.xml +9 -14
index 7f54e9e..bf517ea 100644
@@ -318,25 +318,20 @@ This parameter can be specified multiple times.</para>
       </variablelist>
     </refsect2>
     <refsect2>
-      <title>crypt LUKS - experimental removable keys support</title>
-      <para>works only when plymouth module is not included</para>
+      <title>crypto LUKS - key on removable device support</title>
       <variablelist>
         <varlistentry>
           <term>
-            <envar>rd.luks.keypath=</envar>
-            <replaceable>&lt;path to keyfile&gt;</replaceable>
+            <envar>rd.luks.key=</envar>
+	    <replaceable>&lt;keypath&gt;:&lt;keydev&gt;:&lt;luksdev&gt;</replaceable>
           </term>
           <listitem>
-            <para>path to keyfile inside remove device filesystem</para>
-          </listitem>
-        </varlistentry>
-        <varlistentry>
-          <term>
-            <envar>rd.luks.keydev.uuid=</envar>
-            <replaceable>&lt;rem. device uuid&gt;</replaceable>
-          </term>
-          <listitem>
-            <para>UUID of removalbe device storing keyfile; UUID doesn&apos;t have to be exact just like for <envar>rd.luks.uuid</envar></para>
+		  <para><replaceable>keypath</replaceable> is a path to key file to look for. It's REQUIRED.</para>
+		  <para><replaceable>keydev</replaceable> is a device on which key file resides. It might be kernel name of devices (should start with "/dev/"), UUID (prefixed with "UUID=") or label (prefix with "LABEL=").  You don't have to specify full UUID. Just its beginning will suffice, even if its ambiguous. All matching devices will be probed. This parameter is recommended, but not required. If not present, all block devices will be probed, which may significantly increase boot time.</para>
+		  <para>If <replaceable>luksdev</replaceable> is given, the specified key will only be applied for that LUKS device. Possible values are the same as for <replaceable>keydev</replaceable>. Unless you have several LUKS devices, you don't have to specify this parameter.</para>
+		  <para>The simplest usage is:</para>
+		  <programlisting>rd.luks.key=/foo/bar.key</programlisting>
+		  <para>As you see, you can skip colons in such case.</para>
           </listitem>
         </varlistentry>
       </variablelist>
Signature · 1 line
1.7.3.2
#11 lore raw
In reply to a message not in the archive

Am 12.11.2010 10:21, schrieb Amadeusz Żołnowski:

Quoted 184 lines

New:
str_starts, str_replace
funiq - print new unique file name
mkuniqdir - create and print new unique dir
splitsep - splits given string 'str' with separator 'sep' into vars udevmatch - create udev rule match for a device

Modified:
foreach_uuid_until - use $___ as a place holder

---
  modules.d/99base/dracut-lib.sh |  137 +++++++++++++++++++++++++++++++++++++--
  1 files changed, 130 insertions(+), 7 deletions(-)
modules.d/99base/dracut-lib.sh +129 -7
index 596dae2..f0c030b 100755
@@ -6,6 +6,29 @@ strstr() {
      [ "${1#*$2*}" != "$1" ]
  }
 
+# returns OK if $1 contains $2 at the beginning
+str_starts() {
+    [ "${1#$2*}" != "$1" ]
+}
+
+# replaces all occurrences of 'search' in 'str' with 'replacement'
+#
+# str_replace str search replacement
+#
+# example:
+# str_replace '  one two  three  ' ' ' '_'
+str_replace() {
+    local in="$1"; local s="$2"; local r="$3"
+    local out=''
+
+    while strstr "${in}" "$s"; do
+        chop="${in%%$s*}"
+        out="${out}${chop# }$r"
+        in="${in#*$s}"
+    done
+    echo "${out}${in}"
+}
+
  _getcmdline() {
      local _line
      unset _line
@@ -142,6 +165,34 @@ getoptcomma() {
      return 1
  }
 
+# Splits given string 'str' with separator 'sep' into variables 'var1', 'var2',
+# 'varN'.  If number of fields is less than number of variables, remaining are
+# not set.  If number of fields is greater than number of variables, the last
+# variable takes remaining fields.  In short - it acts similary to 'read'.
+#
+# splitsep sep str var1 var2 varN
+#
+# example:
+#   splitsep ':' 'foo:bar:baz' v1 v2
+# in result:
+#   v1='foo', v2='bar:baz'
+#
+# TODO: ':' inside fields.
+splitsep() {
+    local sep="$1"; local str="$2"; shift 2
+    local tmp
+
+    while [ -n "$str" -a -n "$*" ]; do
+        tmp="${str%%:*}"
+        eval "$1=${tmp}"
+        str="${str#$tmp}"
+        str="${str#:}"
+        shift
+    done
+
+    return 0
+}
+
  setdebug() {
      if [ -z "$RDDEBUG" ]; then
          if [ -e /proc/cmdline ]; then
@@ -337,32 +388,104 @@ ip_to_var() {
      esac
  }
 
-# Evaluate command for UUIDs either given as arguments for this function or all
+# Create udev rule match for a device with its device name, or the udev property
+# ID_FS_UUID or ID_FS_LABEL
+#
+# example:
+#   udevmatch LABEL=boot
+# prints:
+#   ENV{ID_FS_LABEL}="boot"
+#
+# TOOD: symlinks
+udevmatch() {
+    case "$1" in
+    UUID=????????-????-????-????-????????????|LABEL=*)
+        printf 'ENV{ID_FS_%s}=="%s"' "${1%%=*}" "${1#*=}"
+        ;;
+    UUID=*)
+        printf 'ENV{ID_FS_UUID}=="%s*"' "${1#*=}"
+        ;;
+    /dev/?*) printf 'KERNEL=="%s"' "${1#/dev/}" ;;
+    *) return 255 ;;
+    esac
+}
+
+# Prints unique path for potential file inside specified directory.  It consists
+# of specified directory, prefix and number at the end which is incremented
+# until non-existing file is found.
+#
+# funiq dir prefix
+#
+# example:
+# # ls /mnt
+# cdrom0 cdrom1
+#
+# # funiq /mnt cdrom
+# /mnt/cdrom2
+funiq() {
+    local dir="$1"; local prefix="$2"
+    local i=0
+
+    [ -d "${dir}" ] || return 1
+
+    while [ -e "${dir}/${prefix}$i" ]; do
+        i=$(($i+1)) || return 1
+    done
+
+    echo "${dir}/${prefix}$i"
+}
+
+# Creates unique directory and prints its path.  It's using funiq to generate
+# path.
+#
+# mkuniqdir subdir new_dir_name
+mkuniqdir() {
+    local dir="$1"; local prefix="$2"
+    local retdir; local retdir_new
+
+    [ -d "${dir}" ] || mkdir -p "${dir}" || return 1
+
+    retdir=$(funiq "${dir}" "${prefix}") || return 1
+    until mkdir "${retdir}" 2>/dev/null; do
+        retdir_new=$(funiq "${dir}" "${prefix}") || return 1
+        [ "$retdir_new" = "$retdir" ]&&  return 1
+        retdir="$retdir_new"
+    done
+
+    echo "${retdir}"
+}
+
+# Evaluates command for UUIDs either given as arguments for this function or all
  # listed in /dev/disk/by-uuid.  UUIDs doesn't have to be fully specified.  If
-# beginning is given it is expanded to all matching UUIDs.  To pass full UUID
-# to your command use '${full_uuid}'.  Remember to escape '$'!
+# beginning is given it is expanded to all matching UUIDs.  To pass full UUID to
+# your command use '$___' as a place holder.  Remember to escape '$'!
+#
+# foreach_uuid_until [ -p prefix ] command UUIDs
  #
-# $1 = command to be evaluated
-# $2 = list of UUIDs separated by space
+# prefix - string to put just before $___
+# command - command to be evaluated
+# UUIDs - list of UUIDs separated by space
  #
  # The function returns after *first successful evaluation* of the given command
  # with status 0.  If evaluation fails for every UUID function returns with
  # status 1.
  #
  # Example:
-# foreach_uuid_until "mount -U \${full_uuid} /mnt; echo OK; umount /mnt" \
+# foreach_uuid_until "mount -U \$___ /mnt; echo OK; umount /mnt" \
  #       "01234 f512 a235567f-12a3-c123-a1b1-01234567abcb"
  foreach_uuid_until() (
      cd /dev/disk/by-uuid
 
+    [ "$1" = -p ]&&  local prefix="$2"&&  shift 2
      local cmd="$1"; shift; local uuids_list="$*"
-    local uuid; local full_uuid
+    local uuid; local full_uuid; local ___

modules.d/99base/dracut-lib.sh ip_to_var() { · line 491

Quoted 10 lines
modules.d/99base/dracut-lib.sh +1 -0
 
      [ -n "${cmd}" ] || return 1
 
      for uuid in ${uuids_list:-*}; do
          for full_uuid in ${uuid}*; do
              [ -e "${full_uuid}" ] || continue
+            ___="${prefix}${full_uuid}"
              eval ${cmd}&&  return 0
          done
      done

pushed all three

#5 lore raw

Re: [PATCH 2/3] 90crypt: probe for keydev asynchronously; changed kernel arg

In reply to a message not in the archive

2010/11/12 Amadeusz ¯o³nowski <[email protected]>:
[...]

Quoted 1 line
modules.d/90crypt/cryptroot-ask.sh +0 -0

[...]

Quoted 1 line

 inst "$moddir"/cryptroot-ask.sh /sbin/cryptroot-ask

As you are currently working on it, could you look into making cryptroot coexist with plymouth? Currently they fight for /sbin/cryptroot-ask; I thought about adding minimal plugin support (i.e. something like /cryptroot-ask.d where modules can drop their implementation; they will be tried is sequence until some succeeds). Then /sbin/cryptroot-ask could be moved to base and be simple wrapper around this directory.

Unfortunately I do not currently have ready-to-use infrastructure to test this implementation.

#7 lore raw

Re: [PATCH 2/3] 90crypt: probe for keydev asynchronously; changed kernel arg

In reply to a message not in the archive

Excerpts from Andrey Borzenkov's message of Sat Nov 13 09:50:54 +0100 2010:

Quoted 14 lines

2010/11/12 Amadeusz Żołnowski <[email protected]>:
[...]

Quoted 1 line
modules.d/90crypt/cryptroot-ask.sh +0 -0

[...]

Quoted 1 line

 inst "$moddir"/cryptroot-ask.sh /sbin/cryptroot-ask

As you are currently working on it, could you look into making cryptroot coexist with plymouth? Currently they fight for /sbin/cryptroot-ask; I thought about adding minimal plugin support (i.e. something like /cryptroot-ask.d where modules can drop their implementation; they will be tried is sequence until some succeeds). Then /sbin/cryptroot-ask could be moved to base and be simple wrapper around this directory.

Quoted 2 lines

Unfortunately I do not currently have ready-to-use infrastructure to test this implementation.

OK. Thanks for reporting that. Matt Smith has already merged cryptroot-ask from plymouth to crypt module and it worked well until that my new patch. I'll try to fix the problem.
--
Amadeusz Żołnowski

PGP key fpr: C700 CEDE 0C18 212E 49DA 4653 F013 4531 E1DB FAB5

#8 lore raw

Re: [PATCH 2/3] 90crypt: probe for keydev asynchronously; changed kernel arg

2010/11/15 Amadeusz Żołnowski <[email protected]>:

Quoted 15 lines

Excerpts from Andrey Borzenkov's message of Sat Nov 13 09:50:54 +0100 2010:

Quoted 14 lines

2010/11/12 Amadeusz Żołnowski <[email protected]>:
[...]

Quoted 1 line
modules.d/90crypt/cryptroot-ask.sh +0 -0

[...]

Quoted 1 line

 inst "$moddir"/cryptroot-ask.sh /sbin/cryptroot-ask

As you are currently working on it, could you look into making cryptroot coexist with plymouth? Currently they fight for /sbin/cryptroot-ask; I thought about adding minimal plugin support (i.e. something like /cryptroot-ask.d where modules can drop their implementation; they will be tried is sequence until some succeeds). Then /sbin/cryptroot-ask could be moved to base and be simple wrapper around this directory.

Quoted 6 lines
Quoted 2 lines

Unfortunately I do not currently have ready-to-use infrastructure to test this implementation.

OK.  Thanks for reporting that.  Matt Smith has already merged cryptroot-ask from plymouth to crypt module and it worked well until that my new patch.  I'll try to fix the problem.

Actually I missed this patch, sorry. I'm still not sure how it behaves if plymouth binary is available but plymouthd itself is not active/not showing splash.

#10 lore raw

Re: [PATCH 2/3] 90crypt: probe for keydev asynchronously; changed kernel arg

In reply to a message not in the archive

Excerpts from Andrey Borzenkov's message of Mon Nov 15 17:50:50 +0100 2010:

Quoted 19 lines

2010/11/15 Amadeusz Żołnowski <[email protected]>:

Quoted 18 lines

Excerpts from Andrey Borzenkov's message of Sat Nov 13 09:50:54 +0100 2010:

Quoted 16 lines

2010/11/12 Amadeusz Żołnowski <[email protected]>:
[...]

Quoted 1 line
modules.d/90crypt/cryptroot-ask.sh +0 -0

[...]

Quoted 1 line

 inst "$moddir"/cryptroot-ask.sh /sbin/cryptroot-ask

As you are currently working on it, could you look into making cryptroot coexist with plymouth? Currently they fight for /sbin/cryptroot-ask; I thought about adding minimal plugin support (i.e. something like /cryptroot-ask.d where modules can drop their implementation; they will be tried is sequence until some succeeds). Then /sbin/cryptroot-ask could be moved to base and be simple wrapper around this directory.

Unfortunately I do not currently have ready-to-use infrastructure to test this implementation.

Quoted 7 lines
Quoted 3 lines

OK.  Thanks for reporting that.  Matt Smith has already merged cryptroot-ask from plymouth to crypt module and it worked well until that my new patch.  I'll try to fix the problem.

Actually I missed this patch, sorry. I'm still not sure how it behaves if plymouth binary is available but plymouthd itself is not active/not showing splash.

Just look at the commit 7254c24a76d5f5afe4168d513a00756dc85cb460.

Even with my new patch splash shows up. The problem which appears with my patch is that when you do rdbreak, boot process terminates as it should, drops to shell and… console hangs (the last is the "feature" which appears with keydev; I'll investigate on it as soon as will have some time).
--
Amadeusz Żołnowski

PGP key fpr: C700 CEDE 0C18 212E 49DA 4653 F013 4531 E1DB FAB5