Magellan Linux

Annotation of /trunk/dracut/patches/dracut-010-11git.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1353 - (hide annotations) (download)
Sat Jun 4 14:33:55 2011 UTC (12 years, 11 months ago) by niro
File size: 293736 byte(s)
-added dracut patches against dracur-011_pre from git 0e6a94b3290f2eebe26bc7fa99130704acfeeae8
1 niro 1353 diff -Naur dracut-010/dracut dracut-0e6a94b/dracut
2     --- dracut-010/dracut 2011-03-31 19:50:31.000000000 +0200
3     +++ dracut-0e6a94b/dracut 2011-05-31 16:34:37.000000000 +0200
4     @@ -1,7 +1,7 @@
5     #!/bin/bash
6     # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
7     # ex: ts=8 sw=4 sts=4 et filetype=sh
8     -#
9     +#
10     # Generator script for a dracut initramfs
11     # Tries to retain some degree of compatibility with the command line
12     # of the various mkinitrd implementations out there
13     @@ -40,19 +40,21 @@
14     -a, --add [LIST] Add a space-separated list of dracut modules.
15     -d, --drivers [LIST] Specify a space-separated list of kernel modules to
16     exclusively include in the initramfs.
17     - --add-drivers [LIST] Specify a space-separated list of kernel
18     + --add-drivers [LIST] Specify a space-separated list of kernel
19     modules to add to the initramfs.
20     --filesystems [LIST] Specify a space-separated list of kernel filesystem
21     modules to exclusively include in the generic
22     initramfs.
23     - -k, --kmoddir [DIR] Specify the directory, where to look for kernel
24     + -k, --kmoddir [DIR] Specify the directory, where to look for kernel
25     modules
26     - --fwdir [DIR] Specify additional directories, where to look for
27     + --fwdir [DIR] Specify additional directories, where to look for
28     firmwares, separated by :
29     --kernel-only Only install kernel drivers and firmware files
30     --no-kernel Do not install kernel drivers and firmware files
31     --strip Strip binaries in the initramfs
32     --nostrip Do not strip binaries in the initramfs (default)
33     + --prefix [DIR] Prefix initramfs files with [DIR]
34     + --noprefix Do not prefix initramfs files (default)
35     --mdadmconf Include local /etc/mdadm.conf
36     --nomdadmconf Do not include local /etc/mdadm.conf
37     --lvmconf Include local /etc/lvm/lvm.conf
38     @@ -71,7 +73,7 @@
39     -q, --quiet Decrease verbosity level (default is info(4))
40     -c, --conf [FILE] Specify configuration file to use.
41     Default: /etc/dracut.conf
42     - --confdir [DIR] Specify configuration directory to use *.conf files
43     + --confdir [DIR] Specify configuration directory to use *.conf files
44     from. Default: /etc/dracut.conf.d
45     -l, --local Local mode. Use modules from the current working
46     directory instead of the system-wide installed in
47     @@ -83,7 +85,7 @@
48     -i, --include [SOURCE] [TARGET]
49     Include the files in the SOURCE directory into the
50     Target directory in the final initramfs.
51     - If SOURCE is a file, it will be installed to TARGET
52     + If SOURCE is a file, it will be installed to TARGET
53     in the final initramfs.
54     -I, --install [LIST] Install the space separated list of files into the
55     initramfs.
56     @@ -94,20 +96,21 @@
57     Make sure your kernel has bzip2 decompression support
58     compiled in, otherwise you will not be able to boot.
59     --lzma Compress the generated initramfs using lzma.
60     - Make sure your kernel has lzma support compiled in,
61     + Make sure your kernel has lzma support compiled in,
62     otherwise you will not be able to boot.
63     --xz Compress the generated initramfs using xz.
64     Make sure that your kernel has xz support compiled
65     in, otherwise you will not be able to boot.
66     --compress [COMPRESSION] Compress the generated initramfs with the
67     passed compression program. Make sure your kernel
68     - knows how to decompress the generated initramfs,
69     + knows how to decompress the generated initramfs,
70     otherwise you will not be able to boot.
71     --no-compress Do not compress the generated initramfs. This will
72     override any other compression options.
73     --list-modules List all available dracut modules.
74     -M, --show-modules Print included module's name to standard output during
75     build.
76     + --keep Keep the temporary initramfs for debugging purposes
77     EOF
78     }
79    
80     @@ -135,7 +138,7 @@
81     # val=$(pop stack)
82     pop() {
83     local __stack=$1; shift
84     - local __resultvar=$1
85     + local __resultvar=$1
86     local myresult;
87     # check for empty stack
88     eval '[[ ${#'${__stack}'[@]} -eq 0 ]] && return 1'
89     @@ -206,11 +209,13 @@
90     -I|--install) read_arg install_items "$@" || shift;;
91     --fwdir) read_arg fw_dir_l "$@" || shift;;
92     --compress) read_arg compress_l "$@" || shift;;
93     + --prefix) read_arg prefix_l "$@" || shift;;
94     -f|--force) force=yes;;
95     --kernel-only) kernel_only="yes"; no_kernel="no";;
96     --no-kernel) kernel_only="no"; no_kernel="yes";;
97     --strip) do_strip_l="yes";;
98     --nostrip) do_strip_l="no";;
99     + --noprefix) prefix_l="/";;
100     --mdadmconf) mdadmconf_l="yes";;
101     --nomdadmconf) mdadmconf_l="no";;
102     --lvmconf) lvmconf_l="yes";;
103     @@ -236,8 +241,9 @@
104     -M|--show-modules)
105     show_modules_l="yes"
106     ;;
107     + --keep) keep="yes";;
108     -*) printf "\nUnknown option: %s\n\n" "$1" >&2; usage; exit 1;;
109     - *)
110     + *)
111     if ! [[ ${outfile+x} ]]; then
112     outfile=$1
113     elif ! [[ ${kernel+x} ]]; then
114     @@ -257,7 +263,7 @@
115     PATH=/sbin:/bin:/usr/sbin:/usr/bin
116     export PATH
117    
118     -[[ $debug ]] && {
119     +[[ $debug ]] && {
120     export PS4='${BASH_SOURCE}@${LINENO}(${FUNCNAME[0]}): ';
121     set -x
122     }
123     @@ -265,7 +271,7 @@
124     [[ $dracutbasedir ]] || dracutbasedir=/usr/share/dracut
125    
126     [[ $allowlocal && -f "$(readlink -f ${0%/*})/dracut-functions" ]] && \
127     - dracutbasedir="$(readlink -f ${0%/*})"
128     + dracutbasedir="$(readlink -f ${0%/*})"
129    
130     # if we were not passed a config file, try the default one
131     if [[ ! -f $conffile ]]; then
132     @@ -283,7 +289,7 @@
133    
134     # source our config dir
135     if [[ $confdir && -d $confdir ]]; then
136     - for f in "$confdir"/*.conf; do
137     + for f in "$confdir"/*.conf; do
138     [[ -e $f ]] && . "$f"
139     done
140     fi
141     @@ -345,6 +351,8 @@
142    
143     [[ $drivers_dir_l ]] && drivers_dir=$drivers_dir_l
144     [[ $do_strip_l ]] && do_strip=$do_strip_l
145     +[[ $prefix_l ]] && prefix=$prefix_l
146     +[[ $prefix = "/" ]] && unset prefix
147     [[ $hostonly_l ]] && hostonly=$hostonly_l
148     [[ $use_fstab_l ]] && use_fstab=$use_fstab_l
149     [[ $mdadmconf_l ]] && mdadmconf=$mdadmconf_l
150     @@ -358,11 +366,12 @@
151     fw_dir=${fw_dir//:/ }
152    
153     # handle compression options.
154     +[[ $compress ]] || compress="gzip"
155     case $compress in
156     - bzip2) compress="bzip -9";;
157     + bzip2) compress="bzip2 -9";;
158     lzma) compress="lzma -9";;
159     xz) compress="xz --check=crc32 --lzma2=dict=1MiB";;
160     - gzip) type pigz > /dev/null 2>&1 && compress="pigz -9" || \
161     + gzip) command -v pigz > /dev/null 2>&1 && compress="pigz -9" || \
162     compress="gzip -9";;
163     esac
164     if [[ $_no_compress_l = "cat" ]]; then
165     @@ -371,7 +380,6 @@
166    
167     [[ $hostonly = yes ]] && hostonly="-h"
168     [[ $hostonly != "-h" ]] && unset hostonly
169     -[[ $compress ]] || compress="gzip -9"
170    
171     if [[ -f $dracutbasedir/dracut-functions ]]; then
172     . $dracutbasedir/dracut-functions
173     @@ -445,13 +453,13 @@
174     exit 1
175     fi
176    
177     -[[ $TMPDIR && ! -w $TMPDIR ]] && unset TMPDIR
178     -readonly initdir=$(mktemp -d -t initramfs.XXXXXX)
179     +readonly TMPDIR=/var/tmp
180     +readonly initdir=$(mktemp --tmpdir=/var/tmp/ -d -t initramfs.XXXXXX)
181    
182     # clean up after ourselves no matter how we die.
183     -trap 'ret=$?;rm -rf "$initdir";exit $ret;' EXIT
184     +trap 'ret=$?;[[ $keep ]] && echo "Not removing $initdir." >&2 || rm -rf "$initdir";exit $ret;' EXIT
185     # clean up after ourselves no matter how we die.
186     -trap 'exit 1;' SIGINT
187     +trap 'exit 1;' SIGINT
188    
189     # Need to be able to have non-root users read stuff (rpcbind etc)
190     chmod 755 "$initdir"
191     @@ -463,33 +471,60 @@
192     stdloglvl sysloglvl fileloglvl kmsgloglvl logfile \
193     debug
194    
195     +# Create some directory structure first
196     +[[ $prefix ]] && mkdir -m 0755 -p "${initdir}${prefix}"
197     +
198     +[[ -h /lib ]] || mkdir -m 0755 -p "${initdir}${prefix}/lib"
199     +[[ $prefix ]] && ln -sfn "${prefix#/}/lib" "$initdir/lib"
200     +
201     +if [[ $prefix ]]; then
202     + for d in bin etc lib "$libdir" sbin tmp usr var; do
203     + ln -sfn "${prefix#/}/${d#/}" "$initdir/$d"
204     + done
205     +fi
206     +
207     if [[ $kernel_only != yes ]]; then
208     - # Create some directory structure first
209     - for d in bin sbin usr/bin usr/sbin usr/lib etc \
210     - proc sys sysroot tmp dev/pts var/run; do
211     - inst_dir "/$d";
212     + for d in bin etc lib "$libdir" sbin tmp usr var usr/bin usr/sbin; do
213     + [[ -e "${initdir}${prefix}/$d" ]] && continue
214     + if [ -h "/$d" ]; then
215     + inst "/$d" "${prefix}/$d"
216     + else
217     + mkdir -m 0755 -p "${initdir}${prefix}/$d"
218     + fi
219     + done
220     +
221     + for d in proc sys sysroot root run run/lock run/initramfs; do
222     + if [ -h "/$d" ]; then
223     + inst "/$d"
224     + else
225     + mkdir -m 0755 -p "$initdir/$d"
226     + fi
227     done
228     +
229     + ln -sfn /run "$initdir/var/run"
230     + ln -sfn /run/lock "$initdir/var/lock"
231     fi
232    
233     # check all our modules to see if they should be sourced.
234     # This builds a list of modules that we will install next.
235     check_module_dir
236     -
237     +modules_loaded=" "
238     # source our modules.
239     for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
240     - mod=${moddir##*/}; mod=${mod#[0-9][0-9]}
241     - if strstr "$mods_to_load" " $mod "; then
242     - [[ $show_modules = yes ]] && echo "$mod" || \
243     - dinfo "*** Including module: $mod ***"
244     + _d_mod=${moddir##*/}; _d_mod=${_d_mod#[0-9][0-9]}
245     + if strstr "$mods_to_load" " $_d_mod "; then
246     + [[ $show_modules = yes ]] && echo "$_d_mod" || \
247     + dinfo "*** Including module: $_d_mod ***"
248     if [[ $kernel_only = yes ]]; then
249     - module_installkernel $mod
250     + module_installkernel $_d_mod
251     else
252     - module_install $mod
253     + module_install $_d_mod
254     if [[ $no_kernel != yes ]]; then
255     - module_installkernel $mod
256     + module_installkernel $_d_mod
257     fi
258     fi
259     - mods_to_load=${mods_to_load// $mod /}
260     + mods_to_load=${mods_to_load// $_d_mod /}
261     + modules_loaded+="$_d_mod "
262     fi
263     done
264     unset moddir
265     @@ -511,7 +546,21 @@
266     else
267     ddebug "Including directory: $src"
268     mkdir -p "${initdir}/${tgt}"
269     - cp -a -t "${initdir}/${tgt}" "$src"/*
270     + # check for preexisting symlinks, so we can cope with the
271     + # symlinks to $prefix
272     + for i in "$src"/*; do
273     + [[ -e "$i" || -h "$i" ]] || continue
274     + s=${initdir}/${tgt}/${i#$src/}
275     + if [[ -d "$i" ]]; then
276     + if ! [[ -e "$s" ]]; then
277     + mkdir -m 0755 -p "$s"
278     + chmod --reference="$i" "$s"
279     + fi
280     + cp -a -t "$s" "$i"/*
281     + else
282     + cp -a -t "$s" "$i"
283     + fi
284     + done
285     fi
286     fi
287     done
288     @@ -523,13 +572,18 @@
289     done
290     unset item
291    
292     -# make sure that library links are correct and up to date
293     -dracut_install /etc/ld.so.conf /etc/ld.so.conf.d/*
294     -if ! ldconfig -r "$initdir"; then
295     - if [[ $UID = 0 ]]; then
296     - derror "ldconfig exited ungracefully"
297     - else
298     - derror "ldconfig might need uid=0 (root) for chroot()"
299     +
300     +if [[ $kernel_only != yes ]]; then
301     + # make sure that library links are correct and up to date
302     + for f in /etc/ld.so.conf /etc/ld.so.conf.d/*; do
303     + [[ -e $f ]] && dracut_install "$f"
304     + done
305     + if ! ldconfig -r "$initdir"; then
306     + if [[ $UID = 0 ]]; then
307     + derror "ldconfig exited ungracefully"
308     + else
309     + derror "ldconfig might need uid=0 (root) for chroot()"
310     + fi
311     fi
312     fi
313    
314     @@ -538,9 +592,9 @@
315     du -c "$initdir" | sort -n | ddebug
316     fi
317    
318     -# strip binaries
319     +# strip binaries
320     if [[ $do_strip = yes ]] ; then
321     - for p in strip grep find; do
322     + for p in strip grep find; do
323     if ! type -P $p >/dev/null; then
324     derror "Could not find '$p'. You should run $0 with '--nostrip'."
325     do_strip=no
326     @@ -561,11 +615,20 @@
327     hardlink "$initdir" 2>&1
328     }
329    
330     +if strstr "$modules_loaded" " fips " && command -v prelink >/dev/null; then
331     + for i in $initdir/bin/* \
332     + $initdir/bin/* \
333     + $initdir/usr/bin/* \
334     + $initdir/usr/sbin/*; do
335     + [ -x $i ] && prelink -u $i &>/dev/null
336     + done
337     +fi
338     +
339     if ! ( cd "$initdir"; find . |cpio -R 0:0 -H newc -o --quiet | \
340     - $compress > "$outfile"; ); then
341     + $compress > "$outfile"; ); then
342     dfatal "dracut: creation of $outfile failed"
343     exit 1
344     -fi
345     +fi
346    
347     dinfo "Wrote $outfile:"
348     dinfo "$(ls -l "$outfile")"
349     diff -Naur dracut-010/dracut.8.xml dracut-0e6a94b/dracut.8.xml
350     --- dracut-010/dracut.8.xml 2011-03-31 19:50:31.000000000 +0200
351     +++ dracut-0e6a94b/dracut.8.xml 2011-05-31 16:34:37.000000000 +0200
352     @@ -108,9 +108,9 @@
353     <option>--modules&nbsp;<replaceable>&lt;list of dracut modules&gt;</replaceable></option>
354     </term>
355     <listitem>
356     - <para>specify a space-separated list of dracut modules to call
357     -when building the initramfs.
358     -Modules are located in
359     + <para>specify a space-separated list of dracut modules to call
360     +when building the initramfs.
361     +Modules are located in
362     <filename>/usr/share/dracut/modules.d</filename>. This parameter can be specified multiple times.</para>
363     </listitem>
364     </varlistentry>
365     @@ -163,7 +163,7 @@
366     <option>--filesystems&nbsp;<replaceable>&lt;list of filesystems&gt;</replaceable></option>
367     </term>
368     <listitem>
369     - <para>specify a space-separated list of kernel filesystem modules to exclusively
370     + <para>specify a space-separated list of kernel filesystem modules to exclusively
371     include in the generic initramfs. This parameter can be specified multiple times.</para>
372     </listitem>
373     </varlistentry>
374     @@ -236,6 +236,22 @@
375     </varlistentry>
376     <varlistentry>
377     <term>
378     + <option>--prefix</option>
379     + </term>
380     + <listitem>
381     + <para>prefix initramfs files with /run/initramfs/</para>
382     + </listitem>
383     + </varlistentry>
384     + <varlistentry>
385     + <term>
386     + <option>--noprefix</option>
387     + </term>
388     + <listitem>
389     + <para>do not prefix initramfs files with /run/initramfs/ (default)</para>
390     + </listitem>
391     + </varlistentry>
392     + <varlistentry>
393     + <term>
394     <option>-h</option>
395     </term>
396     <term>
397     @@ -284,7 +300,7 @@
398     </term>
399     <listitem>
400     <para>specify configuration file to use.
401     -Default:
402     +Default:
403     <filename>/etc/dracut.conf</filename></para>
404     </listitem>
405     </varlistentry>
406     @@ -294,7 +310,7 @@
407     </term>
408     <listitem>
409     <para>specify configuration directory to use.
410     -Default:
411     +Default:
412     <filename>/etc/dracut.conf.d</filename></para>
413     </listitem>
414     </varlistentry>
415     @@ -320,8 +336,8 @@
416     <option>--hostonly</option>
417     </term>
418     <listitem>
419     - <para>Host-Only mode: Install only what is needed for booting
420     -the local host instead of a generic host.
421     + <para>Host-Only mode: Install only what is needed for booting
422     +the local host instead of a generic host.
423     <warning>
424     <para>If chrooted to another root other than the real root device, use &quot;--fstab&quot; and provide a valid <filename>/etc/fstab</filename>.</para>
425     </warning></para>
426     @@ -435,6 +451,14 @@
427     <para>Print included module's name to standard output during build.</para>
428     </listitem>
429     </varlistentry>
430     + <varlistentry>
431     + <term>
432     + <option>--keep</option>
433     + </term>
434     + <listitem>
435     + <para>Keep the initramfs temporary directory for debugging purposes.</para>
436     + </listitem>
437     + </varlistentry>
438     </variablelist>
439     </refsect2>
440     </refsect1>
441     @@ -489,7 +513,7 @@
442     </term>
443     <listitem>
444     <para>Any files found in <filename>/etc/conf.d/</filename> will be sourced in the initramfs to
445     -set initial values. Command line options will override these values
446     +set initial values. Command line options will override these values
447     set in the configuration files.</para>
448     </listitem>
449     </varlistentry>
450     @@ -507,7 +531,7 @@
451     <refsect1>
452     <title>Availability</title>
453     <para>The dracut command is part of the dracut package and is available from
454     -<ulink url="http://sourceforge.net/apps/trac/dracut/wiki">http://sourceforge.net/apps/trac/dracut/wiki</ulink></para>
455     +<ulink url='https://dracut.wiki.kernel.org'>https://dracut.wiki.kernel.org</ulink></para>
456     </refsect1>
457     <refsect1>
458     <title>See Also</title>
459     diff -Naur dracut-010/dracut-catimages dracut-0e6a94b/dracut-catimages
460     --- dracut-010/dracut-catimages 2011-03-31 19:50:31.000000000 +0200
461     +++ dracut-0e6a94b/dracut-catimages 2011-05-31 16:34:37.000000000 +0200
462     @@ -39,7 +39,7 @@
463     line and /boot/dracut/
464    
465     -f, --force Overwrite existing initramfs file.
466     - -i, --imagedir Directory with additional images to add
467     + -i, --imagedir Directory with additional images to add
468     (default: /boot/dracut/)
469     -o, --overlaydir Overlay directory, which contains files that
470     will be used to create an additional image
471     @@ -120,7 +120,7 @@
472     dinfo "Using base image $baseimage"
473     cat "$baseimage" > "$outfile"
474    
475     -for i in "${images[@]}"; do
476     +for i in "${images[@]}"; do
477     dinfo "Appending $i"
478     cat "$i" >> "$outfile"
479     done
480     diff -Naur dracut-010/dracut-catimages.8.xml dracut-0e6a94b/dracut-catimages.8.xml
481     --- dracut-010/dracut-catimages.8.xml 2011-03-31 19:50:31.000000000 +0200
482     +++ dracut-0e6a94b/dracut-catimages.8.xml 2011-05-31 16:34:37.000000000 +0200
483     @@ -67,7 +67,7 @@
484     <varlistentry>
485     <term><option>-h</option>, <option>--help</option></term>
486     <listitem>
487     -<para>display help text and exit.</para>
488     +<para>display help text and exit.</para>
489     </listitem>
490     </varlistentry>
491     <varlistentry>
492     @@ -105,7 +105,7 @@
493    
494     <refsect1 id='availability'><title>AVAILABILITY</title>
495     <para>The dracut-catimages command is part of the dracut package and is available from
496     -<ulink url='http://sourceforge.net/apps/trac/dracut/wiki'>http://sourceforge.net/apps/trac/dracut/wiki</ulink></para>
497     +<ulink url='https://dracut.wiki.kernel.org'>https://dracut.wiki.kernel.org</ulink></para>
498    
499     </refsect1>
500    
501     diff -Naur dracut-010/dracut.conf dracut-0e6a94b/dracut.conf
502     --- dracut-010/dracut.conf 2011-03-31 19:50:31.000000000 +0200
503     +++ dracut-0e6a94b/dracut.conf 2011-05-31 16:34:37.000000000 +0200
504     @@ -3,7 +3,9 @@
505     logfile=/var/log/dracut.log
506     fileloglvl=6
507    
508     -# Specific list of dracut modules to use
509     +# Exact list of dracut modules to use. Modules not listed here are not going
510     +# to be included. If you only want to add some optional modules use
511     +# add_dracutmodules option instead.
512     #dracutmodules+=""
513    
514     # Dracut modules to omit
515     diff -Naur dracut-010/dracut.conf.5.xml dracut-0e6a94b/dracut.conf.5.xml
516     --- dracut-010/dracut.conf.5.xml 2011-03-31 19:50:31.000000000 +0200
517     +++ dracut-0e6a94b/dracut.conf.5.xml 2011-05-31 16:34:37.000000000 +0200
518     @@ -79,7 +79,7 @@
519     <envar>add_drivers+=&quot;&nbsp;<replaceable>&lt;kernel modules&gt;</replaceable>&nbsp;&quot;</envar>
520     </term>
521     <listitem>
522     - <para>Specify a space-separated list of kernel
523     + <para>Specify a space-separated list of kernel
524     modules to add to the initramfs.
525     The kernel modules have to be specified without the &quot;.ko&quot; suffix.</para>
526     </listitem>
527     @@ -123,7 +123,7 @@
528     <envar>hostonly=&quot;<replaceable>{yes|no}</replaceable>&quot;</envar>
529     </term>
530     <listitem>
531     - <para>Host-Only mode: Install only what is needed for booting
532     + <para>Host-Only mode: Install only what is needed for booting
533     the local host instead of a generic host.
534     <warning><para>If chrooted to another root other than the real root device, use <option>--fstab</option> and provide a valid <filename>/etc/fstab</filename>.</para>
535     </warning>
536     diff -Naur dracut-010/dracut.conf.d/fedora.conf.example dracut-0e6a94b/dracut.conf.d/fedora.conf.example
537     --- dracut-010/dracut.conf.d/fedora.conf.example 2011-03-31 19:50:31.000000000 +0200
538     +++ dracut-0e6a94b/dracut.conf.d/fedora.conf.example 2011-05-31 16:34:37.000000000 +0200
539     @@ -1,7 +1,7 @@
540     -# /etc/dracut.conf.d/redhat.conf
541     # Dracut config file customized for RedHat/Fedora.
542    
543     # i18n
544     i18n_vars="/etc/sysconfig/keyboard:KEYTABLE-KEYMAP /etc/sysconfig/i18n:SYSFONT-FONT,FONTACM-FONT_MAP,FONT_UNIMAP"
545     -add_dracutmodules+=" rpmversion "
546     +add_dracutmodules+=" rpmversion shutdown "
547     stdloglvl=3
548     +prefix=/run/initramfs
549     diff -Naur dracut-010/dracut-functions dracut-0e6a94b/dracut-functions
550     --- dracut-010/dracut-functions 2011-03-31 19:50:31.000000000 +0200
551     +++ dracut-0e6a94b/dracut-functions 2011-05-31 16:34:37.000000000 +0200
552     @@ -32,9 +32,6 @@
553     dlog_init
554     fi
555    
556     -IF_RTLD=""
557     -IF_dynamic=""
558     -
559     # Generic substring function. If $2 is in $1, return 0.
560     strstr() { [[ $1 =~ $2 ]]; }
561    
562     @@ -47,25 +44,25 @@
563     # $2 = comparision op (gt, ge, eq, le, lt, ne)
564     # $3 = version b
565     vercmp() {
566     - local n1=(${1//./ }) op=$2 n2=(${3//./ }) i res
567     + local _n1=(${1//./ }) _op=$2 _n2=(${3//./ }) _i _res
568    
569     - for ((i=0; ; i++))
570     + for ((_i=0; ; _i++))
571     do
572     - if [[ ! ${n1[i]}${n2[i]} ]]; then res=0
573     - elif ((${n1[i]:-0} > ${n2[i]:-0})); then res=1
574     - elif ((${n1[i]:-0} < ${n2[i]:-0})); then res=2
575     + if [[ ! ${_n1[_i]}${_n2[_i]} ]]; then _res=0
576     + elif ((${_n1[_i]:-0} > ${_n2[_i]:-0})); then _res=1
577     + elif ((${_n1[_i]:-0} < ${_n2[_i]:-0})); then _res=2
578     else continue
579     fi
580     break
581     done
582    
583     - case $op in
584     - gt) ((res == 1));;
585     - ge) ((res != 2));;
586     - eq) ((res == 0));;
587     - le) ((res != 1));;
588     - lt) ((res == 2));;
589     - ne) ((res != 0));;
590     + case $_op in
591     + gt) ((_res == 1));;
592     + ge) ((_res != 2));;
593     + eq) ((_res == 0));;
594     + le) ((_res != 1));;
595     + lt) ((_res == 2));;
596     + ne) ((_res != 0));;
597     esac
598     }
599    
600     @@ -76,17 +73,19 @@
601     # Function prints global variables in format name=value line by line.
602     # $@ = list of global variables' name
603     print_vars() {
604     - local var value
605     + local _var _value
606    
607     - for var in $@
608     + for _var in $@
609     do
610     - value=$(eval echo \$$var)
611     - [[ ${value} ]] && echo "${var}=\"${value}\""
612     + _value=$(eval echo \$$_var)
613     + [[ ${_value} ]] && echo "${_var}=\"${_value}\""
614     done
615     }
616    
617     get_fs_env() {
618     [[ $1 ]] || return
619     + unset ID_FS_TYPE
620     + unset ID_FS_UUID
621     eval $(udevadm info --query=env --name=$1|egrep 'ID_FS_(TYPE|UUID)=')
622     [[ $ID_FS_TYPE ]] && return
623    
624     @@ -118,38 +117,38 @@
625    
626     # finds the major:minor of the block device backing the root filesystem.
627     find_block_device() {
628     - local x mpt majmin dev fs misc maj min
629     + local _x _mpt _majmin _dev _fs _maj _min
630     if [[ $use_fstab != yes ]]; then
631     - while read x x majmin x mpt x x fs dev misc; do
632     - [[ $fs = nfs ]] && { echo $dev; return 0;}
633     - [[ $fs = nfs3 ]] && { echo $dev; return 0;}
634     - [[ $fs = nfs4 ]] && { echo $dev; return 0;}
635     - [[ $fs = btrfs ]] && {
636     - ls -nLl "$dev" | {
637     - read x x x x maj min x
638     - maj=${maj//,/}
639     - echo $maj:$min
640     + while read _x _x _majmin _x _mpt _x _x _fs _dev _x; do
641     + [[ $_fs = nfs ]] && { echo $_dev; return 0;}
642     + [[ $_fs = nfs3 ]] && { echo $_dev; return 0;}
643     + [[ $_fs = nfs4 ]] && { echo $_dev; return 0;}
644     + [[ $_fs = btrfs ]] && {
645     + ls -nLl "$_dev" | {
646     + read _x _x _x _x _maj _min _x
647     + _maj=${_maj//,/}
648     + echo $_maj:$_min
649     } && return 0
650     }
651     - if [[ $mpt = $1 ]] && [[ ${majmin#0:} = $majmin ]]; then
652     - echo $majmin
653     + if [[ $_mpt = $1 ]] && [[ ${_majmin#0:} = $_majmin ]]; then
654     + echo $_majmin
655     return 0 # we have a winner!
656     fi
657     done < /proc/self/mountinfo
658     fi
659     # fall back to /etc/fstab
660     - while read dev mpt fs misc; do
661     - if [[ $mpt = $1 ]]; then
662     - [[ $fs = nfs ]] && { echo $dev; return 0;}
663     - [[ $fs = nfs3 ]] && { echo $dev; return 0;}
664     - [[ $fs = nfs4 ]] && { echo $dev; return 0;}
665     - [[ $dev != ${dev#UUID=} ]] && dev=/dev/disk/by-uuid/${dev#UUID=}
666     - [[ $dev != ${dev#LABEL=} ]] && dev=/dev/disk/by-label/${dev#LABEL=}
667     - [[ -b $dev ]] || return 1 # oops, not a block device.
668     - ls -nLl "$dev" | {
669     - read x x x x maj min x
670     - maj=${maj//,/}
671     - echo $maj:$min
672     + while read _dev _mpt _fs _x; do
673     + if [[ $_mpt = $1 ]]; then
674     + [[ $_fs = nfs ]] && { echo $_dev; return 0;}
675     + [[ $_fs = nfs3 ]] && { echo $_dev; return 0;}
676     + [[ $_fs = nfs4 ]] && { echo $_dev; return 0;}
677     + [[ $_dev != ${_dev#UUID=} ]] && _dev=/dev/disk/by-uuid/${_dev#UUID=}
678     + [[ $_dev != ${_dev#LABEL=} ]] && _dev=/dev/disk/by-label/${_dev#LABEL=}
679     + [[ -b $_dev ]] || return 1 # oops, not a block device.
680     + ls -nLl "$_dev" | {
681     + read _x _x _x _x _maj _min _x
682     + _maj=${_maj//,/}
683     + echo $_maj:$_min
684     } && return 0
685     fi
686     done < /etc/fstab
687     @@ -164,7 +163,7 @@
688     # $1 = function to call on every found block device
689     # $2 = block device in major:minor format
690     check_block_and_slaves() {
691     - local x
692     + local _x
693     [[ -b /dev/block/$2 ]] || return 1 # Not a block device? So sorry.
694     "$1" $2 && return
695     check_vol_slaves "$@" && return 0
696     @@ -172,15 +171,16 @@
697     check_block_and_slaves $1 $(cat "/sys/dev/block/$2/../dev") && return 0
698     fi
699     [[ -d /sys/dev/block/$2/slaves ]] || return 1
700     - for x in /sys/dev/block/$2/slaves/*/dev; do
701     - [[ -f $x ]] || continue
702     - check_block_and_slaves $1 $(cat "$x") && return 0
703     + for _x in /sys/dev/block/$2/slaves/*/dev; do
704     + [[ -f $_x ]] || continue
705     + check_block_and_slaves $1 $(cat "$_x") && return 0
706     done
707     return 1
708     }
709    
710     get_numeric_dev() {
711     - ls -lH "$1" | { read a b c d maj min rest; printf "%d:%d" ${maj%%,} $min; }
712     + local _x _maj _min
713     + ls -lH "$1" | { read _x _x _x _x _maj _min _x; printf "%d:%d" ${_maj%%,} $_min; }
714     }
715    
716     # ugly workaround for the lvm design
717     @@ -190,16 +190,17 @@
718     # but you cannot create the logical volume without the volume group.
719     # And the volume group might be bigger than the devices the LV needs.
720     check_vol_slaves() {
721     + local _lv _vg _pv
722     for i in /dev/mapper/*; do
723     - lv=$(get_numeric_dev $i)
724     - if [[ $lv = $2 ]]; then
725     - vg=$(lvm lvs --noheadings -o vg_name $i 2>/dev/null)
726     + _lv=$(get_numeric_dev $i)
727     + if [[ $_lv = $2 ]]; then
728     + _vg=$(lvm lvs --noheadings -o vg_name $i 2>/dev/null)
729     # strip space
730     - vg=$(echo $vg)
731     - if [[ $vg ]]; then
732     - for pv in $(lvm vgs --noheadings -o pv_name "$vg" 2>/dev/null)
733     + _vg=$(echo $_vg)
734     + if [[ $_vg ]]; then
735     + for _pv in $(lvm vgs --noheadings -o pv_name "$_vg" 2>/dev/null)
736     do
737     - check_block_and_slaves $1 $(get_numeric_dev $pv) && return 0
738     + check_block_and_slaves $1 $(get_numeric_dev $_pv) && return 0
739     done
740     fi
741     fi
742     @@ -212,27 +213,33 @@
743     # will create ${initdir}/lib64, ${initdir}/lib64/file,
744     # and a symlink ${initdir}/lib -> lib64.
745     inst_dir() {
746     - local dir="$1"
747     - [[ -e ${initdir}$dir ]] && return 0
748     + local _dir="$1"
749     + local _file=""
750     + local IFS="/"
751     + local _part
752     + [[ -e ${initdir}$_dir ]] && return 0
753    
754     # iterate over parent directories
755     - local file=""
756     - local IFS="/"
757     - for part in $dir; do
758     - [[ $part ]] || continue
759     - file="$file/$part"
760     - [[ -e ${initdir}$file ]] && continue
761     + for _part in $_dir; do
762     + [[ $_part ]] || continue
763     + _file="$_file/$_part"
764     + [[ -e ${initdir}$_file ]] && continue
765    
766     - if [[ -L $file ]]; then
767     + if [[ -L $_file ]]; then
768     # create link as the original
769     - local target=$(readlink "$file")
770     - ln -sfn "$target" "${initdir}$file" || return 1
771     + local target=$(readlink "$_file")
772     + ln -sfn "$target" "${initdir}$_file" || return 1
773     # resolve relative path and recursively install destination
774     - [[ $target == ${target#/} ]] && target="$(dirname "$file")/$target"
775     + [[ $target == ${target#/} ]] && target="$(dirname "$_file")/$target"
776     inst_dir "$target"
777     else
778     + [[ -h ${initdir}$_file ]] && _file=$(readlink "${initdir}$_file")
779     # create directory
780     - mkdir -m 0755 -p "${initdir}$file" || return 1
781     + mkdir -m 0755 -p "${initdir}$_file" || return 1
782     + if [[ -d "$_file" ]]; then
783     + chmod --reference="$_file" "${initdir}$_file"
784     + chmod u+w "${initdir}$_file"
785     + fi
786     fi
787     done
788     }
789     @@ -242,19 +249,20 @@
790     # Location of the image dir is assumed to be $initdir
791     # We never overwrite the target if it exists.
792     inst_simple() {
793     - local src target
794     + local _src target
795     [[ -f $1 ]] || return 1
796     - src=$1 target="${2:-$1}"
797     + _src=$1 target="${2:-$1}"
798     if ! [[ -d ${initdir}$target ]]; then
799     [[ -e ${initdir}$target ]] && return 0
800     + [[ -h ${initdir}$target ]] && return 0
801     inst_dir "${target%/*}"
802     fi
803     # install checksum files also
804     - if [[ -e "${src%/*}/.${src##*/}.hmac" ]]; then
805     - inst "${src%/*}/.${src##*/}.hmac" "${target%/*}/.${target##*/}.hmac"
806     + if [[ -e "${_src%/*}/.${_src##*/}.hmac" ]]; then
807     + inst "${_src%/*}/.${_src##*/}.hmac" "${target%/*}/.${target##*/}.hmac"
808     fi
809     - ddebug "Installing $src"
810     - cp -pfL "$src" "${initdir}$target"
811     + ddebug "Installing $_src"
812     + cp -pfL "$_src" "${initdir}$target"
813     }
814    
815     # find symlinks linked to given library file
816     @@ -286,27 +294,27 @@
817     # It handles making symlinks according to how the original library
818     # is referenced.
819     inst_library() {
820     - local src=$1 dest=${2:-$1} lib reallib symlink
821     - [[ -e $initdir$dest ]] && return 0
822     - if [[ -L $src ]]; then
823     + local _src=$1 _dest=${2:-$1} _lib _reallib _symlink
824     + [[ -e $initdir$_dest ]] && return 0
825     + if [[ -L $_src ]]; then
826     # install checksum files also
827     - if [[ -e "${src%/*}/.${src##*/}.hmac" ]]; then
828     - inst "${src%/*}/.${src##*/}.hmac" "${dest%/*}/.${dest##*/}.hmac"
829     + if [[ -e "${_src%/*}/.${_src##*/}.hmac" ]]; then
830     + inst "${_src%/*}/.${_src##*/}.hmac" "${_dest%/*}/.${_dest##*/}.hmac"
831     fi
832     - reallib=$(readlink -f "$src")
833     - lib=${src##*/}
834     - inst_simple "$reallib" "$reallib"
835     - inst_dir "${dest%/*}"
836     - (cd "${initdir}${dest%/*}" && ln -s "$reallib" "$lib")
837     + _reallib=$(readlink -f "$_src")
838     + _lib=${_src##*/}
839     + inst_simple "$_reallib" "$_reallib"
840     + inst_dir "${_dest%/*}"
841     + (cd "${initdir}${_dest%/*}" && ln -sfn "$_reallib" "$_lib")
842     else
843     - inst_simple "$src" "$dest"
844     + inst_simple "$_src" "$_dest"
845     fi
846    
847     # Create additional symlinks. See rev_symlinks description.
848     - for symlink in $(rev_lib_symlinks $src) $(rev_lib_symlinks $reallib); do
849     - [[ ! -e $initdir$symlink ]] && {
850     - ddebug "Creating extra symlink: $symlink"
851     - inst_symlink $symlink
852     + for _symlink in $(rev_lib_symlinks $_src) $(rev_lib_symlinks $_reallib); do
853     + [[ ! -e $initdir$_symlink ]] && {
854     + ddebug "Creating extra symlink: $_symlink"
855     + inst_symlink $_symlink
856     }
857     done
858     }
859     @@ -314,15 +322,15 @@
860     # find a binary. If we were not passed the full path directly,
861     # search in the usual places to find the binary.
862     find_binary() {
863     - local binpath="/bin /sbin /usr/bin /usr/sbin" p
864     + local _binpath="/usr/sbin /sbin /usr/bin /bin" _p
865     if [[ -z ${1##/*} ]]; then
866     if [[ -x $1 ]] || ldd $1 &>/dev/null; then
867     echo $1
868     return 0
869     fi
870     fi
871     - for p in $binpath; do
872     - [[ -x $p/$1 ]] && { echo "$p/$1"; return 0; }
873     + for _p in $_binpath; do
874     + [[ -x $_p/$1 ]] && { echo "$_p/$1"; return 0; }
875     done
876     return 1
877     }
878     @@ -330,105 +338,112 @@
879     # Same as above, but specialized to install binary executables.
880     # Install binary executable, and all shared library dependencies, if any.
881     inst_binary() {
882     - local bin target
883     - bin=$(find_binary "$1") || return 1
884     - target=${2:-$bin}
885     - inst_symlink $bin $target && return 0
886     - local LDSO NAME IO FILE ADDR I1 n f TLIBDIR
887     - [[ -e $initdir$target ]] && return 0
888     + local _bin _target _f _self _so_regex _lib_regex _tlibdir _base _file _line
889     +
890     + _bin=$(find_binary "$1") || return 1
891     + _target=${2:-$_bin}
892     + inst_symlink $_bin $_target && return 0
893     + [[ -e $initdir$_target ]] && return 0
894     +
895     + # If the binary being installed is also a library, add it to the loop.
896     + _so_regex='([^ ]*/lib[^/]*/[^ ]*\.so[^ ]*)'
897     + [[ $_bin =~ $_so_regex ]] && _self="\t${_bin##*/} => ${_bin} (0x0)\n"
898     +
899     + _lib_regex='^(/lib[^/]*).*'
900     # I love bash!
901     - LC_ALL=C ldd $bin 2>/dev/null | while read line; do
902     - [[ $line = 'not a dynamic executable' ]] && return 1
903     - if [[ $line =~ not\ found ]]; then
904     - dfatal "Missing a shared library required by $bin."
905     - dfatal "Run \"ldd $bin\" to find out what it is."
906     + { LC_ALL=C ldd $_bin 2>/dev/null; echo -en "$_self"; } | while read _line; do
907     + [[ $_line = 'not a dynamic executable' ]] && return 1
908     + if [[ $_line =~ not\ found ]]; then
909     + dfatal "Missing a shared library required by $_bin."
910     + dfatal "Run \"ldd $_bin\" to find out what it is."
911     dfatal "dracut cannot create an initrd."
912     exit 1
913     fi
914     - so_regex='([^ ]*/lib[^/]*/[^ ]*\.so[^ ]*)'
915     - [[ $line =~ $so_regex ]] || continue
916     - FILE=${BASH_REMATCH[1]}
917     - [[ -e ${initdir}$FILE ]] && continue
918     - # see if we are loading an optimized version of a shared lib.
919     - lib_regex='^(/lib[^/]*).*'
920     - if [[ $FILE =~ $lib_regex ]]; then
921     - TLIBDIR=${BASH_REMATCH[1]}
922     - BASE=${FILE##*/}
923     - # prefer nosegneg libs, then unoptimized ones.
924     - for f in "$TLIBDIR/i686/nosegneg" "$TLIBDIR"; do
925     - [[ -e $f/$BASE ]] || continue
926     - FILE=$f/$BASE
927     + [[ $_line =~ $_so_regex ]] || continue
928     + _file=${BASH_REMATCH[1]}
929     + [[ -e ${initdir}$_file ]] && continue
930     +
931     + # See if we are loading an optimized version of a shared lib.
932     + if [[ $_file =~ $_lib_regex ]]; then
933     + _tlibdir=${BASH_REMATCH[1]}
934     + _base=${_file##*/}
935     + # Prefer nosegneg libs to unoptimized ones.
936     + for _f in "$_tlibdir/i686/nosegneg" "$_tlibdir"; do
937     + [[ -e $_f/$_base ]] || continue
938     + _file=$_f/$_base
939     break
940     done
941     - inst_library "$FILE" "$TLIBDIR/$BASE"
942     - IF_dynamic=yes
943     - continue
944     - fi
945     - inst_library "$FILE"
946     + inst_library "$_file" "$_tlibdir/$_base"
947     + else
948     + inst_library "$_file"
949     + fi
950     done
951     - inst_simple "$bin" "$target"
952     +
953     + # Install the binary if it wasn't handled in the above loop.
954     + [[ -z $_self ]] && inst_simple "$_bin" "$_target"
955     }
956    
957     # same as above, except for shell scripts.
958     # If your shell script does not start with shebang, it is not a shell script.
959     inst_script() {
960     [[ -f $1 ]] || return 1
961     - local line
962     - read -r -n 80 line <"$1"
963     + local _line _shebang_regex
964     + read -r -n 80 _line <"$1"
965     # If debug is set, clean unprintable chars to prevent messing up the term
966     - [[ $debug ]] && line=$(echo -n "$line" | tr -c -d '[:print:][:space:]')
967     - shebang_regex='(#! *)(/[^ ]+).*'
968     - [[ $line =~ $shebang_regex ]] || return 1
969     + [[ $debug ]] && _line=$(echo -n "$_line" | tr -c -d '[:print:][:space:]')
970     + _shebang_regex='(#! *)(/[^ ]+).*'
971     + [[ $_line =~ $_shebang_regex ]] || return 1
972     inst "${BASH_REMATCH[2]}" && inst_simple "$@"
973     }
974    
975     # same as above, but specialized for symlinks
976     inst_symlink() {
977     - local src=$1 target=$initdir${2:-$1} realsrc
978     + local _src=$1 _target=$initdir${2:-$1} _realsrc
979     [[ -L $1 ]] || return 1
980     - [[ -L $target ]] && return 0
981     - realsrc=$(readlink -f "$src")
982     - [[ $realsrc = ${realsrc##*/} ]] && realsrc=${src%/*}/$realsrc
983     - inst "$realsrc" && mkdir -m 0755 -p "${target%/*}" && \
984     - ln -s "$realsrc" "$target"
985     -}
986     -
987     -# find a udev rule in the usual places.
988     -find_rule() {
989     - [[ -f $1 ]] && { echo "$1"; return 0; }
990     - for r in . /lib/udev/rules.d /etc/udev/rules.d $dracutbasedir/rules.d; do
991     - [[ -f $r/$1 ]] && { echo "$r/$1"; return 0; }
992     - done
993     - return 1
994     + [[ -L $_target ]] && return 0
995     + _realsrc=$(readlink -f "$_src")
996     + [[ $_realsrc = ${_realsrc##*/} ]] && _realsrc=${_src%/*}/$_realsrc
997     + if [[ -d $_realsrc ]]; then
998     + inst_dir "$_realsrc"
999     + else
1000     + inst "$_realsrc" && mkdir -m 0755 -p "${_target%/*}"
1001     + fi
1002     + if [[ -e "${_src}" ]]; then
1003     + cp -aP "${_src}" "$_target"
1004     + else
1005     + ln -sfn "$_realsrc" "$_target"
1006     + fi
1007     }
1008    
1009     # udev rules always get installed in the same place, so
1010     # create a function to install them to make life simpler.
1011     inst_rules() {
1012     - local target=/etc/udev/rules.d rule found
1013     + local _target=/etc/udev/rules.d _rule _found
1014    
1015     inst_dir "/lib/udev/rules.d"
1016     - inst_dir "$target"
1017     - for rule in "$@"; do
1018     + inst_dir "$_target"
1019     + for _rule in "$@"; do
1020     for r in /lib/udev/rules.d /etc/udev/rules.d; do
1021     - if [[ -f $r/$rule ]]; then
1022     - found="$r/$rule"
1023     - inst_simple "$found"
1024     + if [[ -f $r/$_rule ]]; then
1025     + _found="$r/$_rule"
1026     + inst_simple "$_found"
1027     fi
1028     - done
1029     + done
1030     for r in '' ./ $dracutbasedir/rules.d/; do
1031     - if [[ -f ${r}$rule ]]; then
1032     - found="${r}$rule"
1033     - inst_simple "$found" "$target/${found##*/}"
1034     + if [[ -f ${r}$_rule ]]; then
1035     + _found="${r}$_rule"
1036     + inst_simple "$_found" "$_target/${_found##*/}"
1037     fi
1038     done
1039     - [[ $found ]] || dinfo "Skipping udev rule: $rule"
1040     + [[ $_found ]] || dinfo "Skipping udev rule: $_rule"
1041     done
1042     }
1043    
1044     # general purpose installation function
1045     # Same args as above.
1046     inst() {
1047     + local _x
1048     +
1049     case $# in
1050     1) ;;
1051     2) [[ ! $initdir && -d $2 ]] && export initdir=$2
1052     @@ -438,15 +453,15 @@
1053     *) dfatal "inst only takes 1 or 2 or 3 arguments"
1054     exit 1;;
1055     esac
1056     - for x in inst_symlink inst_script inst_binary inst_simple; do
1057     - $x "$@" && return 0
1058     + for _x in inst_symlink inst_script inst_binary inst_simple; do
1059     + $_x "$@" && return 0
1060     done
1061     return 1
1062     }
1063    
1064     [[ $hookdirs ]] || {
1065     hookdirs="cmdline pre-udev pre-trigger netroot initqueue pre-mount"
1066     - hookdirs+=" pre-pivot mount emergency"
1067     + hookdirs+=" pre-pivot mount emergency emergency-shutdown shutdown"
1068     export hookdirs
1069     }
1070    
1071     @@ -459,20 +474,21 @@
1072     dfatal "Aborting initrd creation."
1073     exit 1
1074     elif ! strstr "$hookdirs" "$1"; then
1075     - dfatal "No such hook type $1. Aborting initrd creation."
1076     + dfatal "No such hook type $1. Aborting initrd creation."
1077     exit 1
1078     fi
1079     inst_simple "$3" "/lib/dracut/hooks/${1}/${2}${3##*/}"
1080     }
1081    
1082     dracut_install() {
1083     + local _optional=no
1084     if [[ $1 = '-o' ]]; then
1085     - local optional=yes
1086     + _optional=yes
1087     shift
1088     fi
1089     while (($# > 0)); do
1090     if ! inst "$1" ; then
1091     - if [[ $optional = yes ]]; then
1092     + if [[ $_optional = yes ]]; then
1093     dwarn "Skipping program $1 as it cannot be found and is" \
1094     "flagged to be optional"
1095     else
1096     @@ -490,32 +506,32 @@
1097     # Function install targets in the same paths inside overlay but decompressed
1098     # and without extensions (.gz, .bz2).
1099     inst_decompress() {
1100     - local src dst realsrc realdst cmd
1101     + local _src _dst _realsrc _realdst _cmd
1102    
1103     - for src in $@
1104     + for _src in $@
1105     do
1106     - case ${src} in
1107     - *.gz) cmd='gzip -d' ;;
1108     - *.bz2) cmd='bzip2 -d' ;;
1109     + case ${_src} in
1110     + *.gz) _cmd='gzip -d' ;;
1111     + *.bz2) _cmd='bzip2 -d' ;;
1112     *) return 1 ;;
1113     esac
1114    
1115     - if [[ -L ${src} ]]
1116     + if [[ -L ${_src} ]]
1117     then
1118     - realsrc="$(readlink -f ${src})" # symlink target with extension
1119     - dst="${src%.*}" # symlink without extension
1120     - realdst="${realsrc%.*}" # symlink target without extension
1121     - mksubdirs "${initdir}/${src}"
1122     + _realsrc="$(readlink -f ${_src})" # symlink target with extension
1123     + _dst="${_src%.*}" # symlink without extension
1124     + _realdst="${_realsrc%.*}" # symlink target without extension
1125     + mksubdirs "${initdir}/${_src}"
1126     # Create symlink without extension to target without extension.
1127     - ln -s "${realdst}" "${initdir}/${dst}"
1128     + ln -sfn "${_realdst}" "${initdir}/${_dst}"
1129     fi
1130    
1131     # If the source is symlink we operate on its target.
1132     - [[ ${realsrc} ]] && src=${realsrc}
1133     - inst ${src}
1134     + [[ ${_realsrc} ]] && _src=${_realsrc}
1135     + inst ${_src}
1136     # Decompress with chosen tool. We assume that tool changes name e.g.
1137     # from 'name.gz' to 'name'.
1138     - ${cmd} "${initdir}${src}"
1139     + ${_cmd} "${initdir}${_src}"
1140     done
1141     }
1142    
1143     @@ -523,170 +539,181 @@
1144     # install.
1145     # $@ = list of files
1146     inst_opt_decompress() {
1147     - local src
1148     + local _src
1149    
1150     - for src in $@
1151     + for _src in $@
1152     do
1153     - inst_decompress "${src}" || inst "${src}"
1154     + inst_decompress "${_src}" || inst "${_src}"
1155     done
1156     }
1157    
1158     module_check() {
1159     - local moddir=$(echo ${dracutbasedir}/modules.d/??${1})
1160     - [[ -d $moddir ]] || return 1
1161     - if [[ ! -f $moddir/module-setup.sh ]]; then
1162     + local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
1163     + local _ret
1164     + [[ -d $_moddir ]] || return 1
1165     + if [[ ! -f $_moddir/module-setup.sh ]]; then
1166     # if we do not have a check script, we are unconditionally included
1167     - [[ -x $moddir/check ]] || return 0
1168     - $moddir/check $hostonly
1169     + [[ -x $_moddir/check ]] || return 0
1170     + $_moddir/check $hostonly
1171     return $?
1172     else
1173     unset check depends install installkernel
1174     - . $moddir/module-setup.sh
1175     + . $_moddir/module-setup.sh
1176     is_func check || return 0
1177     check
1178     - ret=$?
1179     + _ret=$?
1180     unset check depends install installkernel
1181     - return $ret
1182     + return $_ret
1183     fi
1184     }
1185    
1186     module_depends() {
1187     - local moddir=$(echo ${dracutbasedir}/modules.d/??${1})
1188     - [[ -d $moddir ]] || return 1
1189     - if [[ ! -f $moddir/module-setup.sh ]]; then
1190     + local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
1191     + local _ret
1192     + [[ -d $_moddir ]] || return 1
1193     + if [[ ! -f $_moddir/module-setup.sh ]]; then
1194     # if we do not have a check script, we have no deps
1195     - [[ -x $moddir/check ]] || return 0
1196     - $moddir/check -d
1197     + [[ -x $_moddir/check ]] || return 0
1198     + $_moddir/check -d
1199     return $?
1200     else
1201     unset check depends install installkernel
1202     - . $moddir/module-setup.sh
1203     + . $_moddir/module-setup.sh
1204     is_func depends || return 0
1205     depends
1206     - ret=$?
1207     + _ret=$?
1208     unset check depends install installkernel
1209     - return $ret
1210     + return $_ret
1211     fi
1212     }
1213    
1214     module_install() {
1215     - local moddir=$(echo ${dracutbasedir}/modules.d/??${1})
1216     - [[ -d $moddir ]] || return 1
1217     - if [[ ! -f $moddir/module-setup.sh ]]; then
1218     - [[ -x $moddir/install ]] && . "$moddir/install"
1219     + local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
1220     + local _ret
1221     + [[ -d $_moddir ]] || return 1
1222     + if [[ ! -f $_moddir/module-setup.sh ]]; then
1223     + [[ -x $_moddir/install ]] && . "$_moddir/install"
1224     return $?
1225     else
1226     unset check depends install installkernel
1227     - . $moddir/module-setup.sh
1228     + . $_moddir/module-setup.sh
1229     is_func install || return 0
1230     install
1231     - ret=$?
1232     + _ret=$?
1233     unset check depends install installkernel
1234     - return $ret
1235     + return $_ret
1236     fi
1237     }
1238    
1239     module_installkernel() {
1240     - local moddir=$(echo ${dracutbasedir}/modules.d/??${1})
1241     - [[ -d $moddir ]] || return 1
1242     - if [[ ! -f $moddir/module-setup.sh ]]; then
1243     - [[ -x $moddir/installkernel ]] && . "$moddir/installkernel"
1244     + local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
1245     + local _ret
1246     + [[ -d $_moddir ]] || return 1
1247     + if [[ ! -f $_moddir/module-setup.sh ]]; then
1248     + [[ -x $_moddir/installkernel ]] && . "$_moddir/installkernel"
1249     return $?
1250     else
1251     unset check depends install installkernel
1252     - . $moddir/module-setup.sh
1253     + . $_moddir/module-setup.sh
1254     is_func installkernel || return 0
1255     installkernel
1256     - ret=$?
1257     + _ret=$?
1258     unset check depends install installkernel
1259     - return $ret
1260     + return $_ret
1261     fi
1262     }
1263    
1264     check_module() {
1265     - local mod=$1;
1266     - local moddir=$(echo ${dracutbasedir}/modules.d/??${1})
1267     - local moddep;
1268     + local _mod=$1
1269     + local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
1270     + local _ret
1271     + local _moddep
1272     # If we are already scheduled to be loaded, no need to check again.
1273     - strstr " $mods_to_load " " $mod " && return 0
1274     - strstr " $mods_checked_as_dep " " $mod " && return 1
1275     + strstr " $mods_to_load " " $_mod " && return 0
1276     + strstr " $mods_checked_as_dep " " $_mod " && return 1
1277    
1278     # This should never happen, but...
1279     - [[ -d $moddir ]] || return 1
1280     + [[ -d $_moddir ]] || return 1
1281    
1282     - [[ $2 ]] || mods_checked_as_dep+=" $mod "
1283     + [[ $2 ]] || mods_checked_as_dep+=" $_mod "
1284    
1285     - strstr " $omit_dracutmodules " " $mod " && return 1
1286     + strstr " $omit_dracutmodules " " $_mod " && return 1
1287    
1288     - if strstr " $dracutmodules $add_dracutmodules " " $mod "; then
1289     - module_check $mod; ret=$?
1290     + if strstr " $dracutmodules $add_dracutmodules " " $_mod "; then
1291     + module_check $_mod; ret=$?
1292     # explicit module, so also accept ret=255
1293     [[ $ret = 0 || $ret = 255 ]] || return 1
1294     else
1295     # module not in our list
1296     if [[ $dracutmodules = all ]]; then
1297     # check, if we can and should install this module
1298     - module_check $mod || return 1
1299     + module_check $_mod || return 1
1300     else
1301     # skip this module
1302     return 1
1303     fi
1304     fi
1305    
1306     - for moddep in $(module_depends $mod); do
1307     + for _moddep in $(module_depends $_mod); do
1308     # handle deps as if they were manually added
1309     - strstr " $add_dracutmodules " " $moddep " || \
1310     - add_dracutmodules+=" $moddep "
1311     + strstr " $add_dracutmodules " " $_moddep " || \
1312     + add_dracutmodules+=" $_moddep "
1313     # if a module we depend on fail, fail also
1314     - check_module $moddep || return 1
1315     + check_module $_moddep || return 1
1316     done
1317    
1318     - strstr " $mods_to_load " " $mod " || \
1319     - mods_to_load+=" $mod "
1320     + strstr " $mods_to_load " " $_mod " || \
1321     + mods_to_load+=" $_mod "
1322    
1323     return 0
1324     }
1325    
1326     check_module_dir() {
1327     - local modcheck;
1328     - local mod;
1329     + local _modcheck
1330     + local _mod
1331     + local _moddir
1332     mods_to_load=""
1333     - for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
1334     - local mod=${moddir##*/}; mod=${mod#[0-9][0-9]}
1335     - check_module $mod 1
1336     + for _moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
1337     + _mod=${_moddir##*/}; _mod=${_mod#[0-9][0-9]}
1338     + check_module $_mod 1
1339     done
1340    
1341     # Report any missing dracut modules, the user has specified
1342     - modcheck=$add_dracutmodules
1343     - [[ $dracutmodules != all ]] && modcheck="$m $dracutmodules"
1344     - for mod in $modcheck; do
1345     - strstr "$mods_to_load" "$mod" && continue
1346     - strstr "$omit_dracutmodules" "$mod" && continue
1347     - derror "Dracut module \"$mod\" cannot be found."
1348     + _modcheck=$add_dracutmodules
1349     + [[ $dracutmodules != all ]] && _modcheck="$m $dracutmodules"
1350     + for _mod in $_modcheck; do
1351     + strstr "$mods_to_load" "$_mod" && continue
1352     + strstr "$omit_dracutmodules" "$_mod" && continue
1353     + derror "Dracut module \"$_mod\" cannot be found."
1354     done
1355     }
1356    
1357     # Install a single kernel module along with any firmware it may require.
1358     # $1 = full path to kernel module to install
1359     install_kmod_with_fw() {
1360     - local modname=${1##*/} fwdir found
1361     - modname=${modname%.ko*}
1362     + local _modname=${1##*/} _fwdir _found _fw
1363     + _modname=${_modname%.ko*}
1364     # no need to go further if the module is already installed
1365     [[ -e "${initdir}/lib/modules/$kernel/${1##*/lib/modules/$kernel/}" ]] \
1366     && return 0
1367     inst_simple "$1" "/lib/modules/$kernel/${1##*/lib/modules/$kernel/}" \
1368     || return $?
1369     - for fw in $(modinfo -k $kernel -F firmware $1 2>/dev/null); do
1370     - found=''
1371     - for fwdir in $fw_dir; do
1372     - if [[ -d $fwdir && -f $fwdir/$fw ]]; then
1373     - inst_simple "$fwdir/$fw" "/lib/firmware/$fw"
1374     - found=yes
1375     + for _fw in $(modinfo -k $kernel -F firmware $1 2>/dev/null); do
1376     + _found=''
1377     + for _fwdir in $fw_dir; do
1378     + if [[ -d $_fwdir && -f $_fwdir/$_fw ]]; then
1379     + inst_simple "$_fwdir/$_fw" "/lib/firmware/$_fw"
1380     + _found=yes
1381     fi
1382     done
1383     - if [[ $found != yes ]]; then
1384     - dwarn "Possible missing firmware \"${fw}\" for kernel module" \
1385     - "\"${mod}.ko\""
1386     + if [[ $_found != yes ]]; then
1387     + if ! grep -qe "\<${_modname//-/_}\>" /proc/modules; then
1388     + dinfo "Possible missing firmware \"${_fw}\" for kernel module" \
1389     + "\"${_modname}.ko\""
1390     + else
1391     + dwarn "Possible missing firmware \"${_fw}\" for kernel module" \
1392     + "\"${_modname}.ko\""
1393     + fi
1394     fi
1395     done
1396     return 0
1397     @@ -699,18 +726,19 @@
1398     # $2 = module to get dependencies for
1399     # rest of args = arguments to modprobe
1400     for_each_kmod_dep() {
1401     - local func=$1 kmod=$2 cmd modpapth options
1402     + local _func=$1 _kmod=$2 _cmd _modpath _options _found=0
1403     shift 2
1404     - modprobe "$@" --ignore-install --show-depends $kmod 2>/dev/null | (
1405     - local found=0
1406     - while read cmd modpath options; do
1407     - [[ $cmd = insmod ]] || continue
1408     - $func ${modpath} || exit $?
1409     - found=1
1410     + modprobe "$@" --ignore-install --show-depends $_kmod 2>"$initdir/modprobe.err" | (
1411     + while read _cmd _modpath _options; do
1412     + [[ $_cmd = insmod ]] || continue
1413     + $_func ${_modpath} || exit $?
1414     + _found=1
1415     done
1416     - [[ $found -eq 0 ]] && exit 1
1417     + [[ $_found -eq 0 ]] && exit 1
1418     exit 0
1419     )
1420     + egrep -v 'FATAL: Module .* not found.' "$initdir/modprobe.err" | derror
1421     + rm -f "$initdir/modprobe.err"
1422     return $?
1423     }
1424    
1425     @@ -723,19 +751,20 @@
1426     # If it is not, we will look at all kernel modules
1427     # This function returns the full filenames of modules that match $1
1428     filter_kernel_modules () (
1429     + local _modname _filtercmd
1430     if ! [[ $hostonly ]]; then
1431     - filtercmd='find "$srcmods/kernel/drivers" "$srcmods/extra"'
1432     - filtercmd+=' "$srcmods/weak-updates" -name "*.ko" -o -name "*.ko.gz"'
1433     - filtercmd+=' 2>/dev/null'
1434     + _filtercmd='find "$srcmods/kernel/drivers" "$srcmods/extra"'
1435     + _filtercmd+=' "$srcmods/weak-updates" -name "*.ko" -o -name "*.ko.gz"'
1436     + _filtercmd+=' 2>/dev/null'
1437     else
1438     - filtercmd='cut -d " " -f 1 </proc/modules|xargs modinfo -F filename '
1439     - filtercmd+='-k $kernel 2>/dev/null'
1440     + _filtercmd='cut -d " " -f 1 </proc/modules|xargs modinfo -F filename '
1441     + _filtercmd+='-k $kernel 2>/dev/null'
1442     fi
1443     - for modname in $(eval $filtercmd); do
1444     - case $modname in
1445     - *.ko) "$1" "$modname" && echo "$modname";;
1446     - *.ko.gz) gzip -dc "$modname" > $initdir/$$.ko
1447     - $1 $initdir/$$.ko && echo "$modname"
1448     + for _modname in $(eval $_filtercmd); do
1449     + case $_modname in
1450     + *.ko) "$1" "$_modname" && echo "$_modname";;
1451     + *.ko.gz) gzip -dc "$_modname" > $initdir/$$.ko
1452     + $1 $initdir/$$.ko && echo "$_modname"
1453     rm -f $initdir/$$.ko
1454     ;;
1455     esac
1456     @@ -745,52 +774,52 @@
1457     # install kernel modules along with all their dependencies.
1458     instmods() {
1459     [[ $no_kernel = yes ]] && return
1460     - local mod mpargs modpath modname cmd moddirname
1461     - local ret=0
1462     + local _mod _mpargs _moddirname
1463     + local _ret=0
1464     while (($# > 0)); do
1465     - mod=${1%.ko*}
1466     - case $mod in
1467     + _mod=${1%.ko*}
1468     + case $_mod in
1469     =*)
1470     # This introduces 2 incompatible meanings for =* arguments
1471     # to instmods. We need to decide which one to keep.
1472     - if [[ $mod = =ata && -f $srcmods/modules.block ]]; then
1473     - instmods $mpargs \
1474     + if [[ $_mod = =ata && -f $srcmods/modules.block ]]; then
1475     + instmods $_mpargs \
1476     $(egrep 'ata|ahci' "${srcmods}/modules.block")
1477     - elif [ -f $srcmods/modules.${mod#=} ]; then
1478     - instmods $mpargs $(cat ${srcmods}/modules.${mod#=} )
1479     + elif [ -f $srcmods/modules.${_mod#=} ]; then
1480     + instmods $_mpargs $(cat ${srcmods}/modules.${_mod#=} )
1481     else
1482     - instmods $mpargs $(find "$srcmods" -path "*/${mod#=}/*")
1483     + instmods $_mpargs $(find "$srcmods" -path "*/${_mod#=}/*")
1484     fi
1485     ;;
1486     --*)
1487     - mod=${mod##*/}
1488     - mpargs+=" $mod";;
1489     + _mod=${_mod##*/}
1490     + _mpargs+=" $_mod";;
1491     i2o_scsi) shift; continue;; # Do not load this diagnostic-only module
1492     - *) mod=${mod##*/}
1493     + *) _mod=${_mod##*/}
1494     # if we are already installed, skip this module and go on
1495     # to the next one.
1496     [[ -f $initdir/$1 ]] && { shift; continue; }
1497     # If we are building a host-specific initramfs and this
1498     # module is not already loaded, move on to the next one.
1499     - [[ $hostonly ]] && ! grep -qe "\<${mod//-/_}\>" /proc/modules \
1500     - && ! echo $add_drivers | grep -qe "\<${mod}\>" && {
1501     + [[ $hostonly ]] && ! grep -qe "\<${_mod//-/_}\>" /proc/modules \
1502     + && ! echo $add_drivers | grep -qe "\<${_mod}\>" && {
1503     shift; continue
1504     }
1505    
1506     # We use '-d' option in modprobe only if modules prefix path
1507     # differs from default '/'. This allows us to use Dracut with
1508     # old version of modprobe which doesn't have '-d' option.
1509     - moddirname=${srcmods%%/lib/modules/*}
1510     - [[ -n ${moddirname} ]] && moddirname="-d ${moddirname}/"
1511     + _moddirname=${srcmods%%/lib/modules/*}
1512     + [[ -n ${_moddirname} ]] && _moddirname="-d ${_moddirname}/"
1513    
1514     # ok, load the module, all its dependencies, and any firmware
1515     # it may require
1516     - for_each_kmod_dep install_kmod_with_fw $mod \
1517     - --set-version $kernel ${moddirname}
1518     - ((ret+=$?))
1519     + for_each_kmod_dep install_kmod_with_fw $_mod \
1520     + --set-version $kernel ${_moddirname}
1521     + ((_ret+=$?))
1522     ;;
1523     esac
1524     shift
1525     done
1526     - return $ret
1527     + return $_ret
1528     }
1529     diff -Naur dracut-010/dracut-gencmdline dracut-0e6a94b/dracut-gencmdline
1530     --- dracut-010/dracut-gencmdline 2011-03-31 19:50:31.000000000 +0200
1531     +++ dracut-0e6a94b/dracut-gencmdline 2011-05-31 16:34:37.000000000 +0200
1532     @@ -168,7 +168,7 @@
1533     real=$(freadlink /dev/disk/by-label/${1##LABEL=})
1534     [ -b $real ] && { echo $real; return; }
1535     fi
1536     - echo "$1"
1537     + echo "$1"
1538     }
1539    
1540     finddevnoinsys() {
1541     @@ -308,7 +308,7 @@
1542     chap=${result}
1543     if [ -n "${chap}" -a "${chap}" != "<empty>" ]; then
1544     chap="-u ${chap}"
1545     - iscsi_get_rec_val $tmpfile "node.session.auth.password"
1546     + iscsi_get_rec_val $tmpfile "node.session.auth.password"
1547     chap_pw="-w ${result}"
1548     else
1549     chap=""
1550     @@ -318,7 +318,7 @@
1551     chap_in=${result}
1552     if [ -n "${chap_in}" -a "${chap_in}" != "<empty>" ]; then
1553     chap_in="-U ${chap_in}"
1554     - iscsi_get_rec_val $tmpfile "node.session.auth.password_in"
1555     + iscsi_get_rec_val $tmpfile "node.session.auth.password_in"
1556     chap_in_pw="-W ${result}"
1557     else
1558     chap_in=""
1559     @@ -343,7 +343,7 @@
1560     path=$1
1561     if echo $path | grep -q "/platform/host[0-9]*/session[0-9]*/target[0-9]*:[0-9]*:[0-9]*/[0-9]*:[0-9]*:[0-9]*:[0-9]*"; then
1562     return 0
1563     - else
1564     + else
1565     return 1
1566     fi
1567     }
1568     @@ -399,7 +399,7 @@
1569     EOF
1570     local name=$(dmsetup info --noheadings -c -j $major -m $minor -o name)
1571     local vg=$(lvshow "/dev/mapper/$name")
1572     - local raids=$(/sbin/dmraid -s -craidname 2>/dev/null | grep -vi "no raid disks")
1573     + local raids=$(/sbin/dmraid -s -craidname 2>/dev/null | grep -vi "no raid disks")
1574     if [ -n "$vg" ]; then
1575     vg=`echo $vg` # strip whitespace
1576     case " $vg_list " in
1577     @@ -630,7 +630,7 @@
1578    
1579     cemit()
1580     {
1581     - cat
1582     + cat
1583     }
1584    
1585     emit()
1586     @@ -640,7 +640,7 @@
1587     NONL="-n"
1588     shift
1589     fi
1590     - echo $NONL "$@"
1591     + echo $NONL "$@"
1592     }
1593    
1594     emitdmraids()
1595     @@ -678,8 +678,8 @@
1596     echo -n "rd_NO_MD "
1597     fi
1598    
1599     -if [ -z "$nolvm" -a -n "$vg_list" ]; then
1600     - for vg in $vg_list; do
1601     +if [ -z "$nolvm" -a -n "$vg_list" ]; then
1602     + for vg in $vg_list; do
1603     echo -n "rd_LVM_VG=$vg "
1604     done
1605     else
1606     diff -Naur dracut-010/dracut-gencmdline.8.xml dracut-0e6a94b/dracut-gencmdline.8.xml
1607     --- dracut-010/dracut-gencmdline.8.xml 2011-03-31 19:50:31.000000000 +0200
1608     +++ dracut-0e6a94b/dracut-gencmdline.8.xml 2011-05-31 16:34:37.000000000 +0200
1609     @@ -15,7 +15,7 @@
1610     <!-- body begins here -->
1611     <refsynopsisdiv id='synopsis'>
1612     <cmdsynopsis>
1613     - <command>dracut-gencmdline</command>
1614     + <command>dracut-gencmdline</command>
1615     <sbr/>
1616     </cmdsynopsis>
1617     </refsynopsisdiv>
1618     @@ -35,7 +35,7 @@
1619    
1620     <refsect1 id='availability'><title>AVAILABILITY</title>
1621     <para>The dracut-gencmdline command is part of the dracut package and is available from
1622     -<ulink url='http://sourceforge.net/apps/trac/dracut/wiki'>http://sourceforge.net/apps/trac/dracut/wiki</ulink></para>
1623     +<ulink url='https://dracut.wiki.kernel.org'>https://dracut.wiki.kernel.org</ulink></para>
1624    
1625     </refsect1>
1626    
1627     diff -Naur dracut-010/dracut.kernel.7.xml dracut-0e6a94b/dracut.kernel.7.xml
1628     --- dracut-010/dracut.kernel.7.xml 2011-03-31 19:50:31.000000000 +0200
1629     +++ dracut-0e6a94b/dracut.kernel.7.xml 2011-05-31 16:34:37.000000000 +0200
1630     @@ -25,11 +25,11 @@
1631     <refsect1>
1632     <title>Description</title>
1633     <para>The root filesystem used by the kernel is specified in the boot configuration
1634     -file, as always. The traditional <emphasis remap="B">root=/dev/hda1</emphasis> style device
1635     +file, as always. The traditional <emphasis remap="B">root=/dev/hda1</emphasis> style device
1636     specification is allowed. If a label is used, as in <emphasis remap="B">root=LABEL=rootPart</emphasis>
1637     the initramfs will search all available devices for an ext2 or ext3 filesystem
1638     with the appropriate label, and mount that device as the root filesystem.
1639     -<emphasis remap="B">root=UUID=uuidnumber</emphasis> will mount the partition with that UUID as the
1640     +<emphasis remap="B">root=UUID=uuidnumber</emphasis> will mount the partition with that UUID as the
1641     root filesystem.</para>
1642     <refsect2>
1643     <title>Standard</title>
1644     @@ -47,7 +47,7 @@
1645     <envar>root=<replaceable>&lt;path to blockdevice&gt;</replaceable></envar>
1646     </term>
1647     <listitem>
1648     - <para>specify blockdevice to use as root filesystem.
1649     + <para>specify blockdevice to use as root filesystem.
1650     e.g.: <programlisting>root=/dev/sda1
1651     root=/dev/disk/by-path/pci-0000:00:1f.1-scsi-0:0:1:0-part1 </programlisting></para>
1652     </listitem>
1653     @@ -66,14 +66,14 @@
1654     </term>
1655     <listitem>
1656     <para>specify additional mount options for the root filesystem. If not set, <filename>/etc/fstab</filename>
1657     -of the real root will be parsed for special mount options and mounted
1658     +of the real root will be parsed for special mount options and mounted
1659     accordingly.</para>
1660     </listitem>
1661     </varlistentry>
1662     <varlistentry>
1663     <term><envar>rd.fstab</envar>=0</term>
1664     <listitem>
1665     - <para>do not honor special mount options for the root filesystem found in
1666     + <para>do not honor special mount options for the root filesystem found in
1667     <filename>/etc/fstab</filename> of the real root.</para>
1668     </listitem>
1669     </varlistentry>
1670     @@ -169,14 +169,6 @@
1671     <para>set udev to loglevel debug</para>
1672     </listitem>
1673     </varlistentry>
1674     - <varlistentry>
1675     - <term>
1676     - <envar>rd.timestamp</envar>
1677     - </term>
1678     - <listitem>
1679     - <para>export RDTIMESTAMP environment variable to init, which is set to the uptime of the dracut start.</para>
1680     - </listitem>
1681     - </varlistentry>
1682     </variablelist>
1683     </refsect2>
1684     <refsect2>
1685     @@ -302,7 +294,7 @@
1686     <listitem>
1687     <para>only activate the LUKS partitions with the given UUID
1688     Any &quot;luks-&quot; of the LUKS UUID is removed before comparing to <replaceable>&lt;luks uuid&gt;</replaceable>.
1689     -The comparisons also matches, if <replaceable>&lt;luks uuid&gt;</replaceable> is only the beginning of the
1690     +The comparisons also matches, if <replaceable>&lt;luks uuid&gt;</replaceable> is only the beginning of the
1691     LUKS UUID, so you don&apos;t have to specify the full UUID.
1692     This parameter can be specified multiple times.</para>
1693     </listitem>
1694     @@ -325,7 +317,7 @@
1695     <envar>rd.luks.key=</envar><replaceable>&lt;keypath&gt;:&lt;keydev&gt;:&lt;luksdev&gt;</replaceable>
1696     </term>
1697     <listitem>
1698     - <para><replaceable>keypath</replaceable> is a path to key file to look for. It&apos;s REQUIRED.</para>
1699     + <para><replaceable>keypath</replaceable> is a path to key file to look for. It&apos;s REQUIRED. When <replaceable>keypath</replaceable> ends with '.gpg' it's considered to be key encrypted symmetrically with GPG. You will be prompted for password on boot. GPG support comes with 'crypt-gpg' module which needs to be added explicitly.</para>
1700     <para><replaceable>keydev</replaceable> is a device on which key file resides. It might be kernel name of devices (should start with &quot;/dev/&quot;), UUID (prefixed with &quot;UUID=&quot;) or label (prefix with &quot;LABEL=&quot;). You don&apos;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>
1701     <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&apos;t have to specify this parameter.</para>
1702     <para>The simplest usage is:</para>
1703     @@ -390,6 +382,37 @@
1704     </variablelist>
1705     </refsect2>
1706     <refsect2>
1707     + <title>FIPS</title>
1708     + <variablelist>
1709     + <varlistentry>
1710     + <term><envar>rd.fips</envar></term>
1711     + <listitem>
1712     + <para>enable FIPS</para>
1713     + </listitem>
1714     + </varlistentry>
1715     + <varlistentry>
1716     + <term>
1717     + <envar>boot=<replaceable>&lt;boot device&gt;</replaceable></envar>
1718     + </term>
1719     + <listitem>
1720     + <para>specify the device, where /boot is located.<programlisting>
1721     +e.g.
1722     + boot=/dev/sda1
1723     + boot=/dev/disk/by-path/pci-0000:00:1f.1-scsi-0:0:1:0-part1
1724     + boot=UUID=&lt;uuid&gt;
1725     + boot=LABEL=&lt;label&gt;</programlisting>
1726     +</para>
1727     + </listitem>
1728     + </varlistentry>
1729     + <varlistentry>
1730     + <term><envar>rd.fips.skipkernel</envar></term>
1731     + <listitem>
1732     + <para>skip checksum check of the kernel image. Useful, if the kernel image is not in a separate boot partition.</para>
1733     + </listitem>
1734     + </varlistentry>
1735     + </variablelist>
1736     + </refsect2>
1737     + <refsect2>
1738     <title>Network</title>
1739     <variablelist>
1740     <varlistentry>
1741     @@ -397,8 +420,8 @@
1742     <envar>ip=</envar><replaceable>{dhcp|on|any|dhcp6|auto6|ibft}</replaceable>
1743     </term>
1744     <listitem>
1745     - <para>dhcp|on|any: get ip from dhcp server from all interfaces. If root=dhcp,
1746     -loop sequentially through all interfaces (eth0, eth1, ...) and use the first
1747     + <para>dhcp|on|any: get ip from dhcp server from all interfaces. If root=dhcp,
1748     +loop sequentially through all interfaces (eth0, eth1, ...) and use the first
1749     with a valid DHCP root-path.</para>
1750     <para><constant>auto6</constant>: IPv6 autoconfiguration</para>
1751     <para><constant>dhcp6</constant>: IPv6 DHCP</para>
1752     @@ -436,7 +459,7 @@
1753     <envar>bootdev=</envar><replaceable>&lt;interface&gt;</replaceable>
1754     </term>
1755     <listitem>
1756     - <para>specify network interface to use routing and netroot information from.
1757     + <para>specify network interface to use routing and netroot information from.
1758     Required if multiple ip= lines are used.</para>
1759     </listitem>
1760     </varlistentry>
1761     @@ -478,7 +501,7 @@
1762     <envar>root=</envar><replaceable>{dhcp|dhcp6}</replaceable>
1763     </term>
1764     <listitem>
1765     - <para>root=dhcp alone directs initrd to look at the DHCP root-path where NFS
1766     + <para>root=dhcp alone directs initrd to look at the DHCP root-path where NFS
1767     options can be specified.
1768     root-path=&lt;server-ip&gt;:&lt;root-dir&gt;[,&lt;nfs-options&gt;]
1769     root-path=nfs:&lt;server-ip&gt;:&lt;root-dir&gt;[,&lt;nfs-options&gt;]
1770     @@ -491,8 +514,8 @@
1771     <envar> nfsroot=</envar><optional><replaceable>&lt;server-ip&gt;</replaceable>:</optional><replaceable>&lt;root-dir&gt;</replaceable><optional>:<replaceable>&lt;nfs-options&gt;</replaceable></optional>
1772     </term>
1773     <listitem>
1774     - <para><emphasis remap="B">Deprecated!</emphasis> kernel Documentation<filename>/filesystems/nfsroot.txt</filename> defines
1775     -this method.
1776     + <para><emphasis remap="B">Deprecated!</emphasis> kernel Documentation<filename>/filesystems/nfsroot.txt</filename> defines
1777     +this method.
1778     This is supported by dracut, but not recommended.</para>
1779     </listitem>
1780     </varlistentry>
1781     @@ -530,7 +553,7 @@
1782     associated fields.</para>
1783     <para>See <ulink url="http://tools.ietf.org/html/rfc4173#section-5">http://tools.ietf.org/html/rfc4173</ulink>.</para>
1784     <para>e.g.:<programlisting>root=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0 </programlisting></para>
1785     - <para>If servername is an IPv6 address, it has to be put in brackets. e.g.:
1786     + <para>If servername is an IPv6 address, it has to be put in brackets. e.g.:
1787     <programlisting>root=iscsi:[2001:DB8::1]::::iqn.2009-06.dracut:target0 </programlisting></para>
1788     </listitem>
1789     </varlistentry>
1790     @@ -545,7 +568,7 @@
1791     <replaceable>&lt;LUN&gt;</replaceable>
1792     </optional>:<replaceable>&lt;targetname&gt;</replaceable> ...</term>
1793     <listitem>
1794     - <para>multiple netroot options allow setting up multiple iscsi disks. e.g.:
1795     + <para>multiple netroot options allow setting up multiple iscsi disks. e.g.:
1796     <programlisting>root=UUID=12424547
1797     netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0
1798     netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target1 </programlisting></para>
1799     @@ -573,7 +596,7 @@
1800     </varlistentry>
1801     <varlistentry>
1802     <term>
1803     - <envar>root=</envar><replaceable>??? </replaceable><envar>rd.iscsi.firmware=1</envar>
1804     + <envar>root=</envar><replaceable>??? </replaceable><envar>netroot=iscsi </envar><envar>rd.iscsi.firmware=1</envar>
1805     </term>
1806     <listitem>
1807     <para>will read the iscsi parameter from the BIOS firmware</para>
1808     @@ -608,9 +631,9 @@
1809     </term>
1810     <listitem>
1811     <para>with dhcp root-path=nbd:&lt;server&gt;:&lt;port&gt;[:&lt;fstype&gt;][:&lt;mountopts&gt;]
1812     -root=dhcp alone directs initrd to look at the DHCP root-path where NBD
1813     +root=dhcp alone directs initrd to look at the DHCP root-path where NBD
1814     options can be specified.
1815     -This syntax is only usable in cases where you are directly mounting the volume
1816     +This syntax is only usable in cases where you are directly mounting the volume
1817     as the rootfs.</para>
1818     </listitem>
1819     </varlistentry>
1820     @@ -702,14 +725,6 @@
1821     </varlistentry>
1822     <varlistentry>
1823     <term>
1824     - <envar>rdcopystate</envar>
1825     - </term>
1826     - <listitem>
1827     - <para><envar>rd.copystate</envar></para>
1828     - </listitem>
1829     - </varlistentry>
1830     - <varlistentry>
1831     - <term>
1832     <envar>rd_DASD_MOD</envar>
1833     </term>
1834     <listitem>
1835     @@ -1200,7 +1215,7 @@
1836     </term>
1837     <listitem>
1838     <para>Any files found in <filename>/etc/conf.d/</filename> will be sourced in the initramfs to
1839     -set initial values. Command line options will override these values
1840     +set initial values. Command line options will override these values
1841     set in the configuration files.</para>
1842     </listitem>
1843     </varlistentry>
1844     diff -Naur dracut-010/dracut.spec dracut-0e6a94b/dracut.spec
1845     --- dracut-010/dracut.spec 2011-03-31 19:50:31.000000000 +0200
1846     +++ dracut-0e6a94b/dracut.spec 2011-05-31 16:34:37.000000000 +0200
1847     @@ -6,33 +6,25 @@
1848     %define with_nbd 0
1849     %endif
1850    
1851     -%if %{defined gittag}
1852     -%define rdist .git%{gittag}%{?dist}
1853     -%define dashgittag -%{gittag}
1854     -%else
1855     -%define rdist %{?dist}
1856     -%endif
1857     -
1858     Name: dracut
1859     -Version: 010
1860     -%define release_prefix 0%{?rdist}
1861     -Release: %{release_prefix}
1862     +Version: xxx
1863     +Release: xxx
1864    
1865     Summary: Initramfs generator using udev
1866     %if 0%{?fedora}
1867     -Group: System Environment/Base
1868     +Group: System Environment/Base
1869     %endif
1870     %if 0%{?suse_version}
1871     Group: System/Base
1872     %endif
1873     -License: GPLv2+
1874     +License: GPLv2+
1875     URL: https://dracut.wiki.kernel.org/
1876     -# Source can be generated by
1877     -# http://git.kernel.org/?p=boot/dracut/dracut.git;a=snapshot;h=%{?dashgittag};sf=tgz
1878     -Source0: http://www.kernel.org/pub/linux/utils/boot/dracut/dracut-%{version}%{?dashgittag}.tar.bz2
1879     +# Source can be generated by
1880     +# http://git.kernel.org/?p=boot/dracut/dracut.git;a=snapshot;h=%{version};sf=tgz
1881     +Source0: http://www.kernel.org/pub/linux/utils/boot/dracut/dracut-%{version}.tar.bz2
1882    
1883     BuildArch: noarch
1884     -
1885     +BuildRequires: dash bash
1886     %if 0%{?fedora}
1887     BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
1888     %endif
1889     @@ -93,16 +85,16 @@
1890    
1891    
1892     %description
1893     -Dracut contains tools to create a bootable initramfs for 2.6 Linux kernels.
1894     -Unlike existing implementations, dracut does hard-code as little as possible
1895     -into the initramfs. Dracut contains various modules which are driven by the
1896     -event-based udev. Having root on MD, DM, LVM2, LUKS is supported as well as
1897     +Dracut contains tools to create a bootable initramfs for 2.6 Linux kernels.
1898     +Unlike existing implementations, dracut does hard-code as little as possible
1899     +into the initramfs. Dracut contains various modules which are driven by the
1900     +event-based udev. Having root on MD, DM, LVM2, LUKS is supported as well as
1901     NFS, iSCSI, NBD, FCoE with the dracut-network package.
1902    
1903     %package network
1904     Summary: Dracut modules to build a dracut initramfs with network support
1905     Requires: %{name} = %{version}-%{release}
1906     -Requires: rpcbind
1907     +Requires: rpcbind
1908     %if %{with_nbd}
1909     Requires: nbd
1910     %endif
1911     @@ -111,7 +103,7 @@
1912    
1913     %if 0%{?fedora}
1914     Requires: iscsi-initiator-utils
1915     -Requires: nfs-utils
1916     +Requires: nfs-utils
1917     Requires: dhclient
1918     %endif
1919    
1920     @@ -162,17 +154,17 @@
1921     This package contains tools to assemble the local initrd and host configuration.
1922    
1923     %prep
1924     -%setup -q -n %{name}-%{version}%{?dashgittag}
1925     +%setup -q -n %{name}-%{version}
1926    
1927     %build
1928     -make WITH_SWITCH_ROOT=0%{?with_switch_root}
1929     +make
1930    
1931     %install
1932     %if 0%{?fedora}
1933     rm -rf $RPM_BUILD_ROOT
1934     %endif
1935     make install DESTDIR=$RPM_BUILD_ROOT sbindir=/sbin \
1936     - sysconfdir=/etc mandir=%{_mandir} WITH_SWITCH_ROOT=0%{?with_switch_root}
1937     + sysconfdir=/etc mandir=%{_mandir}
1938    
1939     echo %{name}-%{version}-%{release} > $RPM_BUILD_ROOT/%{_datadir}/dracut/modules.d/10rpmversion/dracut-version
1940    
1941     @@ -213,9 +205,6 @@
1942     %defattr(-,root,root,0755)
1943     %doc README HACKING TODO COPYING AUTHORS NEWS dracut.html dracut.png dracut.svg
1944     /sbin/dracut
1945     -%if 0%{?with_switch_root}
1946     -/sbin/switch_root
1947     -%endif
1948     %if 0%{?fedora} > 12 || 0%{?rhel} >= 6 || 0%{?suse_version} > 9999
1949     /sbin/mkinitrd
1950     /sbin/lsinitrd
1951     @@ -249,6 +238,7 @@
1952     %{_datadir}/dracut/modules.d/90lvm
1953     %{_datadir}/dracut/modules.d/90mdraid
1954     %{_datadir}/dracut/modules.d/90multipath
1955     +%{_datadir}/dracut/modules.d/91crypt-gpg
1956     %{_datadir}/dracut/modules.d/95debug
1957     %{_datadir}/dracut/modules.d/95resume
1958     %{_datadir}/dracut/modules.d/95rootfs-block
1959     @@ -262,6 +252,7 @@
1960     %{_datadir}/dracut/modules.d/98selinux
1961     %{_datadir}/dracut/modules.d/98syslog
1962     %{_datadir}/dracut/modules.d/99base
1963     +%{_datadir}/dracut/modules.d/99shutdown
1964     # logfile needs no logrotate, because it gets overwritten
1965     # for every dracut run
1966     %attr(0644,root,root) %ghost %config(missingok,noreplace) %{_localstatedir}/log/dracut.log
1967     @@ -288,7 +279,7 @@
1968     %defattr(-,root,root,0755)
1969     %{_datadir}/dracut/modules.d/02caps
1970    
1971     -%files tools
1972     +%files tools
1973     %defattr(-,root,root,0755)
1974     %{_mandir}/man8/dracut-gencmdline.8*
1975     %{_mandir}/man8/dracut-catimages.8*
1976     diff -Naur dracut-010/dracut.xml dracut-0e6a94b/dracut.xml
1977     --- dracut-010/dracut.xml 2011-03-31 19:50:31.000000000 +0200
1978     +++ dracut-0e6a94b/dracut.xml 2011-05-31 16:34:37.000000000 +0200
1979     @@ -74,7 +74,7 @@
1980     <para>A <acronym>TFTP</acronym> server (on systems that can boot from Ethernet) </para>
1981     </listitem>
1982     </itemizedlist>
1983     - <para>The bootloader will load the kernel and initial root file system image into memory and then start the kernel, passing in the memory address of the image.
1984     + <para>The bootloader will load the kernel and initial root file system image into memory and then start the kernel, passing in the memory address of the image.
1985     </para>
1986     <para>Depending on which algorithms were compiled statically into it, the kernel can currently unpack initrd/initramfs images compressed with gzip, bzip2 and <acronym>LZMA</acronym>. </para>
1987     </section>
1988     @@ -431,7 +431,7 @@
1989     <para>Remove the boot arguments &apos;&apos;rhgb&apos;&apos; and &apos;&apos;quiet&apos;&apos;
1990     </para>
1991     <para>
1992     -A sample <filename>/etc/grub.conf</filename> bootloader configuration file is listed below.
1993     +A sample <filename>/etc/grub.conf</filename> bootloader configuration file is listed below.
1994     </para>
1995     <para><screen>default=0
1996     timeout=5
1997     @@ -439,12 +439,12 @@
1998     terminal --timeout=5 serial console
1999     title Fedora (2.6.29.5-191.fc11.x86_64)
2000     root (hd0,0)
2001     - kernel /vmlinuz-2.6.29.5-191.fc11.x86_64 ro root=/dev/mapper/vg_uc1-lv_root console=tty0 rd.shell
2002     + kernel /vmlinuz-2.6.29.5-191.fc11.x86_64 ro root=/dev/mapper/vg_uc1-lv_root console=tty0 rd.shell
2003     initrd /dracut-2.6.29.5-191.fc11.x86_64.img</screen></para>
2004     </listitem>
2005     <listitem>
2006     <para>If system boot fails, you will be dropped into a shell as seen in the example below.
2007     -<screen>No root device found
2008     +<screen>No root device found
2009     Dropping to debug shell.
2010    
2011     sh: can&apos;t access tty; job control turned off
2012     @@ -623,7 +623,7 @@
2013     inst_simple &quot;$moddir/insmodpost.sh&quot; /sbin/insmodpost.sh</programlisting>
2014     <para>The <filename>pase-instmodpost.sh</filename> parses the kernel command line for a argument <envar>rd.driver.post</envar>, blacklists the module from being autoloaded and installs the hook <filename>insmodpost.sh</filename> in the <filename>initqueue-settled</filename>.</para>
2015     <para><filename>parse-insmodpost.sh</filename>:</para>
2016     - <programlisting>for p in $(getargs rd.driver.post=); do
2017     + <programlisting>for p in $(getargs rd.driver.post=); do
2018     echo &quot;blacklist $p&quot; &gt;&gt; /etc/modprobe.d/initramfsblacklist.conf
2019     _do_insmodpost=1
2020     done
2021     @@ -635,7 +635,7 @@
2022     <para><filename>insmodpost.sh</filename>:</para>
2023     <programlisting>. /lib/dracut-lib.sh
2024    
2025     -for p in $(getargs rd.driver.post=); do
2026     +for p in $(getargs rd.driver.post=); do
2027     modprobe $p
2028     done
2029     </programlisting>
2030     diff -Naur dracut-010/git2spec.pl dracut-0e6a94b/git2spec.pl
2031     --- dracut-010/git2spec.pl 1970-01-01 01:00:00.000000000 +0100
2032     +++ dracut-0e6a94b/git2spec.pl 2011-05-31 16:34:37.000000000 +0200
2033     @@ -0,0 +1,66 @@
2034     +#!/usr/bin/perl
2035     +
2036     +sub last_tag {
2037     + open( GIT, 'git log --pretty=format:%H |');
2038     + LINE: while( <GIT> ) {
2039     + open( GIT2, "git tag --contains $_ |");
2040     + while( <GIT2> ) {
2041     + chomp;
2042     + last LINE if /..*/;
2043     + }
2044     + close GIT2;
2045     + }
2046     + $tag=$_;
2047     + close GIT2;
2048     + close GIT; # be done
2049     + return $tag;
2050     +};
2051     +
2052     +sub create_patches {
2053     + my $tag=shift;
2054     + my $num=0;
2055     + open( GIT, 'git format-patch -M -N --no-signature '.$tag.' |');
2056     + @lines=<GIT>;
2057     + close GIT; # be done
2058     + return @lines;
2059     +};
2060     +use POSIX qw(strftime);
2061     +my $datestr = strftime "%Y%m%d", gmtime;
2062     +
2063     +my $tag=shift;
2064     +$tag=&last_tag if not defined $tag;
2065     +my @patches=&create_patches($tag);
2066     +my $num=$#patches + 2;
2067     +$tag=~s/[^0-9]+?([0-9]+)/$1/;
2068     +my $release="$num.git$datestr";
2069     +$release="1" if $num == 1;
2070     +
2071     +while(<>) {
2072     + if (/^Version:/) {
2073     + print "Version: $tag\n";
2074     + }
2075     + elsif (/^Release:/) {
2076     + print "Release: $release\n";
2077     + }
2078     + elsif ((/^Source0:/) || (/^Source:/)) {
2079     + print $_;
2080     + $num=1;
2081     + for(@patches) {
2082     + print "Patch$num: $_";
2083     + $num++;
2084     + }
2085     + print "\n";
2086     + }
2087     + elsif (/^%setup/) {
2088     + print $_;
2089     + $num=1;
2090     + for(@patches) {
2091     + print "%patch$num -p1\n";
2092     + $num++;
2093     + }
2094     + print "\n";
2095     + }
2096     + else {
2097     + print $_;
2098     + }
2099     +}
2100     diff -Naur dracut-010/.gitignore dracut-0e6a94b/.gitignore
2101     --- dracut-010/.gitignore 2011-03-31 19:50:31.000000000 +0200
2102     +++ dracut-0e6a94b/.gitignore 2011-05-31 16:34:37.000000000 +0200
2103     @@ -1,8 +1,10 @@
2104     +/dracut.8
2105     +/dracut-catimages.8
2106     +/dracut.conf.5
2107     +/dracut.conf.d/*.conf
2108     +/dracut-gencmdline.8
2109     +/dracut.html
2110     +/dracut.kernel.7
2111     +/modules.d/99base/switch_root
2112     +/test/*/test.log
2113     test*.img
2114     -modules.d/99base/switch_root
2115     -*~
2116     -dracut.kernel.7
2117     -dracut.conf.5
2118     -dracut.8
2119     -dracut-catimages.8
2120     -dracut-gencmdline.8
2121     diff -Naur dracut-010/HACKING dracut-0e6a94b/HACKING
2122     --- dracut-010/HACKING 2011-03-31 19:50:31.000000000 +0200
2123     +++ dracut-0e6a94b/HACKING 2011-05-31 16:34:37.000000000 +0200
2124     @@ -1,11 +1,11 @@
2125     Right now, most of the testing is done using a qemu/kvm guest and
2126     generating the initramfs on another box but the support is all present
2127     to build for the "running" machine. For the former, you can boot the guest
2128     -using qemu's -kernel and -initrd options.
2129     +using qemu's -kernel and -initrd options.
2130    
2131     dracut exists and will build an image. It is command-line equivalent
2132     to most mkinitrd implementations and should be pretty straight-forward
2133     -to use.
2134     +to use.
2135    
2136     To use, just run dracut with an output file name and, optionally, a
2137     kernel version (it defaults to using the current). The appropriate
2138     @@ -14,7 +14,7 @@
2139     and set
2140     dracutmodules="foo bar baz"
2141    
2142     -Note that dracut calls functional components in modules.d "modules"
2143     +Note that dracut calls functional components in modules.d "modules"
2144     while kernel modules are called "drivers".
2145    
2146     Requirements:
2147     diff -Naur dracut-010/lsinitrd dracut-0e6a94b/lsinitrd
2148     --- dracut-010/lsinitrd 2011-03-31 19:50:31.000000000 +0200
2149     +++ dracut-0e6a94b/lsinitrd 2011-05-31 16:34:37.000000000 +0200
2150     @@ -1,4 +1,4 @@
2151     -#!/bin/bash
2152     +#!/bin/bash
2153     # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
2154     # ex: ts=8 sw=4 sts=4 et filetype=sh
2155     #
2156     @@ -30,6 +30,8 @@
2157     CAT=zcat
2158     elif [[ "$FILE_T" =~ ": xz compressed data" ]]; then
2159     CAT=xzcat
2160     +elif [[ "$FILE_T" =~ ": XZ compressed data" ]]; then
2161     + CAT=xzcat
2162     elif [[ "$FILE_T" =~ ": data" ]]; then
2163     CAT=lzcat
2164     fi
2165     @@ -41,7 +43,7 @@
2166    
2167     echo "$image:"
2168     echo "========================================================================"
2169     -$CAT "$image" | cpio --extract --verbose --quiet --to-stdout 'lib/dracut/dracut-*' 2>/dev/null
2170     +$CAT "$image" | cpio --extract --verbose --quiet --to-stdout 'lib/dracut/dracut-*' 2>/dev/null
2171     echo "========================================================================"
2172     $CAT "$image" | cpio --extract --verbose --quiet --list
2173     echo "========================================================================"
2174     diff -Naur dracut-010/Makefile dracut-0e6a94b/Makefile
2175     --- dracut-010/Makefile 2011-03-31 19:50:31.000000000 +0200
2176     +++ dracut-0e6a94b/Makefile 2011-05-31 16:34:37.000000000 +0200
2177     @@ -10,15 +10,10 @@
2178    
2179     manpages = dracut.8 dracut.kernel.7 dracut.conf.5 dracut-catimages.8 dracut-gencmdline.8
2180    
2181     -.PHONY: install clean archive rpm testimage test all check AUTHORS
2182     +.PHONY: install clean archive rpm testimage test all check AUTHORS doc
2183    
2184     -ifeq (1,${WITH_SWITCH_ROOT})
2185     -targets = modules.d/99base/switch_root
2186     -else
2187     -targets =
2188     -endif
2189     -
2190     -all: $(targets) $(manpages) dracut.html
2191     +doc: $(manpages) dracut.html
2192     +all: syncheck
2193    
2194     %: %.xml
2195     xsltproc -o $@ -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
2196     @@ -29,10 +24,7 @@
2197     --stringparam html.stylesheet http://docs.redhat.com/docs/en-US/Common_Content/css/default.css \
2198     http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl dracut.xml
2199    
2200     -modules.d/99base/switch_root: switch_root.c
2201     - gcc -D _GNU_SOURCE -D 'PACKAGE_STRING="dracut"' -std=gnu99 -fsigned-char -g -O2 -o modules.d/99base/switch_root switch_root.c
2202     -
2203     -install:
2204     +install: doc
2205     mkdir -p $(DESTDIR)$(pkglibdir)
2206     mkdir -p $(DESTDIR)$(sbindir)
2207     mkdir -p $(DESTDIR)$(sysconfdir)
2208     @@ -43,9 +35,6 @@
2209     install -m 0755 dracut-catimages $(DESTDIR)$(sbindir)/dracut-catimages
2210     install -m 0755 mkinitrd-dracut.sh $(DESTDIR)$(sbindir)/mkinitrd
2211     install -m 0755 lsinitrd $(DESTDIR)$(sbindir)/lsinitrd
2212     -ifeq (1,${WITH_SWITCH_ROOT})
2213     - install -m 0755 modules.d/99base/switch_root $(DESTDIR)$(sbindir)/switch_root
2214     -endif
2215     install -m 0644 dracut.conf $(DESTDIR)$(sysconfdir)/dracut.conf
2216     mkdir -p $(DESTDIR)$(sysconfdir)/dracut.conf.d
2217     install -m 0755 dracut-functions $(DESTDIR)$(pkglibdir)/dracut-functions
2218     @@ -56,15 +45,11 @@
2219     install -m 0644 dracut-gencmdline.8 $(DESTDIR)$(mandir)/man8
2220     install -m 0644 dracut.conf.5 $(DESTDIR)$(mandir)/man5
2221     install -m 0644 dracut.kernel.7 $(DESTDIR)$(mandir)/man7
2222     -ifeq (1,${WITH_SWITCH_ROOT})
2223     - rm $(DESTDIR)$(pkglibdir)/modules.d/99base/switch_root
2224     -endif
2225    
2226     clean:
2227     $(RM) *~
2228     $(RM) */*~
2229     $(RM) */*/*~
2230     - $(RM) modules.d/99base/switch_root
2231     $(RM) test-*.img
2232     $(RM) dracut-*.rpm dracut-*.tar.bz2
2233     $(RM) $(manpages) dracut.html
2234     @@ -80,22 +65,15 @@
2235     dracut-$(VERSION).tar.gz:
2236     git archive --format=tar $(VERSION) --prefix=dracut-$(VERSION)/ |gzip > dracut-$(VERSION).tar.gz
2237    
2238     -dracut-$(VERSION)-$(GITVERSION).tar.bz2:
2239     - git archive --format=tar HEAD --prefix=dracut-$(VERSION)-$(GITVERSION)/ |bzip2 > dracut-$(VERSION)-$(GITVERSION).tar.bz2
2240     -
2241     -
2242     -rpm: clean dracut-$(VERSION).tar.bz2
2243     - rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" --define "_specdir $$PWD" --define "_srcrpmdir $$PWD" --define "_rpmdir $$PWD" -ba dracut.spec
2244     - rm -fr BUILD BUILDROOT
2245     -
2246     -gitrpm: dracut-$(VERSION)-$(GITVERSION).tar.bz2
2247     - echo "%define gittag $(GITVERSION)" > dracut.spec.git
2248     - cat dracut.spec >> dracut.spec.git
2249     - mv dracut.spec dracut.spec.bak
2250     - mv dracut.spec.git dracut.spec
2251     - rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" --define "_specdir $$PWD" --define "_srcrpmdir $$PWD" --define "_rpmdir $$PWD" --define "gittag $(GITVERSION)" -ba dracut.spec || :
2252     - mv dracut.spec.bak dracut.spec
2253     - rm -fr BUILD BUILDROOT
2254     +rpm: dracut-$(VERSION).tar.bz2
2255     + mkdir -p rpmbuild
2256     + cp dracut-$(VERSION).tar.bz2 rpmbuild
2257     + cd rpmbuild; ../git2spec.pl $(VERSION) < ../dracut.spec > dracut.spec; \
2258     + rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" \
2259     + --define "_specdir $$PWD" --define "_srcrpmdir $$PWD" \
2260     + --define "_rpmdir $$PWD" -ba dracut.spec || :; \
2261     + cd ..;
2262     + rm -fr rpmbuild
2263    
2264     syncheck:
2265     @ret=0;for i in dracut-logger modules.d/99base/init modules.d/*/*.sh; do \
2266     diff -Naur dracut-010/modules.d/00bootchart/module-setup.sh dracut-0e6a94b/modules.d/00bootchart/module-setup.sh
2267     --- dracut-010/modules.d/00bootchart/module-setup.sh 2011-03-31 19:50:31.000000000 +0200
2268     +++ dracut-0e6a94b/modules.d/00bootchart/module-setup.sh 2011-05-31 16:34:37.000000000 +0200
2269     @@ -12,16 +12,16 @@
2270     }
2271    
2272     install() {
2273     - inst /sbin/bootchartd
2274     - inst /bin/bash
2275     + inst /sbin/bootchartd
2276     + inst /bin/bash
2277     inst_symlink /init /sbin/init
2278     inst_dir /lib/bootchart/tmpfs
2279     - inst /lib/bootchart/bootchart-collector
2280     - inst /etc/bootchartd.conf
2281     - inst /sbin/accton
2282     + inst /lib/bootchart/bootchart-collector
2283     + inst /etc/bootchartd.conf
2284     + inst /sbin/accton
2285     inst /usr/bin/pkill /bin/pkill
2286     inst /bin/echo
2287     - inst /bin/grep
2288     + inst /bin/grep
2289     inst /bin/usleep
2290     inst /usr/bin/[ /bin/[
2291    
2292     diff -Naur dracut-010/modules.d/01fips/fips-boot.sh dracut-0e6a94b/modules.d/01fips/fips-boot.sh
2293     --- dracut-010/modules.d/01fips/fips-boot.sh 1970-01-01 01:00:00.000000000 +0100
2294     +++ dracut-0e6a94b/modules.d/01fips/fips-boot.sh 2011-05-31 16:34:37.000000000 +0200
2295     @@ -0,0 +1,12 @@
2296     +#!/bin/sh
2297     +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
2298     +# ex: ts=8 sw=4 sts=4 et filetype=sh
2299     +
2300     +if ! fipsmode=$(getarg fips) || [ $fipsmode = "0" ]; then
2301     + rm -f /etc/modprobe.d/fips.conf >/dev/null 2>&1
2302     +elif getarg boot= >/dev/null; then
2303     + . /sbin/fips.sh
2304     + if mount_boot; then
2305     + do_fips || die "FIPS integrity test failed"
2306     + fi
2307     +fi
2308     diff -Naur dracut-010/modules.d/01fips/fips-noboot.sh dracut-0e6a94b/modules.d/01fips/fips-noboot.sh
2309     --- dracut-010/modules.d/01fips/fips-noboot.sh 1970-01-01 01:00:00.000000000 +0100
2310     +++ dracut-0e6a94b/modules.d/01fips/fips-noboot.sh 2011-05-31 16:34:37.000000000 +0200
2311     @@ -0,0 +1,11 @@
2312     +#!/bin/sh
2313     +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
2314     +# ex: ts=8 sw=4 sts=4 et filetype=sh
2315     +
2316     +if ! fipsmode=$(getarg fips) || [ $fipsmode = "0" ]; then
2317     + rm -f /etc/modprobe.d/fips.conf >/dev/null 2>&1
2318     +elif ! [ -f /tmp/fipsdone ]; then
2319     + . /sbin/fips.sh
2320     + mount_boot
2321     + do_fips || die "FIPS integrity test failed"
2322     +fi
2323     diff -Naur dracut-010/modules.d/01fips/fips.sh dracut-0e6a94b/modules.d/01fips/fips.sh
2324     --- dracut-010/modules.d/01fips/fips.sh 2011-03-31 19:50:31.000000000 +0200
2325     +++ dracut-0e6a94b/modules.d/01fips/fips.sh 2011-05-31 16:34:37.000000000 +0200
2326     @@ -1,12 +1,13 @@
2327     #!/bin/sh
2328     # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
2329     # ex: ts=8 sw=4 sts=4 et filetype=sh
2330     -do_fips()
2331     +
2332     +mount_boot()
2333     {
2334     - FIPSMODULES=$(cat /etc/fipsmodules)
2335     boot=$(getarg boot=)
2336     - KERNEL=$(uname -r)
2337     - case "$boot" in
2338     +
2339     + if [ -n "$boot" ]; then
2340     + case "$boot" in
2341     LABEL=*)
2342     boot="$(echo $boot | sed 's,/,\\x2f,g')"
2343     boot="/dev/disk/by-label/${boot#LABEL=}"
2344     @@ -18,36 +19,51 @@
2345     ;;
2346     *)
2347     die "You have to specify boot=<boot device> as a boot option for fips=1" ;;
2348     - esac
2349     + esac
2350    
2351     - if ! [ -e "$boot" ]; then
2352     - udevadm trigger --action=add >/dev/null 2>&1
2353     - [ -z "$UDEVVERSION" ] && UDEVVERSION=$(udevadm --version)
2354     -
2355     - if [ $UDEVVERSION -ge 143 ]; then
2356     - udevadm settle --exit-if-exists=$boot
2357     - else
2358     - udevadm settle --timeout=30
2359     + if ! [ -e "$boot" ]; then
2360     + udevadm trigger --action=add >/dev/null 2>&1
2361     + [ -z "$UDEVVERSION" ] && UDEVVERSION=$(udevadm --version)
2362     + i=0
2363     + while ! [ -e $boot ]; do
2364     + if [ $UDEVVERSION -ge 143 ]; then
2365     + udevadm settle --exit-if-exists=$boot
2366     + else
2367     + udevadm settle --timeout=30
2368     + fi
2369     + [ -e $boot ] && break
2370     + modprobe scsi_wait_scan && rmmod scsi_wait_scan
2371     + [ -e $boot ] && break
2372     + sleep 0.5
2373     + i=$(($i+1))
2374     + [ $i -gt 40 ] && break
2375     + done
2376     fi
2377     - fi
2378    
2379     - [ -e "$boot" ]
2380     + [ -e "$boot" ] || return 1
2381    
2382     - mkdir /boot
2383     - info "Mounting $boot as /boot"
2384     - mount -oro "$boot" /boot
2385     + mkdir /boot
2386     + info "Mounting $boot as /boot"
2387     + mount -oro "$boot" /boot || return 1
2388     + fi
2389     +}
2390    
2391     +do_fips()
2392     +{
2393     info "Checking integrity of kernel"
2394     + newroot=$NEWROOT
2395     + KERNEL=$(uname -r)
2396     +
2397     + [ -e "$newroot/boot/.vmlinuz-${KERNEL}.hmac" ] || unset newroot
2398    
2399     - if ! [ -e "/boot/.vmlinuz-${KERNEL}.hmac" ]; then
2400     - warn "/boot/.vmlinuz-${KERNEL}.hmac does not exist"
2401     + if ! [ -e "$newroot/boot/.vmlinuz-${KERNEL}.hmac" ]; then
2402     + warn "$newroot/boot/.vmlinuz-${KERNEL}.hmac does not exist"
2403     return 1
2404     fi
2405    
2406     - sha512hmac -c "/boot/.vmlinuz-${KERNEL}.hmac" || return 1
2407     + sha512hmac -c "$newroot/boot/.vmlinuz-${KERNEL}.hmac" || return 1
2408    
2409     - info "Umounting /boot"
2410     - umount /boot
2411     + FIPSMODULES=$(cat /etc/fipsmodules)
2412    
2413     info "Loading and integrity checking all crypto modules"
2414     for module in $FIPSMODULES; do
2415     @@ -58,15 +74,11 @@
2416     info "Self testing crypto algorithms"
2417     modprobe tcrypt || return 1
2418     rmmod tcrypt
2419     - info "All initrd crypto checks done"
2420     + info "All initrd crypto checks done"
2421     +
2422     + > /tmp/fipsdone
2423     +
2424     + umount /boot >/dev/null 2>&1
2425    
2426     return 0
2427     }
2428     -
2429     -if ! fipsmode=$(getarg fips) || [ $fipsmode = "0" ]; then
2430     - rm -f /etc/modprobe.d/fips.conf >/dev/null 2>&1
2431     -else
2432     - set -e
2433     - do_fips || die "FIPS integrity test failed"
2434     - set +e
2435     -fi
2436     diff -Naur dracut-010/modules.d/01fips/module-setup.sh dracut-0e6a94b/modules.d/01fips/module-setup.sh
2437     --- dracut-010/modules.d/01fips/module-setup.sh 2011-03-31 19:50:31.000000000 +0200
2438     +++ dracut-0e6a94b/modules.d/01fips/module-setup.sh 2011-05-31 16:34:37.000000000 +0200
2439     @@ -11,31 +11,39 @@
2440     }
2441    
2442     installkernel() {
2443     - FIPSMODULES="aead aes_generici aes-xts aes-x86_64 ansi_cprng cbc ccm chainiv ctr"
2444     - FIPSMODULES="$FIPSMODULES des deflate ecb eseqiv hmac seqiv sha256 sha512"
2445     - FIPSMODULES="$FIPSMODULES cryptomgr crypto_null tcrypt"
2446     -
2447     - mkdir -p "${initdir}/etc/modprobe.d"
2448     -
2449     - for mod in $FIPSMODULES; do
2450     - if instmods $mod; then
2451     - echo $mod >> "${initdir}/etc/fipsmodules"
2452     - echo "blacklist $mod" >> "${initdir}/etc/modprobe.d/fips.conf"
2453     + local _fipsmodules _mod
2454     + _fipsmodules="aead aes_generici aes-xts aes-x86_64 ansi_cprng cbc ccm chainiv ctr"
2455     + _fipsmodules+=" des deflate ecb eseqiv hmac seqiv sha256 sha512"
2456     + _fipsmodules+=" cryptomgr crypto_null tcrypt"
2457     +
2458     + mkdir -m 0755 -p "${initdir}/etc/modprobe.d"
2459     +
2460     + for _mod in $_fipsmodules; do
2461     + if instmods $_mod; then
2462     + echo $_mod >> "${initdir}/etc/fipsmodules"
2463     + echo "blacklist $_mod" >> "${initdir}/etc/modprobe.d/fips.conf"
2464     fi
2465     done
2466     }
2467    
2468     install() {
2469     - inst_hook pre-trigger 01 "$moddir/fips.sh"
2470     + local _dir
2471     + inst_hook pre-trigger 01 "$moddir/fips-boot.sh"
2472     + inst_hook pre-pivot 01 "$moddir/fips-noboot.sh"
2473     + inst "$moddir/fips.sh" /sbin/fips.sh
2474     +
2475     dracut_install sha512hmac rmmod insmod mount uname umount
2476    
2477     - for dir in "$usrlibdir" "$libdir"; do
2478     - [[ -e $dir/libsoftokn3.so ]] && \
2479     - dracut_install $dir/libsoftokn3.so $dir/libsoftokn3.chk \
2480     - $dir/libfreebl3.so $dir/libfreebl3.chk && \
2481     + for _dir in "$usrlibdir" "$libdir"; do
2482     + [[ -e $_dir/libsoftokn3.so ]] && \
2483     + dracut_install $_dir/libsoftokn3.so $_dir/libsoftokn3.chk \
2484     + $_dir/libfreebl3.so $_dir/libfreebl3.chk && \
2485     break
2486     done
2487    
2488     dracut_install $usrlibdir/hmaccalc/sha512hmac.hmac
2489     + if command -v prelink >/dev/null; then
2490     + dracut_install prelink
2491     + fi
2492     }
2493    
2494     diff -Naur dracut-010/modules.d/02caps/caps.sh dracut-0e6a94b/modules.d/02caps/caps.sh
2495     --- dracut-010/modules.d/02caps/caps.sh 2011-03-31 19:50:31.000000000 +0200
2496     +++ dracut-0e6a94b/modules.d/02caps/caps.sh 2011-05-31 16:34:37.000000000 +0200
2497     @@ -12,7 +12,7 @@
2498    
2499     info "Loading CAPS_MODULES $CAPS_MODULES"
2500     for i in $CAPS_MODULES;do modprobe $i 2>&1 >/dev/null | vinfo; done
2501     -
2502     +
2503     if [ "$CAPS_MODULES_DISABLED" = "1" -a -e /proc/sys/kernel/modules_disabled ]; then
2504     info "Disabling module loading."
2505     echo $CAPS_MODULES_DISABLED > /proc/sys/kernel/modules_disabled
2506     @@ -29,7 +29,7 @@
2507     echo $CAPS_USERMODEHELPER_BSET > /proc/sys/kernel/usermodehelper/bset
2508     echo $CAPS_USERMODEHELPER_BSET > /proc/sys/kernel/usermodehelper/inheritable
2509     fi
2510     -
2511     +
2512     echo "CAPS_INIT_DROP=\"$CAPS_INIT_DROP\"" > /etc/capsdrop
2513     info "Will drop capabilities $CAPS_INIT_DROP from init."
2514     fi
2515     diff -Naur dracut-010/modules.d/05busybox/module-setup.sh dracut-0e6a94b/modules.d/05busybox/module-setup.sh
2516     --- dracut-010/modules.d/05busybox/module-setup.sh 2011-03-31 19:50:31.000000000 +0200
2517     +++ dracut-0e6a94b/modules.d/05busybox/module-setup.sh 2011-05-31 16:34:37.000000000 +0200
2518     @@ -13,18 +13,23 @@
2519     }
2520    
2521     install() {
2522     - inst busybox /sbin/busybox
2523     + local _i _progs _path
2524     + inst busybox /usr/bin/busybox
2525    
2526     # List of shell programs that we use in other official dracut modules, that
2527     # must be supported by the busybox installed on the host system
2528     - progs="echo grep usleep [ rmmod insmod mount uname umount setfont kbd_mode stty gzip bzip2 chvt readlink blkid dd losetup tr sed seq ps more cat rm free ping netstat vi ping6 fsck ip hostname basename mknod mkdir pidof sleep chroot ls cp mv dmesg mkfifo less ln modprobe"
2529     + _progs="echo grep usleep [ rmmod insmod mount uname umount setfont kbd_mode stty gzip bzip2 chvt readlink blkid dd losetup tr sed seq ps more cat rm free ping netstat vi ping6 fsck ip hostname basename mknod mkdir pidof sleep chroot ls cp mv dmesg mkfifo less ln modprobe"
2530    
2531     # FIXME: switch_root should be in the above list, but busybox version hangs
2532     # (using busybox-1.15.1-7.fc14.i686 at the time of writing)
2533    
2534     - for i in $progs; do
2535     - path=$(find_binary "$i")
2536     - ln -s /sbin/busybox "$initdir/$path"
2537     + for _i in $_progs; do
2538     + _path=$(find_binary "$_i")
2539     + if [[ $_path != ${_path#/usr} ]]; then
2540     + ln -s ../../usr/bin/busybox "$initdir/$_path"
2541     + else
2542     + ln -s ../usr/bin/busybox "$initdir/$_path"
2543     + fi
2544     done
2545    
2546     }
2547     diff -Naur dracut-010/modules.d/10i18n/console_init dracut-0e6a94b/modules.d/10i18n/console_init
2548     --- dracut-010/modules.d/10i18n/console_init 2011-03-31 19:50:31.000000000 +0200
2549     +++ dracut-0e6a94b/modules.d/10i18n/console_init 2011-05-31 16:34:37.000000000 +0200
2550     @@ -61,7 +61,6 @@
2551     exec 7>>${dev}
2552     }
2553    
2554     -
2555     dev=/dev/${1#/dev/}
2556     devname=${dev#/dev/}
2557    
2558     @@ -70,8 +69,6 @@
2559     exit 1
2560     }
2561    
2562     -[ -e /tmp/console_init.${devname} ] && exit 0
2563     -
2564     dev_open ${dev}
2565    
2566     for fd in 6 7; do
2567     @@ -88,4 +85,4 @@
2568     set_keymap
2569    
2570     dev_close
2571     ->/tmp/console_init.${devname}
2572     +
2573     diff -Naur dracut-010/modules.d/10i18n/module-setup.sh dracut-0e6a94b/modules.d/10i18n/module-setup.sh
2574     --- dracut-010/modules.d/10i18n/module-setup.sh 2011-03-31 19:50:31.000000000 +0200
2575     +++ dracut-0e6a94b/modules.d/10i18n/module-setup.sh 2011-05-31 16:34:37.000000000 +0200
2576     @@ -11,6 +11,7 @@
2577     }
2578    
2579     install() {
2580     + [ -x /lib/systemd/systemd-vconsole-setup ] && dracut_install /lib/systemd/systemd-vconsole-setup
2581     KBDSUBDIRS=consolefonts,consoletrans,keymaps,unimaps
2582     DEFAULT_FONT=LatArCyrHeb-16
2583     I18N_CONF="/etc/locale.conf"
2584     @@ -177,12 +178,12 @@
2585     for kbddir in ${kbddir} /usr/lib/kbd /lib/kbd /usr/share /usr/share/kbd
2586     do
2587     [[ -d "${kbddir}" ]] && \
2588     - for dir in ${KBDSUBDIRS//,/ }
2589     + for dir in ${KBDSUBDIRS//,/ }
2590     do
2591     [[ -d "${kbddir}/${dir}" ]] && continue
2592     false
2593     done && break
2594     - kbddir=''
2595     + kbddir=''
2596     done
2597    
2598     [[ ${kbddir} ]] || {
2599     diff -Naur dracut-010/modules.d/10i18n/parse-i18n.sh dracut-0e6a94b/modules.d/10i18n/parse-i18n.sh
2600     --- dracut-010/modules.d/10i18n/parse-i18n.sh 2011-03-31 19:50:31.000000000 +0200
2601     +++ dracut-0e6a94b/modules.d/10i18n/parse-i18n.sh 2011-05-31 16:34:37.000000000 +0200
2602     @@ -20,9 +20,9 @@
2603     }
2604    
2605     inst_key_val '' /etc/vconsole.conf KEYMAP vconsole.keymap KEYTABLE
2606     -inst_key_val '' /etc/vconsole.conf FONT vconsole.font SYSFONT
2607     -inst_key_val '' /etc/vconsole.conf FONT_MAP vconsole.font.map CONTRANS
2608     -inst_key_val '' /etc/vconsole.conf FONT_UNIMAP vconsole.font.unimap UNIMAP
2609     +inst_key_val '' /etc/vconsole.conf FONT vconsole.font SYSFONT
2610     +inst_key_val '' /etc/vconsole.conf FONT_MAP vconsole.font.map CONTRANS
2611     +inst_key_val '' /etc/vconsole.conf FONT_UNIMAP vconsole.font.unimap UNIMAP
2612     inst_key_val 1 /etc/vconsole.conf UNICODE vconsole.unicode vconsole.font.unicode
2613     inst_key_val '' /etc/vconsole.conf EXT_KEYMAP vconsole.keymap.ext
2614    
2615     @@ -35,3 +35,10 @@
2616     export LC_ALL
2617     fi
2618    
2619     +# FIXME: fix systemd-vconsole-setup
2620     +#if [ -x /lib/systemd/systemd-vconsole-setup ]; then
2621     +# /lib/systemd/systemd-vconsole-setup
2622     +# rm -f /{etc,lib}/udev/rules.d/10-console.rules
2623     +# rm -f /lib/udev/console_init
2624     +# ln -s /lib/systemd/systemd-vconsole-setup /lib/udev/console_init
2625     +#fi
2626     diff -Naur dracut-010/modules.d/10i18n/README dracut-0e6a94b/modules.d/10i18n/README
2627     --- dracut-010/modules.d/10i18n/README 2011-03-31 19:50:31.000000000 +0200
2628     +++ dracut-0e6a94b/modules.d/10i18n/README 2011-05-31 16:34:37.000000000 +0200
2629     @@ -23,7 +23,7 @@
2630     the installation script we handle it by mappings between variables used
2631     by Dracut and the ones in the system. Package maintainer is expected to
2632     create those for his/her distribution and it's appreciated to share it
2633     -with us, so we can include it in source package.
2634     +with us, so we can include it in source package.
2635    
2636    
2637     1. Hostonly vs Generic
2638     diff -Naur dracut-010/modules.d/10rpmversion/module-setup.sh dracut-0e6a94b/modules.d/10rpmversion/module-setup.sh
2639     --- dracut-010/modules.d/10rpmversion/module-setup.sh 2011-03-31 19:50:31.000000000 +0200
2640     +++ dracut-0e6a94b/modules.d/10rpmversion/module-setup.sh 2011-05-31 16:34:37.000000000 +0200
2641     @@ -11,14 +11,16 @@
2642     }
2643    
2644     install() {
2645     + local _line
2646     + local _dracut_rpm_version
2647     if [ -e "$moddir/dracut-version" ]; then
2648     - dracut_rpm_version=$(cat "$moddir/dracut-version")
2649     - inst "$moddir/dracut-version" /lib/dracut/$dracut_rpm_version
2650     + _dracut_rpm_version=$(cat "$moddir/dracut-version")
2651     + inst "$moddir/dracut-version" /lib/dracut/$_dracut_rpm_version
2652     else
2653     if rpm -qf $(type -P $0) &>/dev/null; then
2654     - dracut_rpm_version=$(rpm -qf --qf '%{name}-%{version}-%{release}\n' $(type -P $0) | { ver="";while read line;do ver=$line;done;echo $ver;} )
2655     - mkdir -m 0755 -p $initdir/lib $initdir/lib/dracut
2656     - echo $dracut_rpm_version > $initdir/lib/dracut/$dracut_rpm_version
2657     + _dracut_rpm_version=$(rpm -qf --qf '%{name}-%{version}-%{release}\n' $(type -P $0) | { ver="";while read _line;do ver=$_line;done;echo $ver;} )
2658     + mkdir -m 0755 -p $initdir/lib/dracut
2659     + echo $_dracut_rpm_version > $initdir/lib/dracut/$_dracut_rpm_version
2660     fi
2661     fi
2662     inst_hook cmdline 01 "$moddir/version.sh"
2663     diff -Naur dracut-010/modules.d/40network/dhclient.conf dracut-0e6a94b/modules.d/40network/dhclient.conf
2664     --- dracut-010/modules.d/40network/dhclient.conf 2011-03-31 19:50:31.000000000 +0200
2665     +++ dracut-0e6a94b/modules.d/40network/dhclient.conf 2011-05-31 16:34:37.000000000 +0200
2666     @@ -1,3 +1,3 @@
2667     request subnet-mask, broadcast-address, time-offset, routers,
2668     domain-name, domain-name-servers, domain-search, host-name,
2669     - root-path, interface-mtu;
2670     + root-path, interface-mtu;
2671     diff -Naur dracut-010/modules.d/40network/dhclient-script dracut-0e6a94b/modules.d/40network/dhclient-script
2672     --- dracut-010/modules.d/40network/dhclient-script 2011-03-31 19:50:31.000000000 +0200
2673     +++ dracut-0e6a94b/modules.d/40network/dhclient-script 2011-05-31 16:34:37.000000000 +0200
2674     @@ -1,4 +1,4 @@
2675     -#!/bin/sh
2676     +#!/bin/sh
2677     # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
2678     # ex: ts=8 sw=4 sts=4 et filetype=sh
2679    
2680     @@ -37,17 +37,17 @@
2681     [ -n "${search}${domain}" ] && echo "search $search $domain" > /tmp/net.$netif.resolv.conf
2682     if [ -n "$namesrv" ] ; then
2683     for s in $namesrv; do
2684     - echo nameserver $s
2685     + echo nameserver $s
2686     done
2687     fi >> /tmp/net.$netif.resolv.conf
2688    
2689     [ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
2690     }
2691    
2692     -PATH=$PATH:/sbin:/usr/sbin
2693     +PATH=/usr/sbin:/usr/bin:/sbin:/bin
2694    
2695     export PS4="dhclient.$interface.$$ + "
2696     -exec >>/run/initramfs/initlog.pipe 2>>/run/initramfs/initlog.pipe
2697     +exec >>/run/initramfs/loginit.pipe 2>>/run/initramfs/loginit.pipe
2698     type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
2699    
2700     # We already need a set netif here
2701     @@ -68,13 +68,13 @@
2702     warn "Duplicate address detected for $new_ip_address while doing dhcp. retrying"
2703     exit 1
2704     fi
2705     - setup_interface
2706     + setup_interface
2707     set | while read line; do
2708     [ "${line#new_}" = "$line" ] && continue
2709     - echo "$line"
2710     + echo "$line"
2711     done >/tmp/dhclient.$netif.dhcpopts
2712     echo online > /sys/class/net/$netif/uevent
2713     - /sbin/initqueue --onetime --name netroot-$netif /sbin/netroot $netif
2714     + initqueue --onetime --name netroot-$netif netroot $netif
2715     ;;
2716     *) echo "dhcp: $reason";;
2717     esac
2718     diff -Naur dracut-010/modules.d/40network/ifup dracut-0e6a94b/modules.d/40network/ifup
2719     --- dracut-010/modules.d/40network/ifup 2011-03-31 19:50:31.000000000 +0200
2720     +++ dracut-0e6a94b/modules.d/40network/ifup 2011-05-31 16:34:37.000000000 +0200
2721     @@ -5,13 +5,13 @@
2722     # We don't need to check for ip= errors here, that is handled by the
2723     # cmdline parser script
2724     #
2725     -PATH=$PATH:/sbin:/usr/sbin
2726     +PATH=/usr/sbin:/usr/bin:/sbin:/bin
2727    
2728     type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
2729    
2730     # Run dhclient
2731     do_dhcp() {
2732     - # /sbin/dhclient-script will mark the netif up and generate the online
2733     + # dhclient-script will mark the netif up and generate the online
2734     # event for nfsroot
2735     # XXX add -V vendor class and option parsing per kernel
2736     echo "Starting dhcp for interface $netif"
2737     @@ -32,10 +32,10 @@
2738     do_ipv6auto() {
2739     load_ipv6
2740     {
2741     - echo 0 > /proc/sys/net/ipv6/conf/$netif/forwarding
2742     + echo 0 > /proc/sys/net/ipv6/conf/$netif/forwarding
2743     echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_ra
2744     echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_redirects
2745     - echo ip link set $netif up
2746     + echo ip link set $netif up
2747     echo wait_for_if_up $netif
2748     } > /tmp/net.$netif.up
2749    
2750     @@ -44,13 +44,13 @@
2751     namesrv=$(getargs nameserver)
2752     if [ -n "$namesrv" ] ; then
2753     for s in $namesrv; do
2754     - echo nameserver $s
2755     + echo nameserver $s
2756     done
2757     fi >> /tmp/net.$netif.resolv.conf
2758    
2759    
2760     echo online > /sys/class/net/$netif/uevent
2761     - /sbin/initqueue --onetime --name netroot-$netif /sbin/netroot $netif
2762     + initqueue --onetime --name netroot-$netif netroot $netif
2763     }
2764    
2765     # Handle static ip configuration
2766     @@ -58,7 +58,7 @@
2767     strstr $ip '*:*:*' && load_ipv6
2768    
2769     {
2770     - echo ip link set $netif up
2771     + echo ip link set $netif up
2772     echo wait_for_if_up $netif
2773     # do not flush addr for ipv6
2774     strstr $ip '*:*:*' || \
2775     @@ -72,18 +72,16 @@
2776     namesrv=$(getargs nameserver)
2777     if [ -n "$namesrv" ] ; then
2778     for s in $namesrv; do
2779     - echo nameserver $s
2780     + echo nameserver $s
2781     done
2782     fi >> /tmp/net.$netif.resolv.conf
2783    
2784     echo online > /sys/class/net/$netif/uevent
2785     - /sbin/initqueue --onetime --name netroot-$netif /sbin/netroot $netif
2786     + initqueue --onetime --name netroot-$netif netroot $netif
2787     }
2788    
2789     -PATH=$PATH:/sbin:/usr/sbin
2790     -
2791     export PS4="ifup.$1.$$ + "
2792     -exec >>/run/initramfs/initlog.pipe 2>>/run/initramfs/initlog.pipe
2793     +exec >>/run/initramfs/loginit.pipe 2>>/run/initramfs/loginit.pipe
2794     type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
2795    
2796     # Huh? No $1?
2797     @@ -181,7 +179,7 @@
2798     # start bridge if necessary
2799     if [ "$netif" = "$bridgename" ] && [ ! -e /tmp/net.$bridgename.up ]; then
2800     if [ "$ethname" = "$bondname" ] ; then
2801     - DO_BOND_SETUP=yes /sbin/ifup $bondname
2802     + DO_BOND_SETUP=yes ifup $bondname
2803     else
2804     ip link set $ethname up
2805     fi
2806     @@ -225,7 +223,7 @@
2807     do_dhcp -6 ;;
2808     auto6)
2809     do_ipv6auto ;;
2810     - *)
2811     + *)
2812     do_static ;;
2813     esac
2814     break
2815     diff -Naur dracut-010/modules.d/40network/module-setup.sh dracut-0e6a94b/modules.d/40network/module-setup.sh
2816     --- dracut-010/modules.d/40network/module-setup.sh 2011-03-31 19:50:31.000000000 +0200
2817     +++ dracut-0e6a94b/modules.d/40network/module-setup.sh 2011-05-31 16:34:37.000000000 +0200
2818     @@ -3,11 +3,12 @@
2819     # ex: ts=8 sw=4 sts=4 et filetype=sh
2820    
2821     check() {
2822     + local _program
2823     . $dracutfunctions
2824    
2825     - for program in ip arping dhclient ; do
2826     - if ! type -P $program >/dev/null; then
2827     - derror "Could not find program \"$program\" required by network."
2828     + for _program in ip arping dhclient ; do
2829     + if ! type -P $_program >/dev/null; then
2830     + derror "Could not find program \"$_program\" required by network."
2831     return 1
2832     fi
2833     done
2834     @@ -24,11 +25,11 @@
2835     # Include wired net drivers, excluding wireless
2836    
2837     net_module_test() {
2838     - local net_drivers='eth_type_trans|register_virtio_device'
2839     - local unwanted_drivers='/(wireless|isdn|uwb)/'
2840     - egrep -q $net_drivers "$1" && \
2841     + local _net_drivers='eth_type_trans|register_virtio_device'
2842     + local _unwanted_drivers='/(wireless|isdn|uwb)/'
2843     + egrep -q $_net_drivers "$1" && \
2844     egrep -qv 'iw_handler_get_spy' "$1" && \
2845     - [[ ! $1 =~ $unwanted_drivers ]]
2846     + [[ ! $1 =~ $_unwanted_drivers ]]
2847     }
2848    
2849     instmods $(filter_kernel_modules net_module_test)
2850     @@ -42,12 +43,13 @@
2851     }
2852    
2853     install() {
2854     - dracut_install ip arping tr dhclient
2855     + local _arch _i _dir
2856     + dracut_install ip arping tr dhclient
2857     dracut_install -o brctl ifenslave
2858     inst "$moddir/ifup" "/sbin/ifup"
2859     inst "$moddir/netroot" "/sbin/netroot"
2860     inst "$moddir/dhclient-script" "/sbin/dhclient-script"
2861     - inst "$moddir/dhclient.conf" "/etc/dhclient.conf"
2862     + inst "$moddir/dhclient.conf" "/etc/dhclient.conf"
2863     inst_hook pre-udev 50 "$moddir/ifname-genrules.sh"
2864     inst_hook pre-udev 60 "$moddir/net-genrules.sh"
2865     inst_hook cmdline 91 "$moddir/dhcp-root.sh"
2866     @@ -57,12 +59,12 @@
2867     inst_hook cmdline 99 "$moddir/parse-ifname.sh"
2868     inst_hook pre-pivot 10 "$moddir/kill-dhclient.sh"
2869    
2870     - arch=$(uname -m)
2871     + _arch=$(uname -m)
2872    
2873     - for dir in "$usrlibdir/tls/$arch" "$usrlibdir/tls" "$usrlibdir/$arch" \
2874     + for _dir in "$usrlibdir/tls/$_arch" "$usrlibdir/tls" "$usrlibdir/$_arch" \
2875     "$usrlibdir" "$libdir"; do
2876     - for i in "$dir"/libnss_dns.so.* "$dir"/libnss_mdns4_minimal.so.*; do
2877     - [ -e "$i" ] && dracut_install "$i"
2878     + for _i in "$_dir"/libnss_dns.so.* "$_dir"/libnss_mdns4_minimal.so.*; do
2879     + [ -e "$_i" ] && dracut_install "$_i"
2880     done
2881     done
2882    
2883     diff -Naur dracut-010/modules.d/40network/net-genrules.sh dracut-0e6a94b/modules.d/40network/net-genrules.sh
2884     --- dracut-010/modules.d/40network/net-genrules.sh 2011-03-31 19:50:31.000000000 +0200
2885     +++ dracut-0e6a94b/modules.d/40network/net-genrules.sh 2011-05-31 16:34:37.000000000 +0200
2886     @@ -40,12 +40,12 @@
2887     # If we have to handle multiple interfaces, handle only them.
2888     elif [ -n "$IFACES" ] ; then
2889     for iface in $IFACES ; do
2890     - printf 'ACTION=="add", SUBSYSTEM=="net", ENV{INTERFACE}=="%s", RUN+="/sbin/ifup $env{INTERFACE}"\n' "$iface"
2891     + printf 'SUBSYSTEM=="net", ENV{INTERFACE}=="%s", RUN+="/sbin/ifup $env{INTERFACE}"\n' "$iface"
2892     done
2893    
2894     # Default: We don't know the interface to use, handle all
2895     else
2896     - printf 'ACTION=="add", SUBSYSTEM=="net", RUN+="/sbin/ifup $env{INTERFACE}"\n'
2897     + printf 'SUBSYSTEM=="net", RUN+="/sbin/ifup $env{INTERFACE}"\n'
2898     fi
2899    
2900     } > /etc/udev/rules.d/60-net.rules
2901     diff -Naur dracut-010/modules.d/40network/netroot dracut-0e6a94b/modules.d/40network/netroot
2902     --- dracut-010/modules.d/40network/netroot 2011-03-31 19:50:31.000000000 +0200
2903     +++ dracut-0e6a94b/modules.d/40network/netroot 2011-05-31 16:34:37.000000000 +0200
2904     @@ -2,7 +2,7 @@
2905     # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
2906     # ex: ts=8 sw=4 sts=4 et filetype=sh
2907    
2908     -PATH=$PATH:/sbin:/usr/sbin
2909     +PATH=/usr/sbin:/usr/bin:/sbin:/bin
2910    
2911     type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
2912    
2913     @@ -20,18 +20,18 @@
2914     [ -z "$netroot" ] && exit 1
2915    
2916     # Let's see if we have to wait for other interfaces
2917     -# Note: exit works just fine, since the last interface to be
2918     +# Note: exit works just fine, since the last interface to be
2919     # online'd should see all files
2920     [ -e "/tmp/net.ifaces" ] && read IFACES < /tmp/net.ifaces
2921     for iface in $IFACES ; do
2922     [ -e /tmp/net.$iface.up ] || exit 1
2923     done
2924    
2925     -# Set or override primary interface
2926     +# Set or override primary interface
2927     netif=$1
2928     [ -e "/tmp/net.bootdev" ] && read netif < /tmp/net.bootdev
2929    
2930     -# Figure out the handler for root=dhcp by recalling all netroot cmdline
2931     +# Figure out the handler for root=dhcp by recalling all netroot cmdline
2932     # handlers
2933     if [ "$netroot" = "dhcp" ] || [ "$netroot" = "dhcp6" ] ; then
2934     # Unset root so we can check later
2935     @@ -40,7 +40,7 @@
2936     # Load dhcp options
2937     [ -e /tmp/dhclient.$netif.dhcpopts ] && . /tmp/dhclient.$netif.dhcpopts
2938    
2939     - # If we have a specific bootdev with no dhcpoptions or empty root-path,
2940     + # If we have a specific bootdev with no dhcpoptions or empty root-path,
2941     # we die. Otherwise we just warn
2942     if [ -z "$new_root_path" ] ; then
2943     [ -n "$BOOTDEV" ] && die "No dhcp root-path received for '$BOOTDEV'"
2944     @@ -55,7 +55,7 @@
2945     for f in $hookdir/cmdline/90*.sh; do
2946     [ -f "$f" ] && . "$f";
2947     done
2948     -else
2949     +else
2950     rootok="1"
2951     fi
2952    
2953     @@ -65,7 +65,7 @@
2954    
2955     handler=${netroot%%:*}
2956     handler=${handler%%4}
2957     -handler="/sbin/${handler}root"
2958     +handler=$(command -v ${handler}root)
2959     if [ -z "$netroot" ] || [ ! -e "$handler" ] ; then
2960     die "No handler for netroot type '$netroot'"
2961     fi
2962     @@ -89,7 +89,7 @@
2963     # Note: This assumes that if no router is present the
2964     # root server is on the same subnet.
2965     #
2966     -# TODO There's some netroot variants that don't (yet) have their
2967     +# TODO There's some netroot variants that don't (yet) have their
2968     # server-ip netroot
2969    
2970     # Get router IP if set
2971     @@ -136,7 +136,7 @@
2972    
2973     # Save used netif for later use
2974     [ ! -f /tmp/net.ifaces ] && echo $netif > /tmp/net.ifaces
2975     -else
2976     +else
2977     warn "Mounting root via '$netif' failed"
2978     # If we're trying with multiple interfaces, put that one down.
2979     # ip down/flush ensures that routeing info goes away as well
2980     diff -Naur dracut-010/modules.d/40network/parse-bond.sh dracut-0e6a94b/modules.d/40network/parse-bond.sh
2981     --- dracut-010/modules.d/40network/parse-bond.sh 2011-03-31 19:50:31.000000000 +0200
2982     +++ dracut-0e6a94b/modules.d/40network/parse-bond.sh 2011-05-31 16:34:37.000000000 +0200
2983     @@ -13,7 +13,7 @@
2984     # return if bond already parsed
2985     [ -n "$bondname" ] && return
2986    
2987     -# Check if bond parameter is valid
2988     +# Check if bond parameter is valid
2989     if getarg bond= >/dev/null ; then
2990     if [ -z "$netroot" ] ; then
2991     die "No netboot configured, bond is invalid"
2992     @@ -46,7 +46,7 @@
2993     if getarg bond >/dev/null; then
2994     # Read bond= parameters if they exist
2995     bond="$(getarg bond=)"
2996     - if [ ! "$bond" = "bond" ]; then
2997     + if [ ! "$bond" = "bond" ]; then
2998     parsebond "$(getarg bond=)"
2999     fi
3000     # Simple default bond
3001     diff -Naur dracut-010/modules.d/40network/parse-bridge.sh dracut-0e6a94b/modules.d/40network/parse-bridge.sh
3002     --- dracut-010/modules.d/40network/parse-bridge.sh 2011-03-31 19:50:31.000000000 +0200
3003     +++ dracut-0e6a94b/modules.d/40network/parse-bridge.sh 2011-05-31 16:34:37.000000000 +0200
3004     @@ -11,7 +11,7 @@
3005     # return if bridge already parsed
3006     [ -n "$bridgename" ] && return
3007    
3008     -# Check if bridge parameter is valid
3009     +# Check if bridge parameter is valid
3010     if getarg bridge= >/dev/null ; then
3011     if [ -z "$netroot" ] ; then
3012     die "No netboot configured, bridge is invalid"
3013     @@ -49,7 +49,7 @@
3014     if getarg bridge >/dev/null; then
3015     # Read bridge= parameters if they exist
3016     bridge="$(getarg bridge=)"
3017     - if [ ! "$bridge" = "bridge" ]; then
3018     + if [ ! "$bridge" = "bridge" ]; then
3019     parsebridge "$(getarg bridge=)"
3020     fi
3021     # Simple default bridge
3022     diff -Naur dracut-010/modules.d/40network/parse-ip-opts.sh dracut-0e6a94b/modules.d/40network/parse-ip-opts.sh
3023     --- dracut-010/modules.d/40network/parse-ip-opts.sh 2011-03-31 19:50:31.000000000 +0200
3024     +++ dracut-0e6a94b/modules.d/40network/parse-ip-opts.sh 2011-05-31 16:34:37.000000000 +0200
3025     @@ -52,17 +52,26 @@
3026     fi
3027    
3028     if [ "ibft" = "$(getarg ip=)" ]; then
3029     - modprobe ibft
3030     + modprobe iscsi_ibft
3031     num=0
3032     - (
3033     + (
3034     for iface in /sys/firmware/ibft/ethernet*; do
3035     [ -e ${iface}/mac ] || continue
3036     ifname_mac=$(read a < ${iface}/mac; echo $a)
3037     - [ -z "$ifname_mac" ] || continue
3038     - ifname_if=ibft$num
3039     - num=$(( $num + 1 ))
3040     - echo "ifname=$ifname_if:$ifname_mac"
3041     - dev=$ifname_if
3042     + [ -z "$ifname_mac" ] && continue
3043     + unset dev
3044     + for ifname in $(getargs ifname=); do
3045     + if strstr "$ifname" "$ifname_mac"; then
3046     + dev=${ifname%%:*}
3047     + break
3048     + fi
3049     + done
3050     + if [ -z "$dev" ]; then
3051     + ifname_if=ibft$num
3052     + num=$(( $num + 1 ))
3053     + echo "ifname=$ifname_if:$ifname_mac"
3054     + dev=$ifname_if
3055     + fi
3056    
3057     dhcp=$(read a < ${iface}/dhcp; echo $a)
3058     if [ -n "$dhcp" ]; then
3059     @@ -147,7 +156,7 @@
3060     done
3061    
3062     # This ensures that BOOTDEV is always first in IFACES
3063     -if [ -n "$BOOTDEV" ] && [ -n "$IFACES" ] ; then
3064     +if [ -n "$BOOTDEV" ] && [ -n "$IFACES" ] ; then
3065     IFACES="${IFACES%$BOOTDEV*} ${IFACES#*$BOOTDEV}"
3066     IFACES="$BOOTDEV $IFACES"
3067     fi
3068     @@ -156,5 +165,5 @@
3069     [ -n "$BOOTDEV" ] && echo $BOOTDEV > /tmp/net.bootdev
3070     [ -n "$IFACES" ] && echo $IFACES > /tmp/net.ifaces
3071    
3072     -# We need a ip= line for the configured bootdev=
3073     +# We need a ip= line for the configured bootdev=
3074     [ -n "$NEEDBOOTDEV" ] && [ -z "$BOOTDEVOK" ] && die "Bootdev Argument '$BOOTDEV' not found"
3075     diff -Naur dracut-010/modules.d/45ifcfg/write-ifcfg.sh dracut-0e6a94b/modules.d/45ifcfg/write-ifcfg.sh
3076     --- dracut-010/modules.d/45ifcfg/write-ifcfg.sh 2011-03-31 19:50:31.000000000 +0200
3077     +++ dracut-0e6a94b/modules.d/45ifcfg/write-ifcfg.sh 2011-05-31 16:34:37.000000000 +0200
3078     @@ -17,7 +17,7 @@
3079     . /tmp/bridge.info
3080     fi
3081    
3082     -mkdir -p /tmp/ifcfg/
3083     +mkdir -m 0755 -p /tmp/ifcfg/
3084    
3085     for netif in $IFACES ; do
3086     # bridge?
3087     @@ -31,18 +31,18 @@
3088     fi
3089     cat /sys/class/net/$netif/address > /tmp/net.$netif.hwaddr
3090     {
3091     - echo "# Generated by dracut initrd"
3092     + echo "# Generated by dracut initrd"
3093     echo "DEVICE=$netif"
3094     echo "ONBOOT=yes"
3095     echo "NETBOOT=yes"
3096     if [ -f /tmp/net.$netif.lease ]; then
3097     strstr "$ip" '*:*:*' &&
3098     - echo "DHCPV6C=yes"
3099     - echo "BOOTPROTO=dhcp"
3100     + echo "DHCPV6C=yes"
3101     + echo "BOOTPROTO=dhcp"
3102     else
3103     - echo "BOOTPROTO=none"
3104     + echo "BOOTPROTO=none"
3105     # If we've booted with static ip= lines, the override file is there
3106     - . /tmp/net.$netif.override
3107     + [ -e /tmp/net.$netif.override ] && . /tmp/net.$netif.override
3108     echo "IPADDR=$ip"
3109     echo "NETMASK=$mask"
3110     [ -n "$gw" ] && echo "GATEWAY=$gw"
3111     @@ -55,7 +55,7 @@
3112     {
3113     echo "HWADDR=$(cat /sys/class/net/$netif/address)"
3114     echo "TYPE=Ethernet"
3115     - echo "NAME=\"Boot Disk\""
3116     + echo "NAME=\"Boot Disk\""
3117     } >> /tmp/ifcfg/ifcfg-$netif
3118     fi
3119    
3120     @@ -88,7 +88,7 @@
3121     # bridge
3122     {
3123     echo "TYPE=Bridge"
3124     - echo "NAME=\"Boot Disk\""
3125     + echo "NAME=\"Boot Disk\""
3126     } >> /tmp/ifcfg/ifcfg-$netif
3127     if [ "$ethname" = "$bondname" ] ; then
3128     {
3129     @@ -100,7 +100,7 @@
3130     # This variable is an indicator of a bond interface for initscripts
3131     echo "BONDING_OPTS=\"$bondoptions\""
3132     echo "BRIDGE=$netif"
3133     - echo "NAME=\"$bondname\""
3134     + echo "NAME=\"$bondname\""
3135     } >> /tmp/ifcfg/ifcfg-$bondname
3136     for slave in $bondslaves ; do
3137     # write separate ifcfg file for the raw eth interface
3138     @@ -134,9 +134,11 @@
3139     done
3140    
3141     # Pass network opts
3142     -mkdir -p /run/initramfs
3143     +[ -d /run/initramfs ] || mkdir -m 0755 -p /run/initramfs
3144     cp /tmp/net.* /run/initramfs/ >/dev/null 2>&1
3145     -mkdir -p /run/initramfs/state/etc/sysconfig/network-scripts/
3146     +for i in /run/initramfs/state /run/initramfs/state/etc/ /run/initramfs/state/etc/sysconfig /run/initramfs/state/etc/sysconfig/network-scripts; do
3147     + [ -d $i ] || mkdir -m 0755 -p $i
3148     +done
3149     cp /tmp/net.$netif.resolv.conf /run/initramfs/state/etc/ >/dev/null 2>&1
3150     echo "files /etc/sysconfig/network-scripts" > /run/initramfs/rwtab
3151     -cp -a /tmp/ifcfg/* /run/initramfs/state/etc/sysconfig/network-scripts/ >/dev/null 2>&1
3152     +cp -a -t /run/initramfs/state/etc/sysconfig/network-scripts/ /tmp/ifcfg/* >/dev/null 2>&1
3153     diff -Naur dracut-010/modules.d/50gensplash/gensplash-pretrigger.sh dracut-0e6a94b/modules.d/50gensplash/gensplash-pretrigger.sh
3154     --- dracut-010/modules.d/50gensplash/gensplash-pretrigger.sh 2011-03-31 19:50:31.000000000 +0200
3155     +++ dracut-0e6a94b/modules.d/50gensplash/gensplash-pretrigger.sh 2011-05-31 16:34:37.000000000 +0200
3156     @@ -9,8 +9,9 @@
3157    
3158     info "Starting Gentoo Splash"
3159    
3160     - [ -x /lib/udev/console_init ] && /lib/udev/console_init tty0
3161     + [ -x /lib/udev/console_init ] && /lib/udev/console_init /dev/tty0
3162     CDROOT=0
3163     . /lib/gensplash-lib.sh
3164     splash init
3165     + [ -x /lib/udev/console_init ] && /lib/udev/console_init /dev/tty0
3166     fi
3167     diff -Naur dracut-010/modules.d/50gensplash/module-setup.sh dracut-0e6a94b/modules.d/50gensplash/module-setup.sh
3168     --- dracut-010/modules.d/50gensplash/module-setup.sh 2011-03-31 19:50:31.000000000 +0200
3169     +++ dracut-0e6a94b/modules.d/50gensplash/module-setup.sh 2011-05-31 16:34:37.000000000 +0200
3170     @@ -13,55 +13,57 @@
3171     }
3172    
3173     install() {
3174     + local _opts
3175     + local _splash_theme
3176     + local _splash_res
3177     +
3178     call_splash_geninitramfs() {
3179     - local out ret
3180     + local _out _ret
3181    
3182     - out=$(splash_geninitramfs -c "$1" ${@:2} 2>&1)
3183     - ret=$?
3184     + _out=$(splash_geninitramfs -c "$1" ${@:2} 2>&1)
3185     + _ret=$?
3186    
3187     - if [[ ${out} ]]; then
3188     + if [[ ${_out} ]]; then
3189     local IFS='
3190     '
3191     - for line in ${out}; do
3192     + for line in ${_out}; do
3193     if [[ ${line} =~ ^Warning ]]; then
3194     dwarn "${line}"
3195     else
3196     derror "${line}"
3197     - (( ret == 0 )) && ret=1
3198     + (( $_ret == 0 )) && _ret=1
3199     fi
3200     done
3201     fi
3202    
3203     - return ${ret}
3204     + return ${_ret}
3205     }
3206    
3207     -
3208     type -P splash_geninitramfs >/dev/null || return 1
3209    
3210     - opts=''
3211     -
3212     + _opts=''
3213     if [[ ${DRACUT_GENSPLASH_THEME} ]]; then
3214     # Variables from the environment
3215     # They're supposed to be set up by e.g. Genkernel in basis of cmdline args.
3216     # If user set them he/she would expect to be included only given theme
3217     # rather then all even if we're building generic initramfs.
3218     - SPLASH_THEME=${DRACUT_GENSPLASH_THEME}
3219     - SPLASH_RES=${DRACUT_GENSPLASH_RES}
3220     + _splash_theme=${DRACUT_GENSPLASH_THEME}
3221     + _splash_res=${DRACUT_GENSPLASH_RES}
3222     elif [[ ${hostonly} ]]; then
3223     # Settings from config only in hostonly
3224     [[ -e /etc/conf.d/splash ]] && source /etc/conf.d/splash
3225     - [[ ! ${SPLASH_THEME} ]] && SPLASH_THEME=default
3226     - [[ ${SPLASH_RES} ]] && opts+=" -r ${SPLASH_RES}"
3227     + [[ ! ${_splash_theme} ]] && _splash_theme=default
3228     + [[ ${_splash_res} ]] && _opts+=" -r ${_splash_res}"
3229     else
3230     # generic
3231     - SPLASH_THEME=--all
3232     + _splash_theme=--all
3233     fi
3234    
3235     - dinfo "Installing Gentoo Splash (using the ${SPLASH_THEME} theme)"
3236     + dinfo "Installing Gentoo Splash (using the ${_splash_theme} theme)"
3237    
3238     pushd "${initdir}" >/dev/null
3239     mv dev dev.old
3240     - call_splash_geninitramfs "${initdir}" ${opts} ${SPLASH_THEME} || {
3241     + call_splash_geninitramfs "${initdir}" ${_opts} ${_splash_theme} || {
3242     derror "Could not build splash"
3243     return 1
3244     }
3245     diff -Naur dracut-010/modules.d/50plymouth/module-setup.sh dracut-0e6a94b/modules.d/50plymouth/module-setup.sh
3246     --- dracut-010/modules.d/50plymouth/module-setup.sh 2011-03-31 19:50:31.000000000 +0200
3247     +++ dracut-0e6a94b/modules.d/50plymouth/module-setup.sh 2011-05-31 16:34:37.000000000 +0200
3248     @@ -11,9 +11,10 @@
3249     }
3250    
3251     installkernel() {
3252     + local _modname
3253     # Include KMS capable drm drivers
3254     - for modname in $(find "$srcmods/kernel/drivers/gpu/drm" "$srcmods/extra" -name '*.ko' 2>/dev/null); do
3255     - grep -q drm_crtc_init $modname && instmods $modname
3256     + for _modname in $(find "$srcmods/kernel/drivers/gpu/drm" "$srcmods/extra" -name '*.ko' 2>/dev/null); do
3257     + grep -q drm_crtc_init $_modname && instmods $_modname
3258     done
3259     }
3260    
3261     diff -Naur dracut-010/modules.d/50plymouth/plymouth-populate-initrd dracut-0e6a94b/modules.d/50plymouth/plymouth-populate-initrd
3262     --- dracut-010/modules.d/50plymouth/plymouth-populate-initrd 2011-03-31 19:50:31.000000000 +0200
3263     +++ dracut-0e6a94b/modules.d/50plymouth/plymouth-populate-initrd 2011-05-31 16:34:37.000000000 +0200
3264     @@ -7,11 +7,11 @@
3265     inst /sbin/plymouthd /bin/plymouthd
3266     dracut_install /bin/plymouth \
3267     "${PLYMOUTH_LOGO_FILE}" \
3268     - /etc/system-release
3269     + /etc/system-release
3270    
3271     -mkdir -p "${initdir}/usr/share/plymouth"
3272     +mkdir -m 0755 -p "${initdir}/usr/share/plymouth"
3273    
3274     -if [[ $hostonly ]]; then
3275     +if [[ $hostonly ]]; then
3276     dracut_install "${usrlibdir}/plymouth/text.so" \
3277     "${usrlibdir}/plymouth/details.so" \
3278     "/usr/share/plymouth/themes/details/details.plymouth" \
3279     @@ -34,7 +34,7 @@
3280     for x in /usr/share/plymouth/themes/{text,details}/* ; do
3281     [[ -f "$x" ]] || continue
3282     THEME_DIR=$(dirname "$x")
3283     - mkdir -p "${initdir}/$THEME_DIR"
3284     + mkdir -m 0755 -p "${initdir}/$THEME_DIR"
3285     dracut_install "$x"
3286     done
3287     for x in "${usrlibdir}"/plymouth/{text,details}.so ; do
3288     @@ -44,6 +44,6 @@
3289     done
3290     (
3291     cd ${initdir}/usr/share/plymouth/themes;
3292     - ln -s text/text.plymouth default.plymouth 2>&1;
3293     + ln -s text/text.plymouth default.plymouth 2>&1;
3294     )
3295     fi
3296     diff -Naur dracut-010/modules.d/50plymouth/plymouth-pretrigger.sh dracut-0e6a94b/modules.d/50plymouth/plymouth-pretrigger.sh
3297     --- dracut-010/modules.d/50plymouth/plymouth-pretrigger.sh 2011-03-31 19:50:31.000000000 +0200
3298     +++ dracut-0e6a94b/modules.d/50plymouth/plymouth-pretrigger.sh 2011-05-31 16:34:37.000000000 +0200
3299     @@ -17,8 +17,10 @@
3300     [ -e /dev/fb ] || ln -s fb0 /dev/fb
3301    
3302     info "Starting plymouth daemon"
3303     - mkdir -m 0755 -p /run/plymouth
3304     + mkdir -m 0755 /run/plymouth
3305     + [ -x /lib/udev/console_init ] && /lib/udev/console_init /dev/tty0
3306     [ -x /bin/plymouthd ] && /bin/plymouthd --attach-to-session --pid-file /run/plymouth/pid
3307     - [ -x /lib/udev/console_init ] && /lib/udev/console_init tty0
3308     /bin/plymouth --show-splash 2>&1 | vinfo
3309     + # reset tty after plymouth messed with it
3310     + [ -x /lib/udev/console_init ] && /lib/udev/console_init /dev/tty0
3311     fi
3312     diff -Naur dracut-010/modules.d/60xen/module-setup.sh dracut-0e6a94b/modules.d/60xen/module-setup.sh
3313     --- dracut-010/modules.d/60xen/module-setup.sh 2011-03-31 19:50:31.000000000 +0200
3314     +++ dracut-0e6a94b/modules.d/60xen/module-setup.sh 2011-05-31 16:34:37.000000000 +0200
3315     @@ -23,11 +23,12 @@
3316     }
3317    
3318     installkernel() {
3319     - for i in \
3320     + local _i
3321     + for _i in \
3322     xenbus_probe_frontend xen-pcifront \
3323     xen-fbfront xen-kbdfront xen-blkfront xen-netfront \
3324     ; do
3325     - modinfo -k $kernel $i >/dev/null 2>&1 && instmods $i
3326     + modinfo -k $kernel $_i >/dev/null 2>&1 && instmods $_i
3327     done
3328    
3329     }
3330     diff -Naur dracut-010/modules.d/90btrfs/module-setup.sh dracut-0e6a94b/modules.d/90btrfs/module-setup.sh
3331     --- dracut-010/modules.d/90btrfs/module-setup.sh 2011-03-31 19:50:31.000000000 +0200
3332     +++ dracut-0e6a94b/modules.d/90btrfs/module-setup.sh 2011-05-31 16:34:37.000000000 +0200
3333     @@ -3,6 +3,7 @@
3334     # ex: ts=8 sw=4 sts=4 et filetype=sh
3335    
3336     check() {
3337     + local _rootdev
3338     # if we don't have btrfs installed on the host system,
3339     # no point in trying to support it in the initramfs.
3340     type -P btrfs >/dev/null || return 1
3341     @@ -13,9 +14,9 @@
3342     is_btrfs() { get_fs_type /dev/block/$1 | grep -q btrfs; }
3343    
3344     if [[ $hostonly ]]; then
3345     - rootdev=$(find_root_block_device)
3346     - if [[ $rootdev ]]; then
3347     - is_btrfs "$rootdev" || return 1
3348     + _rootdev=$(find_root_block_device)
3349     + if [[ $_rootdev ]]; then
3350     + is_btrfs "$_rootdev" || return 1
3351     fi
3352     fi
3353    
3354     diff -Naur dracut-010/modules.d/90crypt/crypt-lib.sh dracut-0e6a94b/modules.d/90crypt/crypt-lib.sh
3355     --- dracut-010/modules.d/90crypt/crypt-lib.sh 2011-03-31 19:50:31.000000000 +0200
3356     +++ dracut-0e6a94b/modules.d/90crypt/crypt-lib.sh 2011-05-31 16:34:37.000000000 +0200
3357     @@ -2,7 +2,79 @@
3358     # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
3359     # ex: ts=8 sw=4 sts=4 et filetype=sh
3360    
3361     -type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
3362     +command -v getarg >/dev/null || . /lib/dracut-lib.sh
3363     +
3364     +# ask_for_password
3365     +#
3366     +# Wraps around plymouth ask-for-password and adds fallback to tty password ask
3367     +# if plymouth is not present.
3368     +#
3369     +# --cmd command
3370     +# Command to execute. Required.
3371     +# --prompt prompt
3372     +# Password prompt. Note that function already adds ':' at the end.
3373     +# Recommended.
3374     +# --tries n
3375     +# How many times repeat command on its failure. Default is 3.
3376     +# --ply-[cmd|prompt|tries]
3377     +# Command/prompt/tries specific for plymouth password ask only.
3378     +# --tty-[cmd|prompt|tries]
3379     +# Command/prompt/tries specific for tty password ask only.
3380     +# --tty-echo-off
3381     +# Turn off input echo before tty command is executed and turn on after.
3382     +# It's useful when password is read from stdin.
3383     +ask_for_password() {
3384     + local cmd; local prompt; local tries=3
3385     + local ply_cmd; local ply_prompt; local ply_tries=3
3386     + local tty_cmd; local tty_prompt; local tty_tries=3
3387     + local ret
3388     +
3389     + while [ $# -gt 0 ]; do
3390     + case "$1" in
3391     + --cmd) ply_cmd="$2"; tty_cmd="$2" shift;;
3392     + --ply-cmd) ply_cmd="$2"; shift;;
3393     + --tty-cmd) tty_cmd="$2"; shift;;
3394     + --prompt) ply_prompt="$2"; tty_prompt="$2" shift;;
3395     + --ply-prompt) ply_prompt="$2"; shift;;
3396     + --tty-prompt) tty_prompt="$2"; shift;;
3397     + --tries) ply_tries="$2"; tty_tries="$2"; shift;;
3398     + --ply-tries) ply_tries="$2"; shift;;
3399     + --tty-tries) tty_tries="$2"; shift;;
3400     + --tty-echo-off) tty_echo_off=yes;;
3401     + esac
3402     + shift
3403     + done
3404     +
3405     + { flock -s 9;
3406     + # Prompt for password with plymouth, if installed and running.
3407     + if [ -x /bin/plymouth ] && /bin/plymouth --has-active-vt; then
3408     + /bin/plymouth ask-for-password \
3409     + --prompt "$ply_prompt" --number-of-tries=$ply_tries \
3410     + --command="$ply_cmd"
3411     + ret=$?
3412     + else
3413     + if [ "$tty_echo_off" = yes ]; then
3414     + stty_orig="$(stty -g)"
3415     + stty -echo
3416     + fi
3417     +
3418     + local i=1
3419     + while [ $i -le $tty_tries ]; do
3420     + [ -n "$tty_prompt" ] && \
3421     + printf "$tty_prompt [$i/$tty_tries]:" >&2
3422     + eval "$tty_cmd" && ret=0 && break
3423     + ret=$?
3424     + i=$(($i+1))
3425     + [ -n "$tty_prompt" ] && printf '\n' >&2
3426     + done
3427     +
3428     + [ "$tty_echo_off" = yes ] && stty $stty_orig
3429     + fi
3430     + } 9>/.console.lock
3431     +
3432     + [ $ret -ne 0 ] && echo "Wrong password" >&2
3433     + return $ret
3434     +}
3435    
3436     # Try to mount specified device (by path, by UUID or by label) and check
3437     # the path with 'test'.
3438     @@ -118,3 +190,33 @@
3439    
3440     return 1
3441     }
3442     +
3443     +# readkey keypath keydev device
3444     +#
3445     +# Mounts <keydev>, reads key from file <keypath>, optionally processes it (e.g.
3446     +# if encrypted with GPG) and prints to standard output which is supposed to be
3447     +# read by cryptsetup. <device> is just passed to helper function for
3448     +# informational purpose.
3449     +readkey() {
3450     + local keypath="$1"
3451     + local keydev="$2"
3452     + local device="$3"
3453     +
3454     + local mntp=$(mkuniqdir /mnt keydev)
3455     + mount -r "$keydev" "$mntp" || die 'Mounting rem. dev. failed!'
3456     +
3457     + case "${keypath##*.}" in
3458     + gpg)
3459     + if [ -f /lib/dracut-crypt-gpg-lib.sh ]; then
3460     + . /lib/dracut-crypt-gpg-lib.sh
3461     + gpg_decrypt "$mntp" "$keypath" "$keydev" "$device"
3462     + else
3463     + die "No GPG support to decrypt '$keypath' on '$keydev'."
3464     + fi
3465     + ;;
3466     + *) cat "$mntp/$keypath" ;;
3467     + esac
3468     +
3469     + umount "$mntp"
3470     + rmdir "$mntp"
3471     +}
3472     diff -Naur dracut-010/modules.d/90crypt/cryptroot-ask.sh dracut-0e6a94b/modules.d/90crypt/cryptroot-ask.sh
3473     --- dracut-010/modules.d/90crypt/cryptroot-ask.sh 2011-03-31 19:50:31.000000000 +0200
3474     +++ dracut-0e6a94b/modules.d/90crypt/cryptroot-ask.sh 2011-05-31 16:34:37.000000000 +0200
3475     @@ -2,8 +2,11 @@
3476     # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
3477     # ex: ts=8 sw=4 sts=4 et filetype=sh
3478    
3479     +PATH=/usr/sbin:/usr/bin:/sbin:/bin
3480     +NEWROOT=${NEWROOT:-"/sysroot"}
3481     +
3482     # do not ask, if we already have root
3483     -[ -f /sysroot/proc ] && exit 0
3484     +[ -f $NEWROOT/proc ] && exit 0
3485    
3486     # check if destination already exists
3487     [ -b /dev/mapper/$2 ] && exit 0
3488     @@ -40,7 +43,7 @@
3489     luksname="$name"
3490     break
3491     fi
3492     -
3493     +
3494     # path used in crypttab
3495     else
3496     cdev=$(readlink -f $dev)
3497     @@ -66,45 +69,25 @@
3498     keypath="${tmp#*:}"
3499     else
3500     info "No key found for $device. Will try later."
3501     - /sbin/initqueue --unique --onetime --settled \
3502     + initqueue --unique --onetime --settled \
3503     --name cryptroot-ask-$luksname \
3504     - /sbin/cryptroot-ask "$@"
3505     + $(command -v cryptroot-ask) "$@"
3506     exit 0
3507     fi
3508     unset tmp
3509    
3510     - mntp=$(mkuniqdir /mnt keydev)
3511     - mount -r "$keydev" "$mntp" || die 'Mounting rem. dev. failed!'
3512     - cryptsetup -d "$mntp/$keypath" luksOpen "$device" "$luksname"
3513     - umount "$mntp"
3514     - rmdir "$mntp"
3515     - unset mntp keypath keydev
3516     + info "Using '$keypath' on '$keydev'"
3517     + readkey "$keypath" "$keydev" "$device" \
3518     + | cryptsetup -d - luksOpen "$device" "$luksname"
3519     + unset keypath keydev
3520     else
3521     - # Prompt for password with plymouth, if installed and running.
3522     - if [ -x /bin/plymouth ] && /bin/plymouth --has-active-vt; then
3523     - prompt="Password [$device ($luksname)]:"
3524     - if [ ${#luksname} -gt 8 ]; then
3525     - sluksname=${sluksname##luks-}
3526     - sluksname=${luksname%%${luksname##????????}}
3527     - prompt="Password for $device ($sluksname...)"
3528     - fi
3529     -
3530     - # flock against other interactive activities
3531     - { flock -s 9;
3532     - /bin/plymouth ask-for-password \
3533     - --prompt "$prompt" --number-of-tries=5 \
3534     - --command="/sbin/cryptsetup luksOpen -T1 $device $luksname"
3535     - } 9>/.console.lock
3536     -
3537     - unset sluksname prompt
3538     -
3539     - else
3540     - # flock against other interactive activities
3541     - { flock -s 9;
3542     - echo "$device ($luksname) is password protected"
3543     - cryptsetup luksOpen -T5 $device $luksname
3544     - } 9>/.console.lock
3545     - fi
3546     + luks_open="$(command -v cryptsetup) luksOpen"
3547     + ask_for_password --ply-tries 5 \
3548     + --ply-cmd "$luks_open -T1 $device $luksname" \
3549     + --ply-prompt "Password ($device)" \
3550     + --tty-tries 1 \
3551     + --tty-cmd "$luks_open -T5 $device $luksname"
3552     + unset luks_open
3553     fi
3554    
3555     unset device luksname
3556     diff -Naur dracut-010/modules.d/90crypt/module-setup.sh dracut-0e6a94b/modules.d/90crypt/module-setup.sh
3557     --- dracut-010/modules.d/90crypt/module-setup.sh 2011-03-31 19:50:31.000000000 +0200
3558     +++ dracut-0e6a94b/modules.d/90crypt/module-setup.sh 2011-05-31 16:34:37.000000000 +0200
3559     @@ -3,6 +3,7 @@
3560     # ex: ts=8 sw=4 sts=4 et filetype=sh
3561    
3562     check() {
3563     + local _rootdev
3564     # if cryptsetup is not installed, then we cannot support encrypted devices.
3565     type -P cryptsetup >/dev/null || return 1
3566    
3567     @@ -11,11 +12,11 @@
3568     is_crypt() { [[ $(get_fs_type /dev/block/$1) = crypto_LUKS ]]; }
3569    
3570     [[ $hostonly ]] && {
3571     - rootdev=$(find_root_block_device)
3572     - if [[ $rootdev ]]; then
3573     - # root lives on a block device, so we can be more precise about
3574     + _rootdev=$(find_root_block_device)
3575     + if [[ $_rootdev ]]; then
3576     + # root lives on a block device, so we can be more precise about
3577     # hostonly checking
3578     - check_block_and_slaves is_crypt "$rootdev" || return 1
3579     + check_block_and_slaves is_crypt "$_rootdev" || return 1
3580     else
3581     # root is not on a block device, use the shotgun approach
3582     blkid | grep -q crypto\?_LUKS || return 1
3583     @@ -35,9 +36,7 @@
3584     }
3585    
3586     install() {
3587     - inst cryptsetup
3588     - inst rmdir
3589     - inst readlink
3590     + dracut_install cryptsetup rmdir readlink umount
3591     inst "$moddir"/cryptroot-ask.sh /sbin/cryptroot-ask
3592     inst "$moddir"/probe-keydev.sh /sbin/probe-keydev
3593     inst_hook cmdline 10 "$moddir/parse-keydev.sh"
3594     diff -Naur dracut-010/modules.d/90crypt/parse-crypt.sh dracut-0e6a94b/modules.d/90crypt/parse-crypt.sh
3595     --- dracut-010/modules.d/90crypt/parse-crypt.sh 2011-03-31 19:50:31.000000000 +0200
3596     +++ dracut-0e6a94b/modules.d/90crypt/parse-crypt.sh 2011-05-31 16:34:37.000000000 +0200
3597     @@ -8,34 +8,36 @@
3598     {
3599     echo 'SUBSYSTEM!="block", GOTO="luks_end"'
3600     echo 'ACTION!="add|change", GOTO="luks_end"'
3601     - } > /etc/udev/rules.d/70-luks.rules
3602     + } > /etc/udev/rules.d/70-luks.rules.new
3603    
3604     LUKS=$(getargs rd.luks.uuid rd_LUKS_UUID)
3605    
3606     if [ -n "$LUKS" ]; then
3607     - for luksid in $LUKS; do
3608     + for luksid in $LUKS; do
3609     luksid=${luksid##luks-}
3610     {
3611     - printf 'ENV{ID_FS_TYPE}=="crypto_LUKS", '
3612     - printf 'ENV{ID_FS_UUID}=="*%s*", ' $luksid
3613     - printf 'RUN+="/sbin/initqueue --unique --onetime '
3614     - printf -- '--name cryptroot-ask-%%k /sbin/cryptroot-ask '
3615     - printf '$env{DEVNAME} luks-$env{ID_FS_UUID}"\n'
3616     - } >> /etc/udev/rules.d/70-luks.rules
3617     + printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", '
3618     + printf -- 'ENV{ID_FS_UUID}=="*%s*", ' $luksid
3619     + printf -- 'RUN+="%s --unique --onetime ' $(command -v initqueue)
3620     + printf -- '--name cryptroot-ask-%%k %s ' $(command -v cryptroot-ask)
3621     + printf -- '$env{DEVNAME} luks-$env{ID_FS_UUID}"\n'
3622     + } >> /etc/udev/rules.d/70-luks.rules.new
3623    
3624     - printf '[ -e /dev/disk/by-uuid/*%s* ] || exit 1\n' $luksid \
3625     + printf -- '[ -e /dev/disk/by-uuid/*%s* ]\n' $luksid \
3626     >> $hookdir/initqueue/finished/90-crypt.sh
3627     {
3628     - printf '[ -e /dev/disk/by-uuid/*%s* ] || ' $luksid
3629     - printf 'warn "crypto LUKS UUID "%s" not found"\n' $luksid
3630     + printf -- '[ -e /dev/disk/by-uuid/*%s* ] || ' $luksid
3631     + printf -- 'warn "crypto LUKS UUID "%s" not found"\n' $luksid
3632     } >> $hookdir/emergency/90-crypt.sh
3633     done
3634     else
3635     - echo 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="/sbin/initqueue' \
3636     - '--unique --onetime --name cryptroot-ask-%k' \
3637     - '/sbin/cryptroot-ask $env{DEVNAME} luks-$env{ID_FS_UUID}"' \
3638     - >> /etc/udev/rules.d/70-luks.rules
3639     + {
3640     + printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="%s ' $(command -v initqueue)
3641     + printf -- '--unique --onetime --name cryptroot-ask-%%k '
3642     + printf -- '%s $env{DEVNAME} luks-$env{ID_FS_UUID}"\n' $(command -v cryptroot-ask)
3643     + } >> /etc/udev/rules.d/70-luks.rules.new
3644     fi
3645    
3646     - echo 'LABEL="luks_end"' >> /etc/udev/rules.d/70-luks.rules
3647     + echo 'LABEL="luks_end"' >> /etc/udev/rules.d/70-luks.rules.new
3648     + mv /etc/udev/rules.d/70-luks.rules.new /etc/udev/rules.d/70-luks.rules
3649     fi
3650     diff -Naur dracut-010/modules.d/90crypt/parse-keydev.sh dracut-0e6a94b/modules.d/90crypt/parse-keydev.sh
3651     --- dracut-010/modules.d/90crypt/parse-keydev.sh 2011-03-31 19:50:31.000000000 +0200
3652     +++ dracut-0e6a94b/modules.d/90crypt/parse-keydev.sh 2011-05-31 16:34:37.000000000 +0200
3653     @@ -28,10 +28,10 @@
3654     fi
3655    
3656     {
3657     - printf 'RUN+="/sbin/initqueue --unique --onetime '
3658     + printf -- 'RUN+="%s --unique --onetime ' $(command -v initqueue)
3659     printf -- '--name probe-keydev-%%k '
3660     - printf '/sbin/probe-keydev /dev/%%k %s %s"\n' \
3661     - "${keypath}" "${luksdev}"
3662     + printf -- '%s /dev/%%k %s %s"\n' \
3663     + $(command -v probe-keydev) "${keypath}" "${luksdev}"
3664     } >&7
3665     done
3666     unset arg keypath keydev luksdev
3667     diff -Naur dracut-010/modules.d/90dm/11-dm.rules dracut-0e6a94b/modules.d/90dm/11-dm.rules
3668     --- dracut-010/modules.d/90dm/11-dm.rules 1970-01-01 01:00:00.000000000 +0100
3669     +++ dracut-0e6a94b/modules.d/90dm/11-dm.rules 2011-05-31 16:34:37.000000000 +0200
3670     @@ -0,0 +1,5 @@
3671     +SUBSYSTEM!="block", GOTO="dm_end"
3672     +KERNEL!="dm-[0-9]*", GOTO="dm_end"
3673     +ACTION!="add|change", GOTO="dm_end"
3674     +OPTIONS+="db_persist"
3675     +LABEL="dm_end"
3676     diff -Naur dracut-010/modules.d/90dm/dm-pre-udev.sh dracut-0e6a94b/modules.d/90dm/dm-pre-udev.sh
3677     --- dracut-010/modules.d/90dm/dm-pre-udev.sh 2011-03-31 19:50:31.000000000 +0200
3678     +++ dracut-0e6a94b/modules.d/90dm/dm-pre-udev.sh 2011-05-31 16:34:37.000000000 +0200
3679     @@ -1,4 +1,4 @@
3680     #!/bin/sh
3681     # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
3682     # ex: ts=8 sw=4 sts=4 et filetype=sh
3683     -strstr "$(cat /proc/misc)" device-mapper || modprobe dm_mod
3684     +strstr "$(cat /proc/misc)" device-mapper || modprobe dm_mod
3685     diff -Naur dracut-010/modules.d/90dm/dm-shutdown.sh dracut-0e6a94b/modules.d/90dm/dm-shutdown.sh
3686     --- dracut-010/modules.d/90dm/dm-shutdown.sh 1970-01-01 01:00:00.000000000 +0100
3687     +++ dracut-0e6a94b/modules.d/90dm/dm-shutdown.sh 2011-05-31 16:34:37.000000000 +0200
3688     @@ -0,0 +1,2 @@
3689     +echo "Disassembling device-mapper devices"
3690     +dmsetup -v remove_all
3691     diff -Naur dracut-010/modules.d/90dm/module-setup.sh dracut-0e6a94b/modules.d/90dm/module-setup.sh
3692     --- dracut-010/modules.d/90dm/module-setup.sh 2011-03-31 19:50:31.000000000 +0200
3693     +++ dracut-0e6a94b/modules.d/90dm/module-setup.sh 2011-05-31 16:34:37.000000000 +0200
3694     @@ -25,5 +25,8 @@
3695     # Gentoo ebuild for LVM2 prior to 2.02.63-r1 doesn't install above rules
3696     # files, but provides the one below:
3697     inst_rules 64-device-mapper.rules
3698     + inst_rules "$moddir/11-dm.rules"
3699     +
3700     + inst_hook shutdown 30 "$moddir/dm-shutdown.sh"
3701     }
3702    
3703     diff -Naur dracut-010/modules.d/90dmraid/dmraid.sh dracut-0e6a94b/modules.d/90dmraid/dmraid.sh
3704     --- dracut-010/modules.d/90dmraid/dmraid.sh 2011-03-31 19:50:31.000000000 +0200
3705     +++ dracut-0e6a94b/modules.d/90dmraid/dmraid.sh 2011-05-31 16:34:37.000000000 +0200
3706     @@ -21,8 +21,8 @@
3707    
3708     if [ -n "$DM_RAIDS" ]; then
3709     # only activate specified DM RAIDS
3710     - for r in $DM_RAIDS; do
3711     - for s in $SETS; do
3712     + for r in $DM_RAIDS; do
3713     + for s in $SETS; do
3714     if [ "${s##$r}" != "$s" ]; then
3715     info "Activating $s"
3716     dmraid -ay -i -p --rm_partitions "$s" 2>&1 | vinfo
3717     @@ -31,7 +31,7 @@
3718     fi
3719     done
3720     done
3721     -else
3722     +else
3723     # scan and activate all DM RAIDS
3724     for s in $SETS; do
3725     info "Activating $s"
3726     diff -Naur dracut-010/modules.d/90dmraid/module-setup.sh dracut-0e6a94b/modules.d/90dmraid/module-setup.sh
3727     --- dracut-010/modules.d/90dmraid/module-setup.sh 2011-03-31 19:50:31.000000000 +0200
3728     +++ dracut-0e6a94b/modules.d/90dmraid/module-setup.sh 2011-05-31 16:34:37.000000000 +0200
3729     @@ -3,6 +3,7 @@
3730     # ex: ts=8 sw=4 sts=4 et filetype=sh
3731    
3732     check() {
3733     + local _rootdev
3734     # if we don't have dmraid installed on the host system, no point
3735     # in trying to support it in the initramfs.
3736     type -P dmraid >/dev/null || return 1
3737     @@ -14,11 +15,11 @@
3738     grep -q _raid_member; }
3739    
3740     [[ $hostonly ]] && {
3741     - rootdev=$(find_root_block_device)
3742     - if [[ $rootdev ]]; then
3743     - # root lives on a block device, so we can be more precise about
3744     + _rootdev=$(find_root_block_device)
3745     + if [[ $_rootdev ]]; then
3746     + # root lives on a block device, so we can be more precise about
3747     # hostonly checking
3748     - check_block_and_slaves is_dmraid "$rootdev" || return 1
3749     + check_block_and_slaves is_dmraid "$_rootdev" || return 1
3750     else
3751     # root is not on a block device, use the shotgun approach
3752     dmraid -r | grep -q ok || return 1
3753     @@ -34,15 +35,16 @@
3754     }
3755    
3756     install() {
3757     - dracut_install dmraid partx kpartx
3758     + local _i
3759     + dracut_install dmraid partx kpartx
3760    
3761     inst dmeventd
3762    
3763     - for i in {"$libdir","$usrlibdir"}/libdmraid-events*.so; do
3764     - [ -e "$i" ] && dracut_install "$i"
3765     + for _i in {"$libdir","$usrlibdir"}/libdmraid-events*.so; do
3766     + [ -e "$_i" ] && dracut_install "$_i"
3767     done
3768    
3769     - inst_rules 10-dm.rules 13-dm-disk.rules 95-dm-notify.rules
3770     + inst_rules 10-dm.rules 13-dm-disk.rules 95-dm-notify.rules
3771     # Gentoo ebuild for LVM2 prior to 2.02.63-r1 doesn't install above rules
3772     # files, but provides the one below:
3773     inst_rules 64-device-mapper.rules
3774     diff -Naur dracut-010/modules.d/90dmraid/parse-dm.sh dracut-0e6a94b/modules.d/90dmraid/parse-dm.sh
3775     --- dracut-010/modules.d/90dmraid/parse-dm.sh 2011-03-31 19:50:31.000000000 +0200
3776     +++ dracut-0e6a94b/modules.d/90dmraid/parse-dm.sh 2011-05-31 16:34:37.000000000 +0200
3777     @@ -7,7 +7,7 @@
3778     udevproperty rd_NO_DM=1
3779     fi
3780    
3781     -if [ ! -x /sbin/mdadm ] || ! getargbool 1 rd.md.imsm -n rd_NO_MDIMSM || getarg noiswmd; then
3782     +if ! command -v mdadm >/dev/null || ! getargbool 1 rd.md.imsm -n rd_NO_MDIMSM || getarg noiswmd; then
3783     info "rd.md.imsm=0: no MD RAID for imsm/isw raids"
3784     udevproperty rd_NO_MDIMSM=1
3785     fi
3786     diff -Naur dracut-010/modules.d/90dmsquash-live/dmsquash-live-genrules.sh dracut-0e6a94b/modules.d/90dmsquash-live/dmsquash-live-genrules.sh
3787     --- dracut-010/modules.d/90dmsquash-live/dmsquash-live-genrules.sh 2011-03-31 19:50:31.000000000 +0200
3788     +++ dracut-0e6a94b/modules.d/90dmsquash-live/dmsquash-live-genrules.sh 2011-05-31 16:34:37.000000000 +0200
3789     @@ -5,15 +5,15 @@
3790     live:/dev/*)
3791     {
3792     printf 'KERNEL=="%s", SYMLINK+="live"\n' \
3793     - ${root#live:/dev/}
3794     + ${root#live:/dev/}
3795     printf 'SYMLINK=="%s", SYMLINK+="live"\n' \
3796     - ${root#live:/dev/}
3797     + ${root#live:/dev/}
3798     } >> $UDEVRULESD/99-live-mount.rules
3799     {
3800     printf 'KERNEL=="%s", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root $env{DEVNAME}"\n' \
3801     - ${root#live:/dev/}
3802     + ${root#live:/dev/}
3803     printf 'SYMLINK=="%s", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root $env{DEVNAME}"\n' \
3804     - ${root#live:/dev/}
3805     + ${root#live:/dev/}
3806     } >> $UDEVRULESD/99-live-squash.rules
3807     echo '[ -e /dev/root ]' > $hookdir/initqueue/finished/dmsquash.sh
3808     ;;
3809     diff -Naur dracut-010/modules.d/90dmsquash-live/dmsquash-live-root dracut-0e6a94b/modules.d/90dmsquash-live/dmsquash-live-root
3810     --- dracut-010/modules.d/90dmsquash-live/dmsquash-live-root 2011-03-31 19:50:31.000000000 +0200
3811     +++ dracut-0e6a94b/modules.d/90dmsquash-live/dmsquash-live-root 2011-05-31 16:34:37.000000000 +0200
3812     @@ -5,7 +5,7 @@
3813     type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
3814     [ -f /tmp/root.info ] && . /tmp/root.info
3815    
3816     -PATH=$PATH:/sbin:/usr/sbin
3817     +PATH=/usr/sbin:/usr/bin:/sbin:/bin
3818    
3819     if getargbool 0 rd.live.debug -y rdlivedebug; then
3820     exec > /tmp/liveroot.$$.out
3821     @@ -25,25 +25,26 @@
3822     getargbool 0 rd.live.overlay.readonly -y readonly_overlay && readonly_overlay="--readonly" || readonly_overlay=""
3823     overlay=$(getarg rd.live.overlay overlay)
3824    
3825     -# FIXME: we need to be able to hide the plymouth splash for the check really
3826     [ -e $livedev ] && fs=$(blkid -s TYPE -o value $livedev)
3827     if [ "$fs" = "iso9660" -o "$fs" = "udf" ]; then
3828     check="yes"
3829     fi
3830     getarg rd.live.check check || check=""
3831     if [ -n "$check" ]; then
3832     + [ -x /bin/plymouth ] && /bin/plymouth --hide-splash
3833     checkisomd5 --verbose $livedev || :
3834     if [ $? -ne 0 ]; then
3835     die "CD check failed!"
3836     exit 1
3837     fi
3838     + [ -x /bin/plymouth ] && /bin/plymouth --show-splash
3839     fi
3840    
3841     getarg ro && liverw=ro
3842     getarg rw && liverw=rw
3843     [ -z "$liverw" ] && liverw=ro
3844     # mount the backing of the live image first
3845     -mkdir -p /run/initramfs/live
3846     +mkdir -m 0755 -p /run/initramfs/live
3847     if [ -f $livedev ]; then
3848     # no mount needed - we've already got the LiveOS image in initramfs
3849     case $livedev in
3850     @@ -84,16 +85,16 @@
3851     # need to know where to look for the overlay
3852     setup=""
3853     if [ -n "$devspec" -a -n "$pathspec" -a -n "$overlay" ]; then
3854     - mkdir /overlayfs
3855     - mount -n -t auto $devspec /overlayfs || :
3856     - if [ -f /overlayfs$pathspec -a -w /overlayfs$pathspec ]; then
3857     - losetup $OVERLAY_LOOPDEV /overlayfs$pathspec
3858     + mkdir -m 0755 /run/initramfs/overlayfs
3859     + mount -n -t auto $devspec /run/initramfs/overlayfs || :
3860     + if [ -f /run/initramfs/overlayfs$pathspec -a -w /run/initramfs/overlayfs$pathspec ]; then
3861     + losetup $OVERLAY_LOOPDEV /run/initramfs/overlayfs$pathspec
3862     if [ -n "$reset_overlay" ]; then
3863     dd if=/dev/zero of=$OVERLAY_LOOPDEV bs=64k count=1 2>/dev/null
3864     fi
3865     setup="yes"
3866     fi
3867     - umount -l /overlayfs || :
3868     + umount -l /run/initramfs/overlayfs || :
3869     fi
3870    
3871     if [ -z "$setup" ]; then
3872     @@ -125,11 +126,11 @@
3873     dd if=$OSMINSQFS of=/osmin.img 2> /dev/null
3874     OSMIN_SQUASHED_LOOPDEV=$( losetup -f )
3875     losetup -r $OSMIN_SQUASHED_LOOPDEV /osmin.img
3876     - mkdir -p /squashfs.osmin
3877     - mount -n -t squashfs -o ro $OSMIN_SQUASHED_LOOPDEV /squashfs.osmin
3878     + mkdir -m 0755 -p /run/initramfs/squashfs.osmin
3879     + mount -n -t squashfs -o ro $OSMIN_SQUASHED_LOOPDEV /run/initramfs/squashfs.osmin
3880     OSMIN_LOOPDEV=$( losetup -f )
3881     - losetup -r $OSMIN_LOOPDEV /squashfs.osmin/osmin
3882     - umount -l /squashfs.osmin
3883     + losetup -r $OSMIN_LOOPDEV /run/initramfs/squashfs.osmin/osmin
3884     + umount -l /run/initramfs/squashfs.osmin
3885     fi
3886    
3887     # we might have an embedded fs image to use as rootfs (uncompressed live)
3888     @@ -164,17 +165,17 @@
3889    
3890     SQUASHED_LOOPDEV=$( losetup -f )
3891     losetup -r $SQUASHED_LOOPDEV $SQUASHED
3892     - mkdir -p /squashfs
3893     - mount -n -t squashfs -o ro $SQUASHED_LOOPDEV /squashfs
3894     + mkdir -m 0755 -p /run/initramfs/squashfs
3895     + mount -n -t squashfs -o ro $SQUASHED_LOOPDEV /run/initramfs/squashfs
3896    
3897     BASE_LOOPDEV=$( losetup -f )
3898     - if [ -f /squashfs/LiveOS/ext3fs.img ]; then
3899     - losetup -r $BASE_LOOPDEV /squashfs/LiveOS/ext3fs.img
3900     - elif [ -f /squashfs/LiveOS/rootfs.img ]; then
3901     - losetup -r $BASE_LOOPDEV /squashfs/LiveOS/rootfs.img
3902     + if [ -f /run/initramfs/squashfs/LiveOS/ext3fs.img ]; then
3903     + losetup -r $BASE_LOOPDEV /run/initramfs/squashfs/LiveOS/ext3fs.img
3904     + elif [ -f /run/initramfs/squashfs/LiveOS/rootfs.img ]; then
3905     + losetup -r $BASE_LOOPDEV /run/initramfs/squashfs/LiveOS/rootfs.img
3906     fi
3907    
3908     - umount -l /squashfs
3909     + umount -l /run/initramfs/squashfs
3910    
3911     do_live_from_base_loop
3912     fi
3913     diff -Naur dracut-010/modules.d/90dmsquash-live/module-setup.sh dracut-0e6a94b/modules.d/90dmsquash-live/module-setup.sh
3914     --- dracut-010/modules.d/90dmsquash-live/module-setup.sh 2011-03-31 19:50:31.000000000 +0200
3915     +++ dracut-0e6a94b/modules.d/90dmsquash-live/module-setup.sh 2011-05-31 16:34:37.000000000 +0200
3916     @@ -9,7 +9,7 @@
3917     }
3918    
3919     depends() {
3920     - # if dmsetup is not installed, then we cannot support fedora/red hat
3921     + # if dmsetup is not installed, then we cannot support fedora/red hat
3922     # style live images
3923     echo dm rootfs-block
3924     return 0
3925     diff -Naur dracut-010/modules.d/90kernel-modules/insmodpost.sh dracut-0e6a94b/modules.d/90kernel-modules/insmodpost.sh
3926     --- dracut-010/modules.d/90kernel-modules/insmodpost.sh 2011-03-31 19:50:31.000000000 +0200
3927     +++ dracut-0e6a94b/modules.d/90kernel-modules/insmodpost.sh 2011-05-31 16:34:37.000000000 +0200
3928     @@ -2,10 +2,10 @@
3929     # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
3930     # ex: ts=8 sw=4 sts=4 et filetype=sh
3931    
3932     -for p in $(getargs rd.driver.post rdinsmodpost=); do
3933     +for p in $(getargs rd.driver.post rdinsmodpost=); do
3934     (
3935     IFS=,
3936     - for p in $i; do
3937     + for p in $i; do
3938     modprobe $p
3939     done
3940     )
3941     diff -Naur dracut-010/modules.d/90kernel-modules/module-setup.sh dracut-0e6a94b/modules.d/90kernel-modules/module-setup.sh
3942     --- dracut-010/modules.d/90kernel-modules/module-setup.sh 2011-03-31 19:50:31.000000000 +0200
3943     +++ dracut-0e6a94b/modules.d/90kernel-modules/module-setup.sh 2011-05-31 16:34:37.000000000 +0200
3944     @@ -17,7 +17,7 @@
3945     hostonly='' instmods atkbd i8042 usbhid hid-apple hid-sunplus hid-cherry hid-logitech hid-microsoft ehci-hcd ohci-hcd uhci-hcd
3946    
3947     instmods "=drivers/pcmcia" =ide "=drivers/usb/storage"
3948     - instmods $(filter_kernel_modules block_module_test)
3949     + instmods $(filter_kernel_modules block_module_test)
3950     # if not on hostonly mode, install all known filesystems,
3951     # if the required list is not set via the filesystems variable
3952     if ! [[ $hostonly ]]; then
3953     @@ -42,9 +42,19 @@
3954     }
3955    
3956     install() {
3957     + local _f
3958     [ -f /etc/modprobe.conf ] && dracut_install /etc/modprobe.conf
3959     dracut_install $(find /etc/modprobe.d/ -type f -name '*.conf')
3960     inst_hook cmdline 01 "$moddir/parse-kernel.sh"
3961     inst_simple "$moddir/insmodpost.sh" /sbin/insmodpost.sh
3962     - inst "$srcmods/modules.builtin.bin" "/lib/modules/$kernel/modules.builtin.bin"
3963     +
3964     + local f
3965     +
3966     + for _f in modules.builtin.bin modules.builtin; do
3967     + [[ $srcmods/$_f ]] && inst "$srcmods/$_f" "/lib/modules/$kernel/$_f" \
3968     + && break
3969     + done || {
3970     + dfatal "No modules.builtin.bin and modules.builtin found!"
3971     + return 1
3972     + }
3973     }
3974     diff -Naur dracut-010/modules.d/90kernel-modules/parse-kernel.sh dracut-0e6a94b/modules.d/90kernel-modules/parse-kernel.sh
3975     --- dracut-010/modules.d/90kernel-modules/parse-kernel.sh 2011-03-31 19:50:31.000000000 +0200
3976     +++ dracut-0e6a94b/modules.d/90kernel-modules/parse-kernel.sh 2011-05-31 16:34:37.000000000 +0200
3977     @@ -2,28 +2,28 @@
3978     # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
3979     # ex: ts=8 sw=4 sts=4 et filetype=sh
3980    
3981     -for p in $(getargs rd.driver.pre rdloaddriver=); do
3982     - (
3983     +for i in $(getargs rd.driver.pre rdloaddriver=); do
3984     + (
3985     IFS=,
3986     - for p in $i; do
3987     + for p in $i; do
3988     modprobe $p 2>&1 | vinfo
3989     done
3990     )
3991     done
3992    
3993     -for p in $(getargs rd.driver.blacklist rdblacklist=); do
3994     +for i in $(getargs rd.driver.blacklist rdblacklist=); do
3995     (
3996     IFS=,
3997     - for p in $i; do
3998     + for p in $i; do
3999     echo "blacklist $p" >> /etc/modprobe.d/initramfsblacklist.conf
4000     done
4001     )
4002     done
4003    
4004     -for p in $(getargs rd.driver.post rdinsmodpost=); do
4005     +for p in $(getargs rd.driver.post rdinsmodpost=); do
4006     echo "blacklist $p" >> /etc/modprobe.d/initramfsblacklist.conf
4007     _do_insmodpost=1
4008     done
4009    
4010     -[ -n "$_do_insmodpost" ] && /sbin/initqueue --settled --unique --onetime /sbin/insmodpost.sh
4011     +[ -n "$_do_insmodpost" ] && initqueue --settled --unique --onetime insmodpost.sh
4012     unset _do_insmodpost
4013     diff -Naur dracut-010/modules.d/90lvm/lvm_scan.sh dracut-0e6a94b/modules.d/90lvm/lvm_scan.sh
4014     --- dracut-010/modules.d/90lvm/lvm_scan.sh 2011-03-31 19:50:31.000000000 +0200
4015     +++ dracut-0e6a94b/modules.d/90lvm/lvm_scan.sh 2011-05-31 16:34:37.000000000 +0200
4016     @@ -11,7 +11,7 @@
4017     SNAPSHOT=$(getargs rd.lvm.snapshot rd_LVM_SNAPSHOT=)
4018     SNAPSIZE=$(getargs rd.lvm.snapsize rd_LVM_SNAPSIZE=)
4019    
4020     -[ -d /etc/lvm ] || mkdir -p /etc/lvm
4021     +[ -d /etc/lvm ] || mkdir -m 0755 -p /etc/lvm
4022     # build a list of devices to scan
4023     lvmdevs=$(
4024     for f in /tmp/.lvm_scan-*; do
4025     @@ -20,7 +20,7 @@
4026     done
4027     )
4028    
4029     -if [ ! -e /etc/lvm/lvm.conf ]; then
4030     +if [ ! -e /etc/lvm/lvm.conf ]; then
4031     {
4032     echo 'devices {';
4033     echo -n ' filter = [ '
4034     @@ -28,7 +28,7 @@
4035     printf '"a|^/dev/%s$|", ' $dev;
4036     done;
4037     echo '"r/.*/" ]';
4038     - echo '}';
4039     + echo '}';
4040    
4041     # establish LVM locking
4042     if [ -n $SNAPSHOT ]; then
4043     @@ -66,7 +66,7 @@
4044     maj=${1##*:}
4045     min=$2
4046     sub=${3%% *}
4047     -sub=${sub%%\(*};
4048     +sub=${sub%%\(*};
4049    
4050     check_lvm_ver 2 2 57 $maj $min $sub && \
4051     nopoll="--poll n"
4052     @@ -120,7 +120,5 @@
4053    
4054     if [ "$lvmwritten" ]; then
4055     rm -f /etc/lvm/lvm.conf
4056     - ln -s /sbin/lvm-cleanup $hookdir/pre-pivot/30-lvm-cleanup.sh 2>/dev/null
4057     - ln -s /sbin/lvm-cleanup $hookdir/pre-pivot/31-lvm-cleanup.sh 2>/dev/null
4058     fi
4059     unset lvmwritten
4060     diff -Naur dracut-010/modules.d/90lvm/module-setup.sh dracut-0e6a94b/modules.d/90lvm/module-setup.sh
4061     --- dracut-010/modules.d/90lvm/module-setup.sh 2011-03-31 19:50:31.000000000 +0200
4062     +++ dracut-0e6a94b/modules.d/90lvm/module-setup.sh 2011-05-31 16:34:37.000000000 +0200
4063     @@ -3,6 +3,7 @@
4064     # ex: ts=8 sw=4 sts=4 et filetype=sh
4065    
4066     check() {
4067     + local _rootdev
4068     # No point trying to support lvm if the binaries are missing
4069     type -P lvm >/dev/null || return 1
4070    
4071     @@ -12,11 +13,11 @@
4072     is_lvm() { [[ $(get_fs_type /dev/block/$1) = LVM2_member ]]; }
4073    
4074     [[ $hostonly ]] && {
4075     - rootdev=$(find_root_block_device)
4076     - if [[ $rootdev ]]; then
4077     - # root lives on a block device, so we can be more precise about
4078     + _rootdev=$(find_root_block_device)
4079     + if [[ $_rootdev ]]; then
4080     + # root lives on a block device, so we can be more precise about
4081     # hostonly checking
4082     - check_block_and_slaves is_lvm "$rootdev" || return 1
4083     + check_block_and_slaves is_lvm "$_rootdev" || return 1
4084     else
4085     # root is not on a block device, use the shotgun approach
4086     blkid | grep -q LVM2_member || return 1
4087     @@ -33,11 +34,12 @@
4088     }
4089    
4090     install() {
4091     + local _i
4092     inst lvm
4093    
4094     - inst_rules "$moddir/64-lvm.rules"
4095     + inst_rules "$moddir/64-lvm.rules"
4096    
4097     - if [[ $hostonly ]] || [[ $lvmconf = "yes" ]]; then
4098     + if [[ $hostonly ]] || [[ $lvmconf = "yes" ]]; then
4099     if [ -f /etc/lvm/lvm.conf ]; then
4100     inst /etc/lvm/lvm.conf
4101     # FIXME: near-term hack to establish read-only locking;
4102     @@ -54,8 +56,8 @@
4103     inst "$moddir/lvm_scan.sh" /sbin/lvm_scan
4104     inst_hook cmdline 30 "$moddir/parse-lvm.sh"
4105    
4106     - for i in {"$libdir","$usrlibdir"}/libdevmapper-event-lvm*.so; do
4107     - [ -e "$i" ] && dracut_install "$i"
4108     + for _i in {"$libdir","$usrlibdir"}/libdevmapper-event-lvm*.so; do
4109     + [ -e "$_i" ] && dracut_install "$_i"
4110     done
4111     }
4112    
4113     diff -Naur dracut-010/modules.d/90lvm/parse-lvm.sh dracut-0e6a94b/modules.d/90lvm/parse-lvm.sh
4114     --- dracut-010/modules.d/90lvm/parse-lvm.sh 2011-03-31 19:50:31.000000000 +0200
4115     +++ dracut-0e6a94b/modules.d/90lvm/parse-lvm.sh 2011-05-31 16:34:37.000000000 +0200
4116     @@ -10,7 +10,7 @@
4117     rm -f /etc/udev/rules.d/64-lvm*.rules
4118     else
4119     for dev in $(getargs rd.lvm.vg rd_LVM_VG=) $(getargs rd.lvm.lv rd_LVM_LV=); do
4120     - printf '[ -e "/dev/%s" ] || exit 1\n' $dev \
4121     + printf '[ -e "/dev/%s" ]\n' $dev \
4122     >> $hookdir/initqueue/finished/lvm.sh
4123     {
4124     printf '[ -e "/dev/%s" ] || ' $dev
4125     diff -Naur dracut-010/modules.d/90mdraid/65-md-incremental-imsm.rules dracut-0e6a94b/modules.d/90mdraid/65-md-incremental-imsm.rules
4126     --- dracut-010/modules.d/90mdraid/65-md-incremental-imsm.rules 2011-03-31 19:50:31.000000000 +0200
4127     +++ dracut-0e6a94b/modules.d/90mdraid/65-md-incremental-imsm.rules 2011-05-31 16:34:37.000000000 +0200
4128     @@ -22,10 +22,10 @@
4129    
4130     LABEL="do_md_inc"
4131    
4132     -#
4133     +#
4134     # if rd_MDADMCONF do not assemble incrementally
4135     # defer auto assembly until the udev queue is settled
4136     -#
4137     +#
4138     ENV{rd_MDADMCONF}!="?*", GOTO="md_auto_end"
4139    
4140     RUN+="/bin/sh -c 'ln -s /sbin/md_finished.sh $hookdir/initqueue/finished/md_finished.sh;/sbin/initqueue --settled --onetime --unique /sbin/mdadm_auto'"
4141     diff -Naur dracut-010/modules.d/90mdraid/mdadm_auto.sh dracut-0e6a94b/modules.d/90mdraid/mdadm_auto.sh
4142     --- dracut-010/modules.d/90mdraid/mdadm_auto.sh 2011-03-31 19:50:31.000000000 +0200
4143     +++ dracut-0e6a94b/modules.d/90mdraid/mdadm_auto.sh 2011-05-31 16:34:37.000000000 +0200
4144     @@ -3,5 +3,5 @@
4145     # ex: ts=8 sw=4 sts=4 et filetype=sh
4146     type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
4147    
4148     -info "Autoassembling MD Raid"
4149     -/sbin/mdadm -As --auto=yes --run 2>&1 | vinfo
4150     +info "Autoassembling MD Raid"
4151     +mdadm -As --auto=yes --run 2>&1 | vinfo
4152     diff -Naur dracut-010/modules.d/90mdraid/mdcontainer_start.sh dracut-0e6a94b/modules.d/90mdraid/mdcontainer_start.sh
4153     --- dracut-010/modules.d/90mdraid/mdcontainer_start.sh 2011-03-31 19:50:31.000000000 +0200
4154     +++ dracut-0e6a94b/modules.d/90mdraid/mdcontainer_start.sh 2011-05-31 16:34:37.000000000 +0200
4155     @@ -7,6 +7,6 @@
4156     udevadm control --stop-exec-queue
4157     # and activate any containers
4158     mdadm -IR $md 2>&1 | vinfo
4159     -ln -s /sbin/mdraid-cleanup $hookdir/pre-pivot/30-mdraid-cleanup.sh 2>/dev/null
4160     -ln -s /sbin/mdraid-cleanup $hookdir/pre-pivot/31-mdraid-cleanup.sh 2>/dev/null
4161     +ln -s $(command -v mdraid-cleanup) $hookdir/pre-pivot/30-mdraid-cleanup.sh 2>/dev/null
4162     +ln -s $(command -v mdraid-cleanup) $hookdir/pre-pivot/31-mdraid-cleanup.sh 2>/dev/null
4163     udevadm control --start-exec-queue
4164     diff -Naur dracut-010/modules.d/90mdraid/mdmon-pre-udev.sh dracut-0e6a94b/modules.d/90mdraid/mdmon-pre-udev.sh
4165     --- dracut-010/modules.d/90mdraid/mdmon-pre-udev.sh 2011-03-31 19:50:31.000000000 +0200
4166     +++ dracut-0e6a94b/modules.d/90mdraid/mdmon-pre-udev.sh 2011-05-31 16:34:37.000000000 +0200
4167     @@ -2,5 +2,5 @@
4168     # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
4169     # ex: ts=8 sw=4 sts=4 et filetype=sh
4170     # save state dir for mdmon/mdadm for the real root
4171     -mkdir -m 0755 /run/mdadm
4172     +[ -d /run/mdadm ] || mkdir -m 0755 /run/mdadm
4173     # backward compat link
4174     diff -Naur dracut-010/modules.d/90mdraid/mdraid-cleanup.sh dracut-0e6a94b/modules.d/90mdraid/mdraid-cleanup.sh
4175     --- dracut-010/modules.d/90mdraid/mdraid-cleanup.sh 2011-03-31 19:50:31.000000000 +0200
4176     +++ dracut-0e6a94b/modules.d/90mdraid/mdraid-cleanup.sh 2011-05-31 16:34:37.000000000 +0200
4177     @@ -7,8 +7,8 @@
4178     [ -b $i ] || continue
4179    
4180     mddetail=$(udevadm info --query=property --name=$i)
4181     - case "$mddetail" in
4182     - *MD_LEVEL=container*)
4183     + case "$mddetail" in
4184     + *MD_LEVEL=container*)
4185     ;;
4186     *DEVTYPE=partition*)
4187     ;;
4188     diff -Naur dracut-010/modules.d/90mdraid/mdraid_start.sh dracut-0e6a94b/modules.d/90mdraid/mdraid_start.sh
4189     --- dracut-010/modules.d/90mdraid/mdraid_start.sh 2011-03-31 19:50:31.000000000 +0200
4190     +++ dracut-0e6a94b/modules.d/90mdraid/mdraid_start.sh 2011-05-31 16:34:37.000000000 +0200
4191     @@ -11,7 +11,7 @@
4192    
4193     # there could still be some leftover devices
4194     # which have had a container added
4195     -for md in /dev/md[0-9]* /dev/md/*; do
4196     +for md in /dev/md[0-9]* /dev/md/*; do
4197     [ -b "$md" ] || continue
4198     udevinfo="$(udevadm info --query=env --name=$md)"
4199     strstr "$udevinfo" "MD_UUID=" && continue
4200     @@ -21,6 +21,6 @@
4201     done
4202     unset udevinfo
4203    
4204     -ln -s /sbin/mdraid-cleanup $hookdir/pre-pivot/30-mdraid-cleanup.sh 2>/dev/null
4205     -ln -s /sbin/mdraid-cleanup $hookdir/pre-pivot/31-mdraid-cleanup.sh 2>/dev/null
4206     +ln -s $(command -v mdraid-cleanup) $hookdir/pre-pivot/30-mdraid-cleanup.sh 2>/dev/null
4207     +ln -s $(command -v mdraid-cleanup) $hookdir/pre-pivot/31-mdraid-cleanup.sh 2>/dev/null
4208     udevadm control --start-exec-queue
4209     diff -Naur dracut-010/modules.d/90mdraid/md-shutdown.sh dracut-0e6a94b/modules.d/90mdraid/md-shutdown.sh
4210     --- dracut-010/modules.d/90mdraid/md-shutdown.sh 1970-01-01 01:00:00.000000000 +0100
4211     +++ dracut-0e6a94b/modules.d/90mdraid/md-shutdown.sh 2011-05-31 16:34:37.000000000 +0200
4212     @@ -0,0 +1,2 @@
4213     +echo "Disassembling mdraid devices."
4214     +mdadm -v --stop --scan
4215     diff -Naur dracut-010/modules.d/90mdraid/module-setup.sh dracut-0e6a94b/modules.d/90mdraid/module-setup.sh
4216     --- dracut-010/modules.d/90mdraid/module-setup.sh 2011-03-31 19:50:31.000000000 +0200
4217     +++ dracut-0e6a94b/modules.d/90mdraid/module-setup.sh 2011-05-31 16:34:37.000000000 +0200
4218     @@ -3,6 +3,7 @@
4219     # ex: ts=8 sw=4 sts=4 et filetype=sh
4220    
4221     check() {
4222     + local _rootdev
4223     # No mdadm? No mdraid support.
4224     type -P mdadm >/dev/null || return 1
4225    
4226     @@ -12,11 +13,11 @@
4227     is_mdraid() { [[ -d "/sys/dev/block/$1/md" ]]; }
4228    
4229     [[ $hostonly ]] && {
4230     - rootdev=$(find_root_block_device)
4231     - if [[ $rootdev ]]; then
4232     - # root lives on a block device, so we can be more precise about
4233     + _rootdev=$(find_root_block_device)
4234     + if [[ $_rootdev ]]; then
4235     + # root lives on a block device, so we can be more precise about
4236     # hostonly checking
4237     - check_block_and_slaves is_mdraid "$rootdev" || return 1
4238     + check_block_and_slaves is_mdraid "$_rootdev" || return 1
4239     else
4240     # root is not on a block device, use the shotgun approach
4241     blkid | egrep -q '(linux|isw)_raid' || return 1
4242     @@ -36,12 +37,12 @@
4243     }
4244    
4245     install() {
4246     - dracut_install mdadm partx
4247     + dracut_install mdadm partx
4248    
4249    
4250     # XXX: mdmon really needs to run as non-root?
4251     # If so, write only the user it needs in the initrd's /etc/passwd (and maybe /etc/group)
4252     - # in a similar fashion to modules.d/95nfs. Do not copy /etc/passwd and /etc/group from
4253     + # in a similar fashion to modules.d/95nfs. Do not copy /etc/passwd and /etc/group from
4254     # the system into the initrd.
4255     # dledford has hardware to test this, so he should be able to clean this up.
4256     # inst /etc/passwd
4257     @@ -53,11 +54,11 @@
4258    
4259     inst_rules "$moddir/65-md-incremental-imsm.rules"
4260    
4261     - if ! mdadm -Q -e imsm /dev/null &> /dev/null; then
4262     + if ! mdadm -Q -e imsm /dev/null &> /dev/null; then
4263     inst_hook pre-trigger 30 "$moddir/md-noimsm.sh"
4264     fi
4265    
4266     - if [[ $hostonly ]] || [[ $mdadmconf = "yes" ]]; then
4267     + if [[ $hostonly ]] || [[ $mdadmconf = "yes" ]]; then
4268     if [ -f /etc/mdadm.conf ]; then
4269     inst /etc/mdadm.conf
4270     else
4271     @@ -67,7 +68,7 @@
4272    
4273     if [ -x /sbin/mdmon ] ; then
4274     dracut_install mdmon
4275     - fi
4276     + fi
4277     inst_hook pre-udev 30 "$moddir/mdmon-pre-udev.sh"
4278    
4279     inst "$moddir/mdraid_start.sh" /sbin/mdraid_start
4280     @@ -76,5 +77,6 @@
4281     inst "$moddir/md_finished.sh" /sbin/md_finished.sh
4282     inst_hook pre-trigger 30 "$moddir/parse-md.sh"
4283     inst "$moddir/mdraid-cleanup.sh" /sbin/mdraid-cleanup
4284     + inst_hook shutdown 30 "$moddir/md-shutdown.sh"
4285     }
4286    
4287     diff -Naur dracut-010/modules.d/90mdraid/parse-md.sh dracut-0e6a94b/modules.d/90mdraid/parse-md.sh
4288     --- dracut-010/modules.d/90mdraid/parse-md.sh 2011-03-31 19:50:31.000000000 +0200
4289     +++ dracut-0e6a94b/modules.d/90mdraid/parse-md.sh 2011-05-31 16:34:37.000000000 +0200
4290     @@ -11,17 +11,17 @@
4291     if [ -n "$MD_UUID" ]; then
4292     for f in /etc/udev/rules.d/65-md-incremental*.rules; do
4293     [ -e "$f" ] || continue
4294     - while read line; do
4295     + while read line; do
4296     if [ "${line%%UUID CHECK}" != "$line" ]; then
4297     for uuid in $MD_UUID; do
4298     printf 'ENV{MD_UUID}=="%s", GOTO="do_md_inc"\n' $uuid
4299     done;
4300     - printf 'GOTO="md_inc_end"\n';
4301     + printf 'GOTO="md_inc_end"\n';
4302     else
4303     - echo $line;
4304     + echo $line;
4305     fi
4306     done < "${f}" > "${f}.new"
4307     - mv "${f}.new" "$f"
4308     + mv "${f}.new" "$f"
4309     done
4310     fi
4311     fi
4312     diff -Naur dracut-010/modules.d/90multipath/module-setup.sh dracut-0e6a94b/modules.d/90multipath/module-setup.sh
4313     --- dracut-010/modules.d/90multipath/module-setup.sh 2011-03-31 19:50:31.000000000 +0200
4314     +++ dracut-0e6a94b/modules.d/90multipath/module-setup.sh 2011-05-31 16:34:37.000000000 +0200
4315     @@ -3,6 +3,7 @@
4316     # ex: ts=8 sw=4 sts=4 et filetype=sh
4317    
4318     check() {
4319     + local _rootdev
4320     # if there's no multipath binary, no go.
4321     type -P multipath >/dev/null || return 1
4322    
4323     @@ -16,9 +17,9 @@
4324     }
4325    
4326     if [[ $hostonly ]]; then
4327     - rootdev=$(find_root_block_device)
4328     - if [[ $rootdev ]]; then
4329     - check_block_and_slaves is_mpath "$rootdev" && return 0
4330     + _rootdev=$(find_root_block_device)
4331     + if [[ $_rootdev ]]; then
4332     + check_block_and_slaves is_mpath "$_rootdev" && return 0
4333     fi
4334     return 1
4335     fi
4336     @@ -41,7 +42,8 @@
4337     }
4338    
4339     install() {
4340     - for f in \
4341     + local _f
4342     + for _f in \
4343     /sbin/dmsetup \
4344     /sbin/kpartx \
4345     /sbin/mpath_wait \
4346     @@ -53,7 +55,7 @@
4347     /etc/multipath.conf \
4348     /etc/multipath/* \
4349     "$libdir"/libmultipath* "$libdir"/multipath/*; do
4350     - [ -e "$f" ] && inst "$f"
4351     + [ -e "$_f" ] && inst "$_f"
4352     done
4353    
4354     inst_hook pre-trigger 02 "$moddir/multipathd.sh"
4355     diff -Naur dracut-010/modules.d/90multipath/multipathd.sh dracut-0e6a94b/modules.d/90multipath/multipathd.sh
4356     --- dracut-010/modules.d/90multipath/multipathd.sh 2011-03-31 19:50:31.000000000 +0200
4357     +++ dracut-0e6a94b/modules.d/90multipath/multipathd.sh 2011-05-31 16:34:37.000000000 +0200
4358     @@ -6,6 +6,6 @@
4359     modprobe dm-multipath
4360     multipathd -B || multipathd
4361     else
4362     - rm /etc/udev/rules.d/??-multipath.rules 2>/dev/null
4363     + rm /etc/udev/rules.d/??-multipath.rules 2>/dev/null
4364     fi
4365    
4366     diff -Naur dracut-010/modules.d/90multipath/multipathd-stop.sh dracut-0e6a94b/modules.d/90multipath/multipathd-stop.sh
4367     --- dracut-010/modules.d/90multipath/multipathd-stop.sh 2011-03-31 19:50:31.000000000 +0200
4368     +++ dracut-0e6a94b/modules.d/90multipath/multipathd-stop.sh 2011-05-31 16:34:37.000000000 +0200
4369     @@ -4,7 +4,7 @@
4370    
4371     if [ -e /etc/multipath.conf ]; then
4372     HARD=""
4373     - while pidof multipathd >/dev/null 2>&1; do
4374     + while pidof multipathd >/dev/null 2>&1; do
4375     for pid in $(pidof multipathd); do
4376     kill $HARD $pid >/dev/null 2>&1
4377     done
4378     diff -Naur dracut-010/modules.d/91crypt-gpg/crypt-gpg-lib.sh dracut-0e6a94b/modules.d/91crypt-gpg/crypt-gpg-lib.sh
4379     --- dracut-010/modules.d/91crypt-gpg/crypt-gpg-lib.sh 1970-01-01 01:00:00.000000000 +0100
4380     +++ dracut-0e6a94b/modules.d/91crypt-gpg/crypt-gpg-lib.sh 2011-05-31 16:34:37.000000000 +0200
4381     @@ -0,0 +1,33 @@
4382     +#!/bin/sh
4383     +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
4384     +# ex: ts=4 sw=4 sts=0 et filetype=sh
4385     +
4386     +command -v ask_for_password >/dev/null || . /lib/dracut-crypt-lib.sh
4387     +
4388     +# gpg_decrypt mnt_point keypath keydev device
4389     +#
4390     +# Decrypts encrypted symmetrically key to standard output.
4391     +#
4392     +# mnt_point - mount point where <keydev> is already mounted
4393     +# keypath - GPG encrypted key path relative to <mnt_point>
4394     +# keydev - device on which key resides; only to display in prompt
4395     +# device - device to be opened by cryptsetup; only to display in prompt
4396     +gpg_decrypt() {
4397     + local mntp="$1"
4398     + local keypath="$2"
4399     + local keydev="$3"
4400     + local device="$4"
4401     +
4402     + local gpghome=/tmp/gnupg
4403     + local opts="--homedir $gpghome --no-mdc-warning --skip-verify --quiet"
4404     + opts="$opts --logger-file /dev/null --batch --no-tty --passphrase-fd 0"
4405     +
4406     + mkdir -m 0700 -p "$gpghome"
4407     +
4408     + ask_for_password \
4409     + --cmd "gpg $opts --decrypt $mntp/$keypath" \
4410     + --prompt "Password ($keypath on $keydev for $device)" \
4411     + --tries 3 --tty-echo-off
4412     +
4413     + rm -rf -- "$gpghome"
4414     +}
4415     diff -Naur dracut-010/modules.d/91crypt-gpg/module-setup.sh dracut-0e6a94b/modules.d/91crypt-gpg/module-setup.sh
4416     --- dracut-010/modules.d/91crypt-gpg/module-setup.sh 1970-01-01 01:00:00.000000000 +0100
4417     +++ dracut-0e6a94b/modules.d/91crypt-gpg/module-setup.sh 2011-05-31 16:34:37.000000000 +0200
4418     @@ -0,0 +1,19 @@
4419     +#!/bin/bash
4420     +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
4421     +# ex: ts=8 sw=4 sts=4 et filetype=sh
4422     +
4423     +# GPG support is optional
4424     +check() {
4425     + type -P gpg >/dev/null || return 1
4426     +
4427     + return 255
4428     +}
4429     +
4430     +depends() {
4431     + echo crypt
4432     +}
4433     +
4434     +install() {
4435     + dracut_install gpg
4436     + inst "$moddir/crypt-gpg-lib.sh" "/lib/dracut-crypt-gpg-lib.sh"
4437     +}
4438     diff -Naur dracut-010/modules.d/95dasd/module-setup.sh dracut-0e6a94b/modules.d/95dasd/module-setup.sh
4439     --- dracut-010/modules.d/95dasd/module-setup.sh 2011-03-31 19:50:31.000000000 +0200
4440     +++ dracut-0e6a94b/modules.d/95dasd/module-setup.sh 2011-05-31 16:34:37.000000000 +0200
4441     @@ -3,8 +3,8 @@
4442     # ex: ts=8 sw=4 sts=4 et filetype=sh
4443    
4444     check() {
4445     - arch=$(uname -m)
4446     - [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
4447     + local _arch=$(uname -m)
4448     + [ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
4449     return 0
4450     }
4451    
4452     diff -Naur dracut-010/modules.d/95dasd_mod/module-setup.sh dracut-0e6a94b/modules.d/95dasd_mod/module-setup.sh
4453     --- dracut-010/modules.d/95dasd_mod/module-setup.sh 2011-03-31 19:50:31.000000000 +0200
4454     +++ dracut-0e6a94b/modules.d/95dasd_mod/module-setup.sh 2011-05-31 16:34:37.000000000 +0200
4455     @@ -3,8 +3,8 @@
4456     # ex: ts=8 sw=4 sts=4 et filetype=sh
4457    
4458     check() {
4459     - arch=$(uname -m)
4460     - [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
4461     + local _arch=$(uname -m)
4462     + [ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
4463    
4464     return 0
4465     }
4466     diff -Naur dracut-010/modules.d/95dasd_mod/parse-dasd-mod.sh dracut-0e6a94b/modules.d/95dasd_mod/parse-dasd-mod.sh
4467     --- dracut-010/modules.d/95dasd_mod/parse-dasd-mod.sh 2011-03-31 19:50:31.000000000 +0200
4468     +++ dracut-0e6a94b/modules.d/95dasd_mod/parse-dasd-mod.sh 2011-05-31 16:34:37.000000000 +0200
4469     @@ -1,7 +1,7 @@
4470     #!/bin/sh
4471     # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
4472     # ex: ts=8 sw=4 sts=4 et filetype=sh
4473     -[ -d /etc/modprobe.d ] || mkdir /etc/modprobe.d
4474     +[ -d /etc/modprobe.d ] || mkdir -m 0755 -p /etc/modprobe.d
4475    
4476     dasd_arg=$(getarg rd.dasd_mod.dasd rd_DASD_MOD=)
4477     if [ -n "$dasd_arg" ]; then
4478     diff -Naur dracut-010/modules.d/95debug/module-setup.sh dracut-0e6a94b/modules.d/95debug/module-setup.sh
4479     --- dracut-010/modules.d/95debug/module-setup.sh 2011-03-31 19:50:31.000000000 +0200
4480     +++ dracut-0e6a94b/modules.d/95debug/module-setup.sh 2011-05-31 16:34:37.000000000 +0200
4481     @@ -12,7 +12,7 @@
4482     }
4483    
4484     install() {
4485     - dracut_install -o ps grep more cat rm strace free showmount
4486     + dracut_install -o ps grep more cat rm strace free showmount
4487     dracut_install -o ping netstat rpcinfo vi scp ping6 ssh
4488     dracut_install -o fsck fsck.ext2 fsck.ext4 fsck.ext3 fsck.ext4dev fsck.vfat e2fsck
4489    
4490     diff -Naur dracut-010/modules.d/95fcoe/fcoe-edd.sh dracut-0e6a94b/modules.d/95fcoe/fcoe-edd.sh
4491     --- dracut-010/modules.d/95fcoe/fcoe-edd.sh 1970-01-01 01:00:00.000000000 +0100
4492     +++ dracut-0e6a94b/modules.d/95fcoe/fcoe-edd.sh 2011-05-31 16:34:37.000000000 +0200
4493     @@ -0,0 +1,25 @@
4494     +#!/bin/sh
4495     +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
4496     +# ex: ts=8 sw=4 sts=4 et filetype=sh
4497     +
4498     +dcb=$1
4499     +
4500     +if ! [ -d /sys/firmware/edd ]; then
4501     + modprobe edd
4502     + while ! [ -d /sys/firmware/edd ]; do sleep 0.1; done
4503     +fi
4504     +
4505     +for disk in /sys/firmware/edd/int13_*; do
4506     + [ -d $disk ] || continue
4507     + for nic in ${disk}/pci_dev/net/*; do
4508     + [ -d $nic ] || continue
4509     + if [ -e ${nic}/address ]; then
4510     + fcoe_interface=${nic##*/}
4511     + if ! [ -e "/tmp/.fcoe-$fcoe_interface" ]; then
4512     + /sbin/fcoe-up $fcoe_interface $dcb
4513     + > "/tmp/.fcoe-$fcoe_interface"
4514     + fi
4515     + fi
4516     + done
4517     +done
4518     +modprobe -r edd
4519     diff -Naur dracut-010/modules.d/95fcoe/fcoe-up dracut-0e6a94b/modules.d/95fcoe/fcoe-up
4520     --- dracut-010/modules.d/95fcoe/fcoe-up 2011-03-31 19:50:31.000000000 +0200
4521     +++ dracut-0e6a94b/modules.d/95fcoe/fcoe-up 2011-05-31 16:34:37.000000000 +0200
4522     @@ -3,24 +3,24 @@
4523     # ex: ts=8 sw=4 sts=4 et filetype=sh
4524     #
4525     # We get called like this:
4526     -# /sbin/fcoe-up <network-device> <dcb|nodcb>
4527     +# fcoe-up <network-device> <dcb|nodcb>
4528     #
4529     # Note currently only nodcb is supported, the dcb option is reserved for
4530     # future use.
4531    
4532     -PATH=$PATH:/sbin:/usr/sbin
4533     +PATH=/usr/sbin:/usr/bin:/sbin:/bin
4534    
4535     # Huh? Missing arguments ??
4536     [ -z "$1" -o -z "$2" ] && exit 1
4537    
4538     export PS4="fcoe-up.$1.$$ + "
4539     -exec >>/run/initramfs/initlog.pipe 2>>/run/initramfs/initlog.pipe
4540     +exec >>/run/initramfs/loginit.pipe 2>>/run/initramfs/loginit.pipe
4541     type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
4542    
4543     netif=$1
4544     dcb=$2
4545    
4546     -/sbin/ip link set "$netif" up
4547     +ip link set "$netif" up
4548     wait_for_if_up "$netif"
4549    
4550     if [ "$dcb" = "dcb" ]; then
4551     diff -Naur dracut-010/modules.d/95fcoe/module-setup.sh dracut-0e6a94b/modules.d/95fcoe/module-setup.sh
4552     --- dracut-010/modules.d/95fcoe/module-setup.sh 2011-03-31 19:50:31.000000000 +0200
4553     +++ dracut-0e6a94b/modules.d/95fcoe/module-setup.sh 2011-05-31 16:34:37.000000000 +0200
4554     @@ -21,16 +21,16 @@
4555     }
4556    
4557     install() {
4558     - dracut_install ip
4559     - inst dcbtool
4560     + dracut_install ip
4561     + inst dcbtool
4562     inst fipvlan
4563     inst lldpad
4564    
4565     - mkdir -p "$initdir/var/lib/lldpad"
4566     + mkdir -m 0755 -p "$initdir/var/lib/lldpad"
4567    
4568     inst "$moddir/fcoe-up" "/sbin/fcoe-up"
4569     + inst "$moddir/fcoe-edd.sh" "/sbin/fcoe-edd"
4570     inst "$moddir/fcoe-genrules.sh" "/sbin/fcoe-genrules.sh"
4571     - inst_hook pre-udev 60 "$moddir/fcoe-genrules.sh"
4572     inst_hook cmdline 99 "$moddir/parse-fcoe.sh"
4573     }
4574    
4575     diff -Naur dracut-010/modules.d/95fcoe/parse-fcoe.sh dracut-0e6a94b/modules.d/95fcoe/parse-fcoe.sh
4576     --- dracut-010/modules.d/95fcoe/parse-fcoe.sh 2011-03-31 19:50:31.000000000 +0200
4577     +++ dracut-0e6a94b/modules.d/95fcoe/parse-fcoe.sh 2011-05-31 16:34:37.000000000 +0200
4578     @@ -51,20 +51,7 @@
4579     if [ "$fcoe_dcb" != "nodcb" -a "$fcoe_dcb" != "dcb" ] ; then
4580     warn "Invalid FCoE DCB option: $fcoe_dcb"
4581     fi
4582     - [ -d /sys/firmware/edd ] || modprobe edd
4583     - # parse edd interfaces
4584     - for disk in /sys/firmware/edd/int13_*; do
4585     - [ -d $disk ] || continue
4586     - for nic in ${disk}/pci_dev/net/*; do
4587     - [ -d $nic ] || continue
4588     - if [ -e ${nic}/address ]; then
4589     - unset fcoe_mac
4590     - unset fcoe_interface
4591     - fcoe_mac=$(cat ${nic}/address)
4592     - [ -n "$fcoe_mac" ] && source /sbin/fcoe-genrules.sh
4593     - fi
4594     - done
4595     - done
4596     + /sbin/initqueue --settled --unique /sbin/fcoe-edd $fcoe_dcb
4597     else
4598     for fcoe in $(getargs fcoe=); do
4599     unset fcoe_mac
4600     @@ -73,6 +60,6 @@
4601     if [ "$fcoe_dcb" != "nodcb" -a "$fcoe_dcb" != "dcb" ] ; then
4602     warn "Invalid FCoE DCB option: $fcoe_dcb"
4603     fi
4604     - source /sbin/fcoe-genrules.sh
4605     + . $(command -v fcoe-genrules.sh)
4606     done
4607     -fi
4608     \ Kein Zeilenumbruch am Dateiende.
4609     +fi
4610     diff -Naur dracut-010/modules.d/95fstab-sys/module-setup.sh dracut-0e6a94b/modules.d/95fstab-sys/module-setup.sh
4611     --- dracut-010/modules.d/95fstab-sys/module-setup.sh 2011-03-31 19:50:31.000000000 +0200
4612     +++ dracut-0e6a94b/modules.d/95fstab-sys/module-setup.sh 2011-05-31 16:34:37.000000000 +0200
4613     @@ -12,5 +12,7 @@
4614    
4615     install() {
4616     dracut_install /etc/fstab.sys
4617     + dracut_install /sbin/fsck*
4618     + type -P e2fsck >/dev/null && dracut_install e2fsck
4619     inst_hook pre-pivot 00 "$moddir/mount-sys.sh"
4620     }
4621     diff -Naur dracut-010/modules.d/95fstab-sys/mount-sys.sh dracut-0e6a94b/modules.d/95fstab-sys/mount-sys.sh
4622     --- dracut-010/modules.d/95fstab-sys/mount-sys.sh 2011-03-31 19:50:31.000000000 +0200
4623     +++ dracut-0e6a94b/modules.d/95fstab-sys/mount-sys.sh 2011-05-31 16:34:37.000000000 +0200
4624     @@ -2,14 +2,25 @@
4625     # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
4626     # ex: ts=8 sw=4 sts=4 et filetype=sh
4627    
4628     -fstab_mount(){
4629     - local dev mp type opts rest
4630     +type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
4631     +
4632     +fstab_mount() {
4633     + local _dev _mp _fs _opts _dump _pass _rest
4634     test -e "$1" || return 1
4635     info "Mounting from $1"
4636     - while read dev mp type opts rest; do
4637     - [ -z "${dev%%#*}" ]&& continue # Skip comment lines
4638     - mount -v -t $type -o $opts $dev $NEWROOT/$mp
4639     - done < $1 | vinfo
4640     + while read _dev _mp _fs _opts _dump _pass _rest; do
4641     + [ -z "${_dev%%#*}" ] && continue # Skip comment lines
4642     + if [ ! -e "$_dev" ]; then
4643     + warn "Device $_dev doesn't exist, skipping mount."
4644     + continue
4645     + fi
4646     + if [ "$_pass" -gt 0 ] && ! strstr "$_opts" _netdev; then
4647     + wrap_fsck "$_dev"
4648     + fi
4649     + _fs=$(det_fs "$_dev" "$_fs" /etc/fstab.sys)
4650     + info "Mounting $_dev"
4651     + mount -v -t $_fs -o $_opts $_dev $NEWROOT/$_mp 2>&1 | vinfo
4652     + done < $1
4653     return 0
4654     }
4655    
4656     diff -Naur dracut-010/modules.d/95iscsi/iscsiroot dracut-0e6a94b/modules.d/95iscsi/iscsiroot
4657     --- dracut-010/modules.d/95iscsi/iscsiroot 2011-03-31 19:50:31.000000000 +0200
4658     +++ dracut-0e6a94b/modules.d/95iscsi/iscsiroot 2011-05-31 16:34:37.000000000 +0200
4659     @@ -4,13 +4,13 @@
4660     #
4661     # This implementation is incomplete: Discovery mode is not implemented and
4662     # the argument handling doesn't follow currently agreed formats. This is mainly
4663     -# because rfc4173 does not say anything about iscsi_initiator but open-iscsi's
4664     +# because rfc4173 does not say anything about iscsi_initiator but open-iscsi's
4665     # iscsistart needs this.
4666     #
4667    
4668     type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
4669    
4670     -PATH=$PATH:/sbin:/usr/sbin
4671     +PATH=/usr/sbin:/usr/bin:/sbin:/bin
4672    
4673     # Huh? Empty $1?
4674     [ -z "$1" ] && exit 1
4675     @@ -18,7 +18,7 @@
4676     # Huh? Empty $2?
4677     [ -z "$2" ] && exit 1
4678    
4679     -# Huh? Empty $3? This isn't really necessary, since NEWROOT isn't
4680     +# Huh? Empty $3? This isn't really necessary, since NEWROOT isn't
4681     # used here. But let's be consistent
4682     [ -z "$3" ] && exit 1
4683    
4684     @@ -69,7 +69,7 @@
4685     arg=$(getargs rd.iscsi.in.password iscsi_in_password=)
4686     [ -n "$arg" ] && iscsi_in_password=$arg
4687    
4688     -handle_netroot()
4689     +handle_netroot()
4690     {
4691     iroot=$1
4692     # override conf/commandline options by dhcp root_path
4693     @@ -78,7 +78,7 @@
4694     IFS=@
4695     set $iroot
4696     if [ $# -gt 1 ]; then
4697     - authinfo=$1; shift
4698     + authinfo=$1; shift
4699     iroot=$*
4700     # allow empty authinfo to allow having an @ in iscsi_target_name like this:
4701     # netroot=iscsi:@192.168.1.100::3260::iqn.2009-01.com.example:testdi@sk
4702     @@ -92,13 +92,13 @@
4703     iscsi_in_password=$4
4704     fi
4705     fi
4706     - fi
4707     + fi
4708    
4709     IFS="$OLDIFS"
4710    
4711     local v=${iroot}:
4712     local i
4713     - set --
4714     + set --
4715     while [ -n "$v" ]; do
4716     if [ "${v#\[*:*:*\]:}" != "$v" ]; then
4717     # handle IPv6 address
4718     @@ -106,7 +106,7 @@
4719     i="${i##\[}"
4720     set -- "$@" "$i"
4721     v=${v#\[$i\]:}
4722     - else
4723     + else
4724     set -- "$@" "${v%%:*}"
4725     v=${v#*:}
4726     fi
4727     @@ -183,8 +183,8 @@
4728     }
4729    
4730     # loop over all netroot parameter
4731     -if getarg netroot; then
4732     - for nroot in $(getargs netroot); do
4733     +if getarg netroot; then
4734     + for nroot in $(getargs netroot); do
4735     [ "${netroot%%:*}" = "iscsi" ] || continue
4736     handle_netroot ${nroot##iscsi:}
4737     done
4738     diff -Naur dracut-010/modules.d/95iscsi/module-setup.sh dracut-0e6a94b/modules.d/95iscsi/module-setup.sh
4739     --- dracut-010/modules.d/95iscsi/module-setup.sh 2011-03-31 19:50:31.000000000 +0200
4740     +++ dracut-0e6a94b/modules.d/95iscsi/module-setup.sh 2011-05-31 16:34:37.000000000 +0200
4741     @@ -3,6 +3,7 @@
4742     # ex: ts=8 sw=4 sts=4 et filetype=sh
4743    
4744     check() {
4745     + local _rootdev
4746     # If our prerequisites are not met, fail anyways.
4747     type -P iscsistart hostname iscsi-iname >/dev/null || return 1
4748    
4749     @@ -13,7 +14,7 @@
4750    
4751     [[ $debug ]] && set -x
4752    
4753     - is_iscsi() (
4754     + is_iscsi() (
4755     [[ -L /sys/dev/block/$1 ]] || return
4756     cd "$(readlink -f /sys/dev/block/$1)"
4757     until [[ -d sys || -d iscsi_session ]]; do
4758     @@ -23,11 +24,11 @@
4759     )
4760    
4761     [[ $hostonly ]] && {
4762     - rootdev=$(find_root_block_device)
4763     - if [[ $rootdev ]]; then
4764     - # root lives on a block device, so we can be more precise about
4765     + _rootdev=$(find_root_block_device)
4766     + if [[ $_rootdev ]]; then
4767     + # root lives on a block device, so we can be more precise about
4768     # hostonly checking
4769     - check_block_and_slaves is_iscsi "$rootdev" || return 1
4770     + check_block_and_slaves is_iscsi "$_rootdev" || return 1
4771     else
4772     return 1
4773     fi
4774     @@ -40,12 +41,17 @@
4775     }
4776    
4777     installkernel() {
4778     - instmods iscsi_tcp crc32c iscsi_ibft
4779     + instmods iscsi_tcp iscsi_ibft crc32c
4780     + iscsi_module_test() {
4781     + local _iscsifuncs='iscsi_register_transport'
4782     + fgrep -q "$_iscsifuncs" "$1"
4783     + }
4784     + instmods $(filter_kernel_modules iscsi_module_test)
4785     }
4786    
4787     install() {
4788     dracut_install umount
4789     - inst iscsistart
4790     + inst iscsistart
4791     inst hostname
4792     inst iscsi-iname
4793     inst_hook cmdline 90 "$moddir/parse-iscsiroot.sh"
4794     diff -Naur dracut-010/modules.d/95iscsi/mount-lun.sh dracut-0e6a94b/modules.d/95iscsi/mount-lun.sh
4795     --- dracut-010/modules.d/95iscsi/mount-lun.sh 2011-03-31 19:50:31.000000000 +0200
4796     +++ dracut-0e6a94b/modules.d/95iscsi/mount-lun.sh 2011-05-31 16:34:37.000000000 +0200
4797     @@ -8,7 +8,7 @@
4798    
4799     for disk in /dev/disk/by-path/*-iscsi-*-$iscsi_lun; do
4800     if mount -t ${fstype:-auto} -o "$rflags" $disk $NEWROOT; then
4801     - if [ ! -d /sysroot/proc ]; then
4802     + if [ ! -d $NEWROOT/proc ]; then
4803     umount $disk
4804     continue
4805     fi
4806     diff -Naur dracut-010/modules.d/95nbd/module-setup.sh dracut-0e6a94b/modules.d/95nbd/module-setup.sh
4807     --- dracut-010/modules.d/95nbd/module-setup.sh 2011-03-31 19:50:31.000000000 +0200
4808     +++ dracut-0e6a94b/modules.d/95nbd/module-setup.sh 2011-05-31 16:34:37.000000000 +0200
4809     @@ -3,18 +3,19 @@
4810     # ex: ts=8 sw=4 sts=4 et filetype=sh
4811    
4812     check() {
4813     + local _rootdev
4814     # If our prerequisites are not met, fail.
4815     type -P nbd-client >/dev/null || return 1
4816    
4817     - # if an nbd device is not somewhere in the chain of devices root is
4818     + # if an nbd device is not somewhere in the chain of devices root is
4819     # mounted on, fail the hostonly check.
4820     [[ $hostonly ]] && {
4821     is_nbd() { [[ -b /dev/block/$1 && $1 == 43:* ]] ;}
4822     . $dracutfunctions
4823    
4824     - rootdev=$(find_root_block_device)
4825     - [[ -b /dev/block/$rootdev ]] || return 1
4826     - check_block_and_slaves is_nbd "$rootdev" || return 1
4827     + _rootdev=$(find_root_block_device)
4828     + [[ -b /dev/block/$_rootdev ]] || return 1
4829     + check_block_and_slaves is_nbd "$_rootdev" || return 1
4830     }
4831    
4832     return 0
4833     diff -Naur dracut-010/modules.d/95nbd/nbdroot dracut-0e6a94b/modules.d/95nbd/nbdroot
4834     --- dracut-010/modules.d/95nbd/nbdroot 2011-03-31 19:50:31.000000000 +0200
4835     +++ dracut-0e6a94b/modules.d/95nbd/nbdroot 2011-05-31 16:34:37.000000000 +0200
4836     @@ -4,7 +4,7 @@
4837    
4838     type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
4839    
4840     -PATH=$PATH:/sbin:/usr/sbin
4841     +PATH=/usr/sbin:/usr/bin:/sbin:/bin
4842    
4843     # Huh? Empty $1?
4844     [ -z "$1" ] && exit 1
4845     diff -Naur dracut-010/modules.d/95nbd/parse-nbdroot.sh dracut-0e6a94b/modules.d/95nbd/parse-nbdroot.sh
4846     --- dracut-010/modules.d/95nbd/parse-nbdroot.sh 2011-03-31 19:50:31.000000000 +0200
4847     +++ dracut-0e6a94b/modules.d/95nbd/parse-nbdroot.sh 2011-05-31 16:34:37.000000000 +0200
4848     @@ -20,7 +20,7 @@
4849     v=${v#*:}
4850     done
4851    
4852     - unset server port
4853     + unset server port
4854     server=$2; port=$3;
4855     }
4856    
4857     diff -Naur dracut-010/modules.d/95nfs/module-setup.sh dracut-0e6a94b/modules.d/95nfs/module-setup.sh
4858     --- dracut-010/modules.d/95nfs/module-setup.sh 2011-03-31 19:50:31.000000000 +0200
4859     +++ dracut-0e6a94b/modules.d/95nfs/module-setup.sh 2011-05-31 16:34:37.000000000 +0200
4860     @@ -23,35 +23,37 @@
4861     }
4862    
4863     install() {
4864     + local _i
4865     + local _nsslibs
4866     type -P portmap >/dev/null && dracut_install portmap
4867     type -P rpcbind >/dev/null && dracut_install rpcbind
4868    
4869     - dracut_install rpc.statd mount.nfs mount.nfs4 umount
4870     - [ -f /etc/netconfig ] && dracut_install /etc/netconfig
4871     - dracut_install /etc/services
4872     + dracut_install rpc.statd mount.nfs mount.nfs4 umount
4873     + [ -f /etc/netconfig ] && dracut_install /etc/netconfig
4874     + dracut_install /etc/services
4875     dracut_install /etc/nsswitch.conf /etc/rpc /etc/protocols
4876     dracut_install rpc.idmapd /etc/idmapd.conf
4877     dracut_install sed
4878    
4879     - for i in {"$libdir","$usrlibdir"}/libnfsidmap_nsswitch.so* \
4880     + for _i in {"$libdir","$usrlibdir"}/libnfsidmap_nsswitch.so* \
4881     {"$libdir","$usrlibdir"}/libnfsidmap/*.so \
4882     {"$libdir","$usrlibdir"}/libnfsidmap*.so*; do
4883     - [ -e "$i" ] && dracut_install "$i"
4884     + [ -e "$_i" ] && dracut_install "$_i"
4885     done
4886    
4887     - nsslibs=$(sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' /etc/nsswitch.conf \
4888     + _nsslibs=$(sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' /etc/nsswitch.conf \
4889     | tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|')
4890     - nsslibs=${nsslibs#|}
4891     - nsslibs=${nsslibs%|}
4892     + _nsslibs=${_nsslibs#|}
4893     + _nsslibs=${_nsslibs%|}
4894    
4895     - dracut_install $(for i in $(ls {/usr,}$libdir/libnss*.so 2>/dev/null); do echo $i;done | egrep "$nsslibs")
4896     + dracut_install $(for _i in $(ls {/usr,}$libdir/libnss*.so 2>/dev/null); do echo $_i;done | egrep "$_nsslibs")
4897    
4898     inst_hook cmdline 90 "$moddir/parse-nfsroot.sh"
4899     inst_hook pre-pivot 99 "$moddir/nfsroot-cleanup.sh"
4900     inst "$moddir/nfsroot" "/sbin/nfsroot"
4901     - mkdir -p "$initdir/var/lib/nfs/rpc_pipefs"
4902     - mkdir -p "$initdir/var/lib/rpcbind"
4903     - mkdir -p "$initdir/var/lib/nfs/statd/sm"
4904     + mkdir -m 0755 -p "$initdir/var/lib/nfs/rpc_pipefs"
4905     + mkdir -m 0755 -p "$initdir/var/lib/rpcbind"
4906     + mkdir -m 0755 -p "$initdir/var/lib/nfs/statd/sm"
4907    
4908     # Rather than copy the passwd file in, just set a user for rpcbind
4909     # We'll save the state and restart the daemon from the root anyway
4910     @@ -61,9 +63,11 @@
4911     egrep '^rpc:' /etc/passwd >> "$initdir/etc/passwd"
4912     egrep '^rpcuser:' /etc/passwd >> "$initdir/etc/passwd"
4913     #type -P nologin >/dev/null && dracut_install nologin
4914     + egrep '^rpc:' /etc/group >> "$initdir/etc/group"
4915    
4916     # rpc user needs to be able to write to this directory to save the warmstart
4917     # file
4918     - chmod 777 "$initdir/var/lib/rpcbind"
4919     + chmod 770 "$initdir/var/lib/rpcbind"
4920     + chown rpc.rpc "$initdir/var/lib/rpcbind"
4921     }
4922    
4923     diff -Naur dracut-010/modules.d/95nfs/nfsroot dracut-0e6a94b/modules.d/95nfs/nfsroot
4924     --- dracut-010/modules.d/95nfs/nfsroot 2011-03-31 19:50:31.000000000 +0200
4925     +++ dracut-0e6a94b/modules.d/95nfs/nfsroot 2011-05-31 16:34:37.000000000 +0200
4926     @@ -4,7 +4,7 @@
4927    
4928     type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
4929    
4930     -PATH=$PATH:/sbin:/usr/sbin
4931     +PATH=/usr/sbin:/usr/bin:/sbin:/bin
4932    
4933     # Huh? Empty $1?
4934     [ -z "$1" ] && exit 1
4935     @@ -46,7 +46,7 @@
4936     [ -n "$var" ] && server=$var && break;
4937     done
4938    
4939     - # XXX This blindly assumes that if new_root_path has to used that
4940     + # XXX This blindly assumes that if new_root_path has to used that
4941     # XXX it really can be used as server
4942     server=${server%%:*}
4943     fi
4944     @@ -86,8 +86,8 @@
4945    
4946     # Start rpcbind or rpcbind
4947     # FIXME occasionally saw 'rpcbind: fork failed: No such device' -- why?
4948     -[ -x /sbin/portmap ] && [ -z "$(pidof portmap)" ] && portmap
4949     -[ -x /sbin/rpcbind ] && [ -z "$(pidof rpcbind)" ] && rpcbind
4950     +command -v portmap >/dev/null && [ -z "$(pidof portmap)" ] && portmap
4951     +command -v rpcbind >/dev/null && [ -z "$(pidof rpcbind)" ] && rpcbind
4952    
4953     if [ "$nfs" = "nfs4" ]; then
4954     [ ! -d /var/lib/nfs/rpc_pipefs/nfs ] && \
4955     @@ -113,7 +113,7 @@
4956     # XXX Should we loop here?
4957     { mount -t nfs -o$options${options:+,}nolock,nfsvers=3 $server:$path $NEWROOT || \
4958     mount -t nfs -o$options${options:+,}nolock,nfsvers=2 $server:$path $NEWROOT ; } \
4959     - && { [ -e /dev/root ] || >/dev/root ; }
4960     + && { [ -e /dev/root ] || >/dev/root ; }
4961     fi
4962    
4963     # inject new exit_if_exists
4964     diff -Naur dracut-010/modules.d/95nfs/nfsroot-cleanup.sh dracut-0e6a94b/modules.d/95nfs/nfsroot-cleanup.sh
4965     --- dracut-010/modules.d/95nfs/nfsroot-cleanup.sh 2011-03-31 19:50:31.000000000 +0200
4966     +++ dracut-0e6a94b/modules.d/95nfs/nfsroot-cleanup.sh 2011-05-31 16:34:37.000000000 +0200
4967     @@ -14,9 +14,10 @@
4968     pid=$(pidof rpcbind)
4969     [ -n "$pid" ] && kill $pid
4970    
4971     -if incol2 /proc/mounts /var/lib/nfs/rpc_pipefs; then
4972     +if incol2 /proc/mounts /var/lib/nfs/rpc_pipefs; then
4973     # try to create the destination directory
4974     - [ -d $NEWROOT/$rpcpipefspath ] || mkdir -p $NEWROOT/$rpcpipefspath 2>/dev/null
4975     + [ -d $NEWROOT/$rpcpipefspath ] || \
4976     + mkdir -m 0755 -p $NEWROOT/$rpcpipefspath 2>/dev/null
4977    
4978     if [ -d $NEWROOT/$rpcpipefspath ]; then
4979     mount --move /var/lib/nfs/rpc_pipefs $NEWROOT/$rpcpipefspath
4980     diff -Naur dracut-010/modules.d/95nfs/parse-nfsroot.sh dracut-0e6a94b/modules.d/95nfs/parse-nfsroot.sh
4981     --- dracut-010/modules.d/95nfs/parse-nfsroot.sh 2011-03-31 19:50:31.000000000 +0200
4982     +++ dracut-0e6a94b/modules.d/95nfs/parse-nfsroot.sh 2011-05-31 16:34:37.000000000 +0200
4983     @@ -11,7 +11,7 @@
4984     # root=/dev/nfs nfsroot=[server:]path[,options]
4985     #
4986     # In Legacy root=/dev/nfs mode, if the 'nfsroot' parameter is not given
4987     -# on the command line or is empty, the dhcp root-path is used as
4988     +# on the command line or is empty, the dhcp root-path is used as
4989     # [server:]path[:options] or the default "/tftpboot/%s" will be used.
4990     #
4991     # If server is unspecified it will be pulled from one of the following
4992     @@ -44,7 +44,7 @@
4993     fi
4994     else
4995     netroot=$root;
4996     -fi
4997     +fi
4998    
4999     # LEGACY: nfsroot= is valid only if root=/dev/nfs
5000     if [ -n "$nfsroot" ] ; then
5001     @@ -106,7 +106,7 @@
5002     # Done, all good!
5003     rootok=1
5004    
5005     -# Shut up init error check or make sure that block parser wont get
5006     +# Shut up init error check or make sure that block parser wont get
5007     # confused by having /dev/nfs[4]
5008     root="$fstype"
5009    
5010     diff -Naur dracut-010/modules.d/95resume/module-setup.sh dracut-0e6a94b/modules.d/95resume/module-setup.sh
5011     --- dracut-010/modules.d/95resume/module-setup.sh 2011-03-31 19:50:31.000000000 +0200
5012     +++ dracut-0e6a94b/modules.d/95resume/module-setup.sh 2011-05-31 16:34:37.000000000 +0200
5013     @@ -3,13 +3,14 @@
5014     # ex: ts=8 sw=4 sts=4 et filetype=sh
5015    
5016     install() {
5017     + local _bin
5018     # Optional uswsusp support
5019     - for bin in /usr/sbin/resume /usr/lib/suspend/resume
5020     + for _bin in /usr/sbin/resume /usr/lib/suspend/resume
5021     do
5022     - [[ -x "${bin}" ]] && {
5023     - inst "${bin}" /usr/sbin/resume
5024     + [[ -x "${_bin}" ]] && {
5025     + inst "${_bin}" /usr/sbin/resume
5026     [[ -f /etc/suspend.conf ]] && inst /etc/suspend.conf
5027     - break
5028     + break
5029     }
5030     done
5031    
5032     diff -Naur dracut-010/modules.d/95resume/parse-resume.sh dracut-0e6a94b/modules.d/95resume/parse-resume.sh
5033     --- dracut-010/modules.d/95resume/parse-resume.sh 2011-03-31 19:50:31.000000000 +0200
5034     +++ dracut-0e6a94b/modules.d/95resume/parse-resume.sh 2011-05-31 16:34:37.000000000 +0200
5035     @@ -2,7 +2,7 @@
5036     # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
5037     # ex: ts=8 sw=4 sts=4 et filetype=sh
5038    
5039     -if resume=$(getarg resume=) && ! getarg noresume; then
5040     +if resume=$(getarg resume=) && ! getarg noresume; then
5041     export resume
5042     echo "$resume" >/.resume
5043     else
5044     diff -Naur dracut-010/modules.d/95resume/resume.sh dracut-0e6a94b/modules.d/95resume/resume.sh
5045     --- dracut-010/modules.d/95resume/resume.sh 2011-03-31 19:50:31.000000000 +0200
5046     +++ dracut-0e6a94b/modules.d/95resume/resume.sh 2011-05-31 16:34:37.000000000 +0200
5047     @@ -2,6 +2,8 @@
5048     # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
5049     # ex: ts=8 sw=4 sts=4 et filetype=sh
5050    
5051     +PATH=/usr/sbin:/usr/bin:/sbin:/bin
5052     +
5053     [ -s /.resume -a -b "$resume" ] && {
5054     # First try user level resume; it offers splash etc
5055     case "$splash" in
5056     @@ -12,10 +14,10 @@
5057     a_splash="-P splash=n"
5058     ;;
5059     esac
5060     - [ -x /usr/sbin/resume ] && /usr/sbin/resume $a_splash "$resume"
5061     + [ -x $(command -v resume) ] && command resume $a_splash "$resume"
5062    
5063     # parsing the output of ls is Bad, but until there is a better way...
5064     - ls -lH "$resume" | (
5065     + ls -lH "$resume" | (
5066     read x x x x maj min x;
5067     echo "${maj%,}:$min"> /sys/power/resume)
5068     >/.resume
5069     diff -Naur dracut-010/modules.d/95rootfs-block/block-genrules.sh dracut-0e6a94b/modules.d/95rootfs-block/block-genrules.sh
5070     --- dracut-010/modules.d/95rootfs-block/block-genrules.sh 2011-03-31 19:50:31.000000000 +0200
5071     +++ dracut-0e6a94b/modules.d/95rootfs-block/block-genrules.sh 2011-05-31 16:34:37.000000000 +0200
5072     @@ -5,13 +5,13 @@
5073     if [ "${root%%:*}" = "block" ]; then
5074     {
5075     printf 'KERNEL=="%s", SYMLINK+="root"\n' \
5076     - ${root#block:/dev/}
5077     + ${root#block:/dev/}
5078     printf 'SYMLINK=="%s", SYMLINK+="root"\n' \
5079     - ${root#block:/dev/}
5080     + ${root#block:/dev/}
5081     } >> $UDEVRULESD/99-root.rules
5082     -
5083     +
5084     printf '[ -e "%s" ] && { ln -s "%s" /dev/root 2>/dev/null; rm "$job"; }\n' \
5085     - "${root#block:}" "${root#block:}" >> $hookdir/initqueue/settled/blocksymlink.sh
5086     + "${root#block:}" "${root#block:}" > $hookdir/initqueue/settled/blocksymlink.sh
5087    
5088     echo '[ -e /dev/root ]' > $hookdir/initqueue/finished/block.sh
5089     fi
5090     diff -Naur dracut-010/modules.d/95rootfs-block/mount-root.sh dracut-0e6a94b/modules.d/95rootfs-block/mount-root.sh
5091     --- dracut-010/modules.d/95rootfs-block/mount-root.sh 2011-03-31 19:50:31.000000000 +0200
5092     +++ dracut-0e6a94b/modules.d/95rootfs-block/mount-root.sh 2011-05-31 16:34:37.000000000 +0200
5093     @@ -26,8 +26,10 @@
5094     }
5095    
5096     if [ -n "$root" -a -z "${root%%block:*}" ]; then
5097     - mount -t ${fstype:-auto} -o "$rflags",ro "${root#block:}" "$NEWROOT" \
5098     - && ROOTFS_MOUNTED=yes
5099     +
5100     + # sanity - determine/fix fstype
5101     + rootfs=$(det_fs "${root#block:}" "$fstype" "cmdline")
5102     + mount -t ${rootfs} -o "$rflags",ro "${root#block:}" "$NEWROOT"
5103    
5104     READONLY=
5105     fsckoptions=
5106     @@ -67,26 +69,26 @@
5107     fsckoptions="$AUTOFSCK_OPT $fsckoptions"
5108     fi
5109    
5110     - if ! strstr " $fsckoptions" " -y"; then
5111     + if ! strstr " $fsckoptions" " -y" && strstr "$rootfs" ext; then
5112     fsckoptions="-a $fsckoptions"
5113     fi
5114    
5115     - rootfs=${fstype:-auto}
5116     rootopts=
5117     if getargbool 1 rd.fstab -n rd_NO_FSTAB \
5118     && ! getarg rootflags \
5119     && [ -f "$NEWROOT/etc/fstab" ] \
5120     && ! [ -L "$NEWROOT/etc/fstab" ]; then
5121     - # if $NEWROOT/etc/fstab contains special mount options for
5122     + # if $NEWROOT/etc/fstab contains special mount options for
5123     # the root filesystem,
5124     # remount it with the proper options
5125     rootopts="defaults"
5126     - while read dev mp fs opts rest; do
5127     + while read dev mp fs opts rest; do
5128     # skip comments
5129     [ "${dev%%#*}" != "$dev" ] && continue
5130     -
5131     +
5132     if [ "$mp" = "/" ]; then
5133     - rootfs=$fs
5134     + # sanity - determine/fix fstype
5135     + rootfs=$(det_fs "${root#block:}" "$fs" "$NEWROOT/etc/fstab")
5136     rootopts=$opts
5137     break
5138     fi
5139     @@ -96,41 +98,14 @@
5140     fi
5141    
5142     umount "$NEWROOT"
5143     - if [ "$rootfs" = "auto" ]; then
5144     - rootfs=$(udevadm info --query=env --name=${root#block:} | \
5145     - while read line; do
5146     - if strstr $line ID_FS_TYPE; then
5147     - eval $line
5148     - echo $ID_FS_TYPE
5149     - break
5150     - fi
5151     - done)
5152     - rootfs=${rootfs:-auto}
5153     - fi
5154    
5155     # backslashes are treated as escape character in fstab
5156     esc_root=$(echo ${root#block:} | sed 's,\\,\\\\,g')
5157     printf '%s %s %s %s,%s 1 1 \n' "$esc_root" "$NEWROOT" "$rootfs" "$rflags" "$rootopts" > /etc/fstab
5158    
5159     - if [ -z "$fastboot" -a "$READONLY" != "yes" ]; then
5160     - info "Checking filesystems"
5161     - info fsck -T -t noopts=_netdev -A $fsckoptions
5162     - out=$(fsck -T -t noopts=_netdev -A $fsckoptions)
5163     - export RD_ROOTFS_FSCK=$?
5164     - echo $RD_ROOTFS_FSCK > /run/initramfs/root-fsck
5165     -
5166     - # A return of 4 or higher means there were serious problems.
5167     - if [ $RD_ROOTFS_FSCK -gt 3 ]; then
5168     - warn $out
5169     - warn "fsck returned with error code $RD_ROOTFS_FSCK"
5170     - warn "*** An error occurred during the file system check."
5171     - warn "*** Dropping you to a shell; the system will retry"
5172     - warn "*** to mount the system, when you leave the shell."
5173     - emergency_shell -n "(Repair filesystem)"
5174     - else
5175     - echo $out|vinfo
5176     - [ $RD_ROOTFS_FSCK -gt 0 ] && warn "fsck returned with $RD_ROOTFS_FSCK"
5177     - fi
5178     + if [ -x "/sbin/fsck.$rootfs" -a -z "$fastboot" -a "$READONLY" != "yes" ] && ! strstr "${rflags},${rootopts}" _netdev; then
5179     + wrap_fsck "${root#block:}" "$fsckoptions"
5180     + echo $? >/run/initramfs/root-fsck
5181     fi
5182    
5183     info "Remounting ${root#block:} with -o ${rflags},${rootopts}"
5184     diff -Naur dracut-010/modules.d/95terminfo/module-setup.sh dracut-0e6a94b/modules.d/95terminfo/module-setup.sh
5185     --- dracut-010/modules.d/95terminfo/module-setup.sh 2011-03-31 19:50:31.000000000 +0200
5186     +++ dracut-0e6a94b/modules.d/95terminfo/module-setup.sh 2011-05-31 16:34:37.000000000 +0200
5187     @@ -3,12 +3,13 @@
5188     # ex: ts=8 sw=4 sts=4 et filetype=sh
5189    
5190     install() {
5191     + local _terminfodir
5192     # terminfo bits make things work better if you fall into interactive mode
5193     - for TERMINFODIR in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
5194     - [ -d ${TERMINFODIR} ] && break
5195     + for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
5196     + [ -d ${_terminfodir} ] && break
5197     done
5198     -
5199     - [ -d ${TERMINFODIR} ] && \
5200     - dracut_install $(find ${TERMINFODIR} -type f)
5201     +
5202     + [ -d ${_terminfodir} ] && \
5203     + dracut_install $(find ${_terminfodir} -type f)
5204     }
5205    
5206     diff -Naur dracut-010/modules.d/95udev-rules/module-setup.sh dracut-0e6a94b/modules.d/95udev-rules/module-setup.sh
5207     --- dracut-010/modules.d/95udev-rules/module-setup.sh 2011-03-31 19:50:31.000000000 +0200
5208     +++ dracut-0e6a94b/modules.d/95udev-rules/module-setup.sh 2011-05-31 16:34:37.000000000 +0200
5209     @@ -3,6 +3,7 @@
5210     # ex: ts=8 sw=4 sts=4 et filetype=sh
5211    
5212     install() {
5213     + local _i
5214     # FIXME: would be nice if we didn't have to know which rules to grab....
5215     # ultimately, /lib/initramfs/rules.d or somesuch which includes links/copies
5216     # of the rules we want so that we just copy those in would be best
5217     @@ -10,7 +11,7 @@
5218     dracut_install basename
5219     inst_rules 50-udev-default.rules 60-persistent-storage.rules \
5220     61-persistent-storage-edd.rules 80-drivers.rules 95-udev-late.rules \
5221     - 60-pcmcia.rules
5222     + 60-pcmcia.rules
5223     #Some debian udev rules are named differently
5224     inst_rules 50-udev.rules 95-late.rules
5225    
5226     @@ -21,6 +22,10 @@
5227     inst_rules 50-firmware.rules
5228     dracut_install cat uname
5229    
5230     +
5231     + inst_dir /run/udev
5232     + inst_dir /run/udev/rules.d
5233     +
5234     if [ ! -x /lib/udev/vol_id ]; then
5235     dracut_install blkid
5236     inst_rules "$moddir/59-persistent-storage.rules"
5237     @@ -29,7 +34,7 @@
5238     fi
5239     inst_rules "$moddir/61-persistent-storage.rules"
5240    
5241     - for i in \
5242     + for _i in \
5243     ata_id \
5244     cdrom_id \
5245     create_floppy_devices \
5246     @@ -47,14 +52,14 @@
5247     pcmcia-socket-startup \
5248     pcmcia-check-broken-cis \
5249     ; do
5250     - [ -e /lib/udev/$i ] && dracut_install /lib/udev/$i
5251     + [ -e /lib/udev/$_i ] && dracut_install /lib/udev/$_i
5252     done
5253    
5254     [ -f /etc/arch-release ] && \
5255     inst "$moddir/load-modules.sh" /lib/udev/load-modules.sh
5256    
5257     - for i in {"$libdir","$usrlibdir"}/libnss_files*; do
5258     - [ -e "$i" ] && dracut_install "$i"
5259     + for _i in {"$libdir","$usrlibdir"}/libnss_files*; do
5260     + [ -e "$_i" ] && dracut_install "$_i"
5261     done
5262     }
5263    
5264     diff -Naur dracut-010/modules.d/95zfcp/module-setup.sh dracut-0e6a94b/modules.d/95zfcp/module-setup.sh
5265     --- dracut-010/modules.d/95zfcp/module-setup.sh 2011-03-31 19:50:31.000000000 +0200
5266     +++ dracut-0e6a94b/modules.d/95zfcp/module-setup.sh 2011-05-31 16:34:37.000000000 +0200
5267     @@ -4,14 +4,14 @@
5268    
5269     check() {
5270     arch=$(uname -m)
5271     - [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
5272     + [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
5273    
5274     return 0
5275     }
5276    
5277     depends() {
5278     arch=$(uname -m)
5279     - [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
5280     + [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
5281    
5282     return 0
5283     }
5284     diff -Naur dracut-010/modules.d/95zfcp/parse-zfcp.sh dracut-0e6a94b/modules.d/95zfcp/parse-zfcp.sh
5285     --- dracut-010/modules.d/95zfcp/parse-zfcp.sh 2011-03-31 19:50:31.000000000 +0200
5286     +++ dracut-0e6a94b/modules.d/95zfcp/parse-zfcp.sh 2011-05-31 16:34:37.000000000 +0200
5287     @@ -5,7 +5,7 @@
5288     getargbool 1 rd.zfcp.conf -n rd_NO_ZFCPCONF || rm /etc/zfcp.conf
5289    
5290     for zfcp_arg in $(getargs rd.zfcp 'rd_ZFCP='); do
5291     - (
5292     + (
5293     IFS=","
5294     set $zfcp_arg
5295     echo "$@" >> /etc/zfcp.conf
5296     diff -Naur dracut-010/modules.d/95zfcp/zfcpconf.sh dracut-0e6a94b/modules.d/95zfcp/zfcpconf.sh
5297     --- dracut-010/modules.d/95zfcp/zfcpconf.sh 2011-03-31 19:50:31.000000000 +0200
5298     +++ dracut-0e6a94b/modules.d/95zfcp/zfcpconf.sh 2011-05-31 16:34:37.000000000 +0200
5299     @@ -6,22 +6,22 @@
5300     # deviceno WWPN FCPLUN
5301     #
5302     # Example:
5303     -# 0.0.4000 0x5005076300C213e9 0x5022000000000000
5304     -# 0.0.4001 0x5005076300c213e9 0x5023000000000000
5305     +# 0.0.4000 0x5005076300C213e9 0x5022000000000000
5306     +# 0.0.4001 0x5005076300c213e9 0x5023000000000000
5307     #
5308     #
5309     # manual setup:
5310     # modprobe zfcp
5311     # echo 1 > /sys/bus/ccw/drivers/zfcp/0.0.4000/online
5312     # echo LUN > /sys/bus/ccw/drivers/zfcp/0.0.4000/WWPN/unit_add
5313     -#
5314     +#
5315     # Example:
5316     # modprobe zfcp
5317     # echo 1 > /sys/bus/ccw/drivers/zfcp/0.0.4000/online
5318     # echo 0x5022000000000000 > /sys/bus/ccw/drivers/zfcp/0.0.4000/0x5005076300c213e9/unit_add
5319    
5320     CONFIG=/etc/zfcp.conf
5321     -PATH=/bin:/usr/bin:/sbin:/usr/sbin
5322     +PATH=/usr/sbin:/usr/bin:/sbin:/bin
5323    
5324     if [ -f "$CONFIG" ]; then
5325     if [ ! -d /sys/bus/ccw/drivers/zfcp ]; then
5326     diff -Naur dracut-010/modules.d/95znet/module-setup.sh dracut-0e6a94b/modules.d/95znet/module-setup.sh
5327     --- dracut-010/modules.d/95znet/module-setup.sh 2011-03-31 19:50:31.000000000 +0200
5328     +++ dracut-0e6a94b/modules.d/95znet/module-setup.sh 2011-05-31 16:34:37.000000000 +0200
5329     @@ -4,7 +4,7 @@
5330    
5331     check() {
5332     arch=$(uname -m)
5333     - [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
5334     + [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
5335    
5336     return 0
5337     }
5338     diff -Naur dracut-010/modules.d/98selinux/selinux-loadpolicy.sh dracut-0e6a94b/modules.d/98selinux/selinux-loadpolicy.sh
5339     --- dracut-010/modules.d/98selinux/selinux-loadpolicy.sh 2011-03-31 19:50:31.000000000 +0200
5340     +++ dracut-0e6a94b/modules.d/98selinux/selinux-loadpolicy.sh 2011-05-31 16:34:37.000000000 +0200
5341     @@ -2,11 +2,11 @@
5342     # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
5343     # ex: ts=8 sw=4 sts=4 et filetype=sh
5344    
5345     -# FIXME: load selinux policy. this should really be done after we switchroot
5346     +# FIXME: load selinux policy. this should really be done after we switchroot
5347    
5348     rd_load_policy()
5349     {
5350     - # If SELinux is disabled exit now
5351     + # If SELinux is disabled exit now
5352     getarg "selinux=0" > /dev/null && return 0
5353    
5354     SELINUX="enforcing"
5355     @@ -14,7 +14,7 @@
5356    
5357     # Check whether SELinux is in permissive mode
5358     permissive=0
5359     - getarg "enforcing=0" > /dev/null
5360     + getarg "enforcing=0" > /dev/null
5361     if [ $? -eq 0 -o "$SELINUX" = "permissive" ]; then
5362     permissive=1
5363     fi
5364     @@ -24,7 +24,7 @@
5365     local ret=0
5366     local out
5367     info "Loading SELinux policy"
5368     - # load_policy does mount /proc and /selinux in
5369     + # load_policy does mount /proc and /selinux in
5370     # libselinux,selinux_init_load_policy()
5371     if [ -x "$NEWROOT/sbin/load_policy" ]; then
5372     out=$(chroot "$NEWROOT" /sbin/load_policy -i 2>&1)
5373     diff -Naur dracut-010/modules.d/98syslog/module-setup.sh dracut-0e6a94b/modules.d/98syslog/module-setup.sh
5374     --- dracut-010/modules.d/98syslog/module-setup.sh 2011-03-31 19:50:31.000000000 +0200
5375     +++ dracut-0e6a94b/modules.d/98syslog/module-setup.sh 2011-05-31 16:34:37.000000000 +0200
5376     @@ -12,30 +12,32 @@
5377     }
5378    
5379     install() {
5380     + local _i
5381     + local _installs
5382     if type -P rsyslogd >/dev/null; then
5383     - installs="rsyslogd"
5384     - for i in {"$libdir","$usrlibdir"}/rsyslog/lmnet.so \
5385     + _installs="rsyslogd"
5386     + for _i in {"$libdir","$usrlibdir"}/rsyslog/lmnet.so \
5387     {"$libdir","$usrlibdir"}/rsyslog/imklog.so \
5388     {"$libdir","$usrlibdir"}/rsyslog/imuxsock.so ; do
5389     - [ -e "$i" ] && installs="$installs $i"
5390     + [ -e "$_i" ] && _installs="$_installs $_i"
5391     done
5392     elif type -P syslogd >/dev/null; then
5393     - installs="syslogd"
5394     + _installs="syslogd"
5395     elif type -P syslog-ng >/dev/null; then
5396     - installs="syslog-ng"
5397     + _installs="syslog-ng"
5398     else
5399     derror "Could not find any syslog binary although the syslogmodule" \
5400     "is selected to be installed. Please check."
5401     fi
5402     - if [ -n "$installs" ]; then
5403     + if [ -n "$_installs" ]; then
5404     dracut_install cat
5405     - dracut_install $installs
5406     + dracut_install $_installs
5407     inst_hook cmdline 90 "$moddir/parse-syslog-opts.sh"
5408     inst_hook pre-udev 61 "$moddir/syslog-genrules.sh"
5409     inst_hook pre-pivot 99 "$moddir/syslog-cleanup.sh"
5410     inst_simple "$moddir/rsyslogd-start.sh" /sbin/rsyslogd-start
5411     inst_simple "$moddir/rsyslogd-stop.sh" /sbin/rsyslogd-stop
5412     - mkdir -p ${initdir}/etc/templates
5413     + mkdir -m 0755 -p ${initdir}/etc/templates
5414     inst_simple "${moddir}/rsyslog.conf" /etc/templates
5415     fi
5416     }
5417     diff -Naur dracut-010/modules.d/98syslog/parse-syslog-opts.sh dracut-0e6a94b/modules.d/98syslog/parse-syslog-opts.sh
5418     --- dracut-010/modules.d/98syslog/parse-syslog-opts.sh 2011-03-31 19:50:31.000000000 +0200
5419     +++ dracut-0e6a94b/modules.d/98syslog/parse-syslog-opts.sh 2011-05-31 16:34:37.000000000 +0200
5420     @@ -7,7 +7,7 @@
5421     #Bootparameters:
5422     #syslogserver=ip Where to syslog to
5423     #sysloglevel=level What level has to be logged
5424     -#syslogtype=rsyslog|syslog|syslogng
5425     +#syslogtype=rsyslog|syslog|syslogng
5426     # Don't auto detect syslog but set it
5427     type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
5428    
5429     diff -Naur dracut-010/modules.d/98syslog/README dracut-0e6a94b/modules.d/98syslog/README
5430     --- dracut-010/modules.d/98syslog/README 2011-03-31 19:50:31.000000000 +0200
5431     +++ dracut-0e6a94b/modules.d/98syslog/README 2011-05-31 16:34:37.000000000 +0200
5432     @@ -1,16 +1,16 @@
5433     Syslog support for dracut
5434    
5435     This module provides syslog functionality in the initrd.
5436     -This is especially interesting when complex configuration being
5437     +This is especially interesting when complex configuration being
5438     used to provide access to the device the rootfs resides on.
5439    
5440     -When this module is installed into the ramfs it is triggered by
5441     +When this module is installed into the ramfs it is triggered by
5442     the udev event from the nic being setup (online).
5443    
5444     Then if syslog is configured it is started and will forward all
5445     kernel messages to the given syslog server.
5446    
5447     -The syslog implementation is detected automatically by finding the
5448     +The syslog implementation is detected automatically by finding the
5449     apropriate binary with the following order:
5450     rsyslogd
5451     syslogd
5452     @@ -20,5 +20,5 @@
5453     Bootparameters:
5454     syslogserver=ip Where to syslog to
5455     sysloglevel=level What level has to be logged
5456     -syslogtype=rsyslog|syslog|syslogng
5457     - Don't auto detect syslog but set it
5458     +syslogtype=rsyslog|syslog|syslogng
5459     + Don't auto detect syslog but set it
5460     diff -Naur dracut-010/modules.d/98syslog/rsyslogd-start.sh dracut-0e6a94b/modules.d/98syslog/rsyslogd-start.sh
5461     --- dracut-010/modules.d/98syslog/rsyslogd-start.sh 2011-03-31 19:50:31.000000000 +0200
5462     +++ dracut-0e6a94b/modules.d/98syslog/rsyslogd-start.sh 2011-05-31 16:34:37.000000000 +0200
5463     @@ -13,7 +13,7 @@
5464     shift
5465     local filters=$*
5466     local filter=
5467     -
5468     +
5469     cat $syslog_template
5470    
5471     for filter in $filters; do
5472     @@ -31,5 +31,5 @@
5473     template=/etc/templates/rsyslog.conf
5474     if [ -n "$server" ]; then
5475     rsyslog_config "$server" "$template" "$filters" > $conf
5476     - /sbin/rsyslogd -c3
5477     -fi
5478     + rsyslogd -c3
5479     +fi
5480     diff -Naur dracut-010/modules.d/98syslog/syslog-cleanup.sh dracut-0e6a94b/modules.d/98syslog/syslog-cleanup.sh
5481     --- dracut-010/modules.d/98syslog/syslog-cleanup.sh 2011-03-31 19:50:31.000000000 +0200
5482     +++ dracut-0e6a94b/modules.d/98syslog/syslog-cleanup.sh 2011-05-31 16:34:37.000000000 +0200
5483     @@ -8,7 +8,7 @@
5484    
5485     if [ -f /tmp/syslog.server ]; then
5486     read syslogtype < /tmp/syslog.type
5487     - if [ -e "/sbin/${syslogtype}-stop" ]; then
5488     + if command -v "${syslogtype}-stop" >/dev/null; then
5489     ${syslogtype}-stop
5490     else
5491     warn "syslog-cleanup: Could not find script to stop syslog of type \"$syslogtype\". Syslog will not be stopped."
5492     diff -Naur dracut-010/modules.d/98syslog/syslog-genrules.sh dracut-0e6a94b/modules.d/98syslog/syslog-genrules.sh
5493     --- dracut-010/modules.d/98syslog/syslog-genrules.sh 2011-03-31 19:50:31.000000000 +0200
5494     +++ dracut-0e6a94b/modules.d/98syslog/syslog-genrules.sh 2011-05-31 16:34:37.000000000 +0200
5495     @@ -18,7 +18,7 @@
5496     fi
5497     echo "$syslogtype"
5498     [ -n "$syslogtype" ]
5499     -}
5500     +}
5501    
5502     read syslogtype < /tmp/syslog.type
5503     if [ -z "$syslogtype" ]; then
5504     diff -Naur dracut-010/modules.d/99base/dracut-lib.sh dracut-0e6a94b/modules.d/99base/dracut-lib.sh
5505     --- dracut-010/modules.d/99base/dracut-lib.sh 2011-03-31 19:50:31.000000000 +0200
5506     +++ dracut-0e6a94b/modules.d/99base/dracut-lib.sh 2011-05-31 16:34:37.000000000 +0200
5507     @@ -52,12 +52,12 @@
5508    
5509     for _o in $CMDLINE; do
5510     if [ "$_o" = "$1" ]; then
5511     - return 0;
5512     + return 0;
5513     fi
5514     [ "${_o%%=*}" = "${1%=}" ] && _val=${_o#*=};
5515     done
5516     if [ -n "$_val" ]; then
5517     - echo $_val;
5518     + echo $_val;
5519     return 0;
5520     fi
5521     return 1;
5522     @@ -86,7 +86,7 @@
5523     shift;;
5524     esac
5525     done
5526     - [ "$RD_DEBUG" = "yes" ] && set -x
5527     + [ "$RD_DEBUG" = "yes" ] && set -x
5528     return 1
5529     }
5530    
5531     @@ -105,7 +105,7 @@
5532     }
5533    
5534     _dogetargs() {
5535     - set +x
5536     + set +x
5537     local _o _found
5538     unset _o
5539     unset _found
5540     @@ -116,7 +116,7 @@
5541     return 0;
5542     fi
5543     if [ "${_o%%=*}" = "${1%=}" ]; then
5544     - echo -n "${_o#*=} ";
5545     + echo -n "${_o#*=} ";
5546     _found=1;
5547     fi
5548     done
5549     @@ -134,10 +134,10 @@
5550     done
5551     if [ -n "$_val" ]; then
5552     echo -n $_val
5553     - [ "$RD_DEBUG" = "yes" ] && set -x
5554     + [ "$RD_DEBUG" = "yes" ] && set -x
5555     return 0
5556     fi
5557     - [ "$RD_DEBUG" = "yes" ] && set -x
5558     + [ "$RD_DEBUG" = "yes" ] && set -x
5559     return 1;
5560     }
5561    
5562     @@ -146,7 +146,7 @@
5563     # it just returns 0. Otherwise 1 is returned.
5564     # $1 = options separated by commas
5565     # $2 = option we are interested in
5566     -#
5567     +#
5568     # Example:
5569     # $1 = cipher=aes-cbc-essiv:sha256,hash=sha256,verify
5570     # $2 = hash
5571     @@ -199,12 +199,14 @@
5572     if [ -e /proc/cmdline ]; then
5573     RD_DEBUG=no
5574     if getargbool 0 rd.debug -y rdinitdebug -y rdnetdebug; then
5575     - RD_DEBUG=yes
5576     - fi
5577     + RD_DEBUG=yes
5578     + [ -n "$BASH" ] && \
5579     + export PS4='${BASH_SOURCE}@${LINENO}(${FUNCNAME[0]}): ';
5580     + fi
5581     fi
5582     export RD_DEBUG
5583     fi
5584     - [ "$RD_DEBUG" = "yes" ] && set -x
5585     + [ "$RD_DEBUG" = "yes" ] && set -x
5586     }
5587    
5588     setdebug
5589     @@ -240,13 +242,12 @@
5590     echo "<24>dracut: Refusing to continue";
5591     } > /dev/kmsg
5592    
5593     - {
5594     + {
5595     echo "warn dracut: FATAL: \"$@\"";
5596     echo "warn dracut: Refusing to continue";
5597     - echo "exit 1"
5598     } >> $hookdir/emergency/01-die.sh
5599    
5600     - > /.die
5601     + > /run/initramfs/.die
5602     exit 1
5603     }
5604    
5605     @@ -261,19 +262,24 @@
5606     warn() {
5607     check_quiet
5608     echo "<28>dracut Warning: $@" > /dev/kmsg
5609     - [ "$DRACUT_QUIET" != "yes" ] && \
5610     - echo "dracut Warning: $@" >&2
5611     + echo "dracut Warning: $@" >&2
5612     }
5613    
5614     info() {
5615     check_quiet
5616     echo "<30>dracut: $@" > /dev/kmsg
5617     [ "$DRACUT_QUIET" != "yes" ] && \
5618     - echo "dracut: $@"
5619     + echo "dracut: $@"
5620     +}
5621     +
5622     +vwarn() {
5623     + while read line; do
5624     + warn $line;
5625     + done
5626     }
5627    
5628     vinfo() {
5629     - while read line; do
5630     + while read line; do
5631     info $line;
5632     done
5633     }
5634     @@ -299,8 +305,8 @@
5635     local file="$1";
5636     local str="$2";
5637    
5638     - [ -z "$file" ] && return;
5639     - [ -z "$str" ] && return;
5640     + [ -z "$file" ] && return 1;
5641     + [ -z "$str" ] && return 1;
5642    
5643     while read dummy check restofline; do
5644     [ "$check" = "$str" ] && return 0
5645     @@ -328,18 +334,25 @@
5646     fi
5647     }
5648    
5649     +ismounted() {
5650     + while read a m a; do
5651     + [ "$m" = "$1" ] && return 0
5652     + done < /proc/mounts
5653     + return 1
5654     +}
5655     +
5656     wait_for_if_up() {
5657     local cnt=0
5658     - while [ $cnt -lt 20 ]; do
5659     + while [ $cnt -lt 20 ]; do
5660     li=$(ip link show $1)
5661     [ -z "${li##*state UP*}" ] && return 0
5662     sleep 0.1
5663     cnt=$(($cnt+1))
5664     - done
5665     + done
5666     return 1
5667     }
5668    
5669     -# root=nfs:[<server-ip>:]<root-dir>[:<nfs-options>]
5670     +# root=nfs:[<server-ip>:]<root-dir>[:<nfs-options>]
5671     # root=nfs4:[<server-ip>:]<root-dir>[:<nfs-options>]
5672     nfsroot_to_var() {
5673     # strip nfs[4]:
5674     @@ -361,10 +374,10 @@
5675     options="${options##:}"
5676     # strip ":"
5677     options="${options%%:}"
5678     -
5679     +
5680     # Does it really start with '/'?
5681     [ -n "${path%%/*}" ] && path="error";
5682     -
5683     +
5684     #Fix kernel legacy style separating path and options with ','
5685     if [ "$path" != "${path#*,}" ] ; then
5686     options=${path#*,}
5687     @@ -375,7 +388,7 @@
5688     ip_to_var() {
5689     local v=${1}:
5690     local i
5691     - set --
5692     + set --
5693     while [ -n "$v" ]; do
5694     if [ "${v#\[*:*:*\]:}" != "$v" ]; then
5695     # handle IPv6 address
5696     @@ -383,7 +396,7 @@
5697     i="${i##\[}"
5698     set -- "$@" "$i"
5699     v=${v#\[$i\]:}
5700     - else
5701     + else
5702     set -- "$@" "${v%%:*}"
5703     v=${v#*:}
5704     fi
5705     @@ -453,10 +466,10 @@
5706     local dir="$1"; local prefix="$2"
5707     local retdir; local retdir_new
5708    
5709     - [ -d "${dir}" ] || mkdir -p "${dir}" || return 1
5710     + [ -d "${dir}" ] || mkdir -m 0755 -p "${dir}" || return 1
5711    
5712     retdir=$(funiq "${dir}" "${prefix}") || return 1
5713     - until mkdir "${retdir}" 2>/dev/null; do
5714     + until mkdir -m 0755 "${retdir}" 2>/dev/null; do
5715     retdir_new=$(funiq "${dir}" "${prefix}") || return 1
5716     [ "$retdir_new" = "$retdir" ] && return 1
5717     retdir="$retdir_new"
5718     @@ -502,3 +515,50 @@
5719    
5720     return 1
5721     )
5722     +
5723     +# Wrap fsck call for device _dev with additional fsck options _fsckopts return
5724     +# fsck's return code
5725     +wrap_fsck() {
5726     + local _ret _out _dev="$1" _fsckopts="$2"
5727     +
5728     + info "Checking filesystem."
5729     + info fsck -T $_fsckopts "$_dev"
5730     + _out=$(fsck -T $_fsckopts "$_dev") ; _ret=$?
5731     +
5732     + # A return of 4 or higher means there were serious problems.
5733     + if [ $_ret -gt 3 ]; then
5734     + echo $_out|vwarn
5735     + warn "fsck returned with error code $_ret"
5736     + warn "*** An error occurred during the file system check."
5737     + warn "*** Dropping you to a shell; the system will try"
5738     + warn "*** to mount the filesystem, when you leave the shell."
5739     + emergency_shell -n "(Repair filesystem)"
5740     + else
5741     + echo $_out|vinfo
5742     + [ $_ret -gt 0 ] && warn "fsck returned with $_ret"
5743     + fi
5744     +
5745     + return $_ret
5746     +}
5747     +
5748     +# Verify supplied filesystem type, fix if it's invalid, warn user if
5749     +# appropriate
5750     +det_fs() {
5751     + local _dev="$1" _fs="${2:-auto}" _inf="$3" _orig
5752     +
5753     + _orig="$_fs"
5754     + _fs=$(udevadm info --query=env --name="$_dev" | \
5755     + while read line; do
5756     + if str_starts $line "ID_FS_TYPE="; then
5757     + echo ${line#ID_FS_TYPE=}
5758     + break
5759     + fi
5760     + done)
5761     + _fs=${_fs:-auto}
5762     + if [ "$_fs" = "auto" ]; then
5763     + warn "Cannon detect filesystem type for device $_dev"
5764     + elif [ "$_orig" != "auto" -a "$_fs" != "$_orig" ]; then
5765     + warn "$_inf: detected filesystem '$_fs' instead of '$_orig' for device: $_dev"
5766     + fi
5767     + echo "$_fs"
5768     +}
5769     diff -Naur dracut-010/modules.d/99base/init dracut-0e6a94b/modules.d/99base/init
5770     --- dracut-010/modules.d/99base/init 2011-03-31 19:50:31.000000000 +0200
5771     +++ dracut-0e6a94b/modules.d/99base/init 2011-05-31 16:34:37.000000000 +0200
5772     @@ -10,32 +10,30 @@
5773    
5774     wait_for_loginit()
5775     {
5776     - if getargbool 0 rd.debug -y rdinitdebug -y rdnetdebug; then
5777     - set +x
5778     - echo "DRACUT_LOG_END"
5779     - exec 0<>/dev/console 1<>/dev/console 2<>/dev/console
5780     + set +x
5781     + [ "$RD_DEBUG" = "yes" ] || return
5782     + [ -e /run/initramfs/loginit.pipe ] || return
5783     + echo "DRACUT_LOG_END"
5784     + exec 0<>/dev/console 1<>/dev/console 2<>/dev/console
5785     # wait for loginit
5786     - i=0
5787     - while [ $i -lt 10 ]; do
5788     - if [ -e /run/initramfs/init.log.end ]; then
5789     - j=$(jobs)
5790     - [ -z "$j" ] && break
5791     - [ -z "${j##*Running*}" ] || break
5792     - fi
5793     - sleep 0.1
5794     - i=$(($i+1))
5795     - done
5796     - [ $i -eq 10 ] && kill %1 >/dev/null 2>&1
5797     -
5798     - while pidof -x /sbin/loginit >/dev/null 2>&1; do
5799     - for pid in $(pidof -x /sbin/loginit); do
5800     - kill $HARD $pid >/dev/null 2>&1
5801     - done
5802     - HARD="-9"
5803     - done
5804     - set -x
5805     + i=0
5806     + while [ $i -lt 10 ]; do
5807     + if [ ! -e /run/initramfs/loginit.pipe ]; then
5808     + j=$(jobs)
5809     + [ -z "$j" ] && break
5810     + [ -z "${j##*Running*}" ] || break
5811     + fi
5812     + sleep 0.1
5813     + i=$(($i+1))
5814     + done
5815     +
5816     + if [ $i -eq 10 ]; then
5817     + kill %1 >/dev/null 2>&1
5818     + kill $(while read line;do echo $line;done</run/initramfs/loginit.pid)
5819     fi
5820     - rm -f /run/initramfs/initlog.pipe /run/initramfs/init.log.end
5821     +
5822     + set -x
5823     + rm -f /run/initramfs/loginit.pipe /run/initramfs/loginit.pid
5824     }
5825    
5826     emergency_shell()
5827     @@ -43,7 +41,7 @@
5828     set +e
5829     if [ "$1" = "-n" ]; then
5830     _rdshell_name=$2
5831     - shift 2
5832     + shift 2
5833     else
5834     _rdshell_name=dracut
5835     fi
5836     @@ -52,7 +50,7 @@
5837     source_hook emergency
5838     echo
5839     wait_for_loginit
5840     - [ -e /.die ] && exit 1
5841     + [ -e /run/initramfs/.die ] && exit 1
5842     if getargbool 1 rd.shell -y rdshell || getarg rd.break rdbreak; then
5843     echo "Dropping to debug shell."
5844     echo
5845     @@ -66,20 +64,25 @@
5846     fi
5847     }
5848    
5849     -OLD_PATH="$PATH"
5850     -export PATH=/sbin:/bin:/usr/sbin:/usr/bin
5851     NEWROOT="/sysroot"
5852     +[ -d $NEWROOT ] || mkdir -p -m 0755 $NEWROOT
5853    
5854     trap "emergency_shell Signal caught!" 0
5855     +OLDPATH=$PATH
5856     +PATH=/usr/sbin:/usr/bin:/sbin:/bin
5857     +export PATH
5858    
5859     -RDDEBUG=""
5860     +RD_DEBUG=""
5861     . /lib/dracut-lib.sh
5862    
5863     [ -c /dev/null ] || mknod -m 0666 /dev/null c 1 3
5864    
5865     # mount some important things
5866     -mount -t proc -o nosuid,noexec,nodev /proc /proc >/dev/null 2>&1
5867     -mount -t sysfs -o nosuid,noexec,nodev /sys /sys >/dev/null 2>&1
5868     +[ ! -d /proc/self ] && \
5869     + mount -t proc -o nosuid,noexec,nodev /proc /proc >/dev/null 2>&1
5870     +
5871     +[ ! -d /sys/kernel ] && \
5872     + mount -t sysfs -o nosuid,noexec,nodev /sys /sys >/dev/null 2>&1
5873    
5874     if [ -x /lib/systemd/systemd-timestamp ]; then
5875     RD_TIMESTAMP=$(/lib/systemd/systemd-timestamp)
5876     @@ -88,11 +91,19 @@
5877     unset _tmp
5878     fi
5879    
5880     -if [ ! -c /dev/ptmx ]; then
5881     +setdebug
5882     +
5883     +if [ "$RD_DEBUG" = "yes" ]; then
5884     + getarg quiet && DRACUT_QUIET="yes"
5885     + a=$(getarg loglevel=)
5886     + [ -n "$a" ] && [ $a -ge 8 ] && unset DRACUT_QUIET
5887     +fi
5888     +
5889     +if ! ismounted /dev; then
5890     # try to mount devtmpfs
5891     - if ! mount -t devtmpfs -o mode=0755,nosuid udev /dev >/dev/null 2>&1; then
5892     + if ! mount -t devtmpfs -o mode=0755,nosuid,noexec udev /dev >/dev/null 2>&1; then
5893     # if it failed fall back to normal tmpfs
5894     - mount -t tmpfs -o mode=0755,nosuid udev /dev >/dev/null 2>&1
5895     + mount -t tmpfs -o mode=0755,nosuid udev /dev >/dev/null 2>&1
5896     # Make some basic devices first, let udev handle the rest
5897     mknod -m 0666 /dev/null c 1 3
5898     mknod -m 0666 /dev/ptmx c 5 2
5899     @@ -102,48 +113,50 @@
5900     fi
5901    
5902     # prepare the /dev directory
5903     -ln -s /proc/self/fd /dev/fd >/dev/null 2>&1
5904     -ln -s /proc/self/fd/0 /dev/stdin >/dev/null 2>&1
5905     -ln -s /proc/self/fd/1 /dev/stdout >/dev/null 2>&1
5906     -ln -s /proc/self/fd/2 /dev/stderr >/dev/null 2>&1
5907     -mkdir -m 0755 /dev/shm /dev/pts /run
5908     -mount -t devpts -o gid=5,mode=620,noexec,nosuid devpts /dev/pts >/dev/null 2>&1
5909     -mount -t tmpfs -o mode=1777,nosuid,nodev tmpfs /dev/shm >/dev/null 2>&1
5910     -# create /run which will obsolete /var/run
5911     -mount -t tmpfs -o mode=0755,nodev,noexec,nosuid tmpfs /run >/dev/null 2>&1
5912     +[ ! -h /dev/fd ] && ln -s /proc/self/fd /dev/fd >/dev/null 2>&1
5913     +[ ! -h /dev/stdin ] && ln -s /proc/self/fd/0 /dev/stdin >/dev/null 2>&1
5914     +[ ! -h /dev/stdout ] && ln -s /proc/self/fd/1 /dev/stdout >/dev/null 2>&1
5915     +[ ! -h /dev/stderr ] && ln -s /proc/self/fd/2 /dev/stderr >/dev/null 2>&1
5916     +
5917     +if ! ismounted /dev/pts; then
5918     + mkdir -m 0755 /dev/pts
5919     + mount -t devpts -o gid=5,mode=620,noexec,nosuid devpts /dev/pts >/dev/null 2>&1
5920     +fi
5921     +
5922     +if ! ismounted /dev/shm; then
5923     + mkdir -m 0755 /dev/shm
5924     + mount -t tmpfs -o mode=1777,nosuid,nodev tmpfs /dev/shm >/dev/null 2>&1
5925     +fi
5926     +
5927     +if ! ismounted /run; then
5928     + mkdir -m 0755 /newrun
5929     + mount -t tmpfs -o mode=0755,nosuid,nodev tmpfs /newrun >/dev/null 2>&1
5930     + cp -a -t /newrun /run/*
5931     + mount --move /newrun /run
5932     + rm -fr /newrun
5933     +fi
5934    
5935     -mkdir -m 0755 /run/initramfs
5936     +[ -d /run/initramfs ] || mkdir -p -m 0755 /run/initramfs
5937    
5938     UDEVVERSION=$(udevadm --version)
5939     if [ $UDEVVERSION -gt 166 ]; then
5940     # newer versions of udev use /run/udev/rules.d
5941     - mkdir -m 0755 /run/udev /run/udev/rules.d
5942     export UDEVRULESD=/run/udev/rules.d
5943     + [ -d /run/udev ] || mkdir -p -m 0755 /run/udev
5944     + [ -d $UDEVRULESD ] || mkdir -p -m 0755 $UDEVRULESD
5945     else
5946     - mkdir -m 0755 /dev/.udev /dev/.udev/rules.d
5947     + mkdir -m 0755 /dev/.udev /dev/.udev/rules.d
5948     export UDEVRULESD=/dev/.udev/rules.d
5949     fi
5950    
5951     -[ -e /var/run ] && mv /var/run /var/run.bak
5952     -[ -e /var/lock ] && mv /var/lock /var/lock.bak
5953     -ln -fs /run /var/run
5954     -mkdir -m 0755 /run/lock
5955     -ln -fs /run/lock /var/lock
5956     -# copy over any possible directory structure
5957     -cp -ar /var/run.bak/* /run/ 2>/dev/null
5958     -cp -ar /var/lock.bak/* /run/lock/ 2>/dev/null
5959     -
5960     -if getargbool 0 rd.debug -y rdinitdebug -y rdnetdebug; then
5961     - getarg quiet && DRACUT_QUIET="yes"
5962     - mkfifo /run/initramfs/initlog.pipe
5963     - /sbin/loginit $DRACUT_QUIET </run/initramfs/initlog.pipe >/dev/console 2>&1 &
5964     - exec >/run/initramfs/initlog.pipe 2>&1
5965     +if [ "$RD_DEBUG" = "yes" ]; then
5966     + mkfifo /run/initramfs/loginit.pipe
5967     + loginit $DRACUT_QUIET </run/initramfs/loginit.pipe >/dev/console 2>&1 &
5968     + exec >/run/initramfs/loginit.pipe 2>&1
5969     else
5970     exec 0<>/dev/console 1<>/dev/console 2<>/dev/console
5971     fi
5972    
5973     -setdebug
5974     -
5975     source_conf /etc/conf.d
5976    
5977     # run scriptlets to parse the command line
5978     @@ -178,8 +191,9 @@
5979     UDEV_QUEUE_EMPTY="udevadm settle --timeout=1"
5980     fi
5981    
5982     -getargbool 0 rd.udev.info -y rdudevinfo && udevadm control $UDEV_LOG_PRIO_ARG=info
5983     -getargbool 0 rd.udev.debug -y rdudevdebug && udevadm control $UDEV_LOG_PRIO_ARG=debug
5984     +getargbool 0 rd.udev.info -y rdudevinfo && udevproperty "$UDEV_LOG_PRIO_ARG=info"
5985     +getargbool 0 rd.udev.debug -y rdudevdebug && udevproperty "$UDEV_LOG_PRIO_ARG=debug"
5986     +udevproperty "hookdir=$hookdir"
5987    
5988     getarg 'rd.break=pre-trigger' 'rdbreak=pre-trigger' && emergency_shell -n pre-trigger "Break before pre-trigger"
5989     source_hook pre-trigger
5990     @@ -197,7 +211,7 @@
5991     while :; do
5992    
5993     check_finished && break
5994     -
5995     +
5996     udevsettle
5997    
5998     check_finished && break
5999     @@ -205,7 +219,7 @@
6000     if [ -f $hookdir/initqueue/work ]; then
6001     rm $hookdir/initqueue/work
6002     fi
6003     -
6004     +
6005     for job in $hookdir/initqueue/*.sh; do
6006     [ -e "$job" ] || break
6007     job=$job . $job
6008     @@ -229,7 +243,7 @@
6009     # which report no medium for quiet
6010     # some time.
6011     for cdrom in /sys/block/sr*; do
6012     - [ -e "$cdrom" ] || continue
6013     + [ -e "$cdrom" ] || continue
6014     # skip, if cdrom medium was already found
6015     strstr "$(udevadm info --query=env --path=${cdrom##/sys})" \
6016     ID_CDROM_MEDIA && continue
6017     @@ -244,7 +258,7 @@
6018     echo change > "$cdrom/uevent"
6019     fi
6020     done
6021     -
6022     +
6023     i=$(($i+1))
6024     [ $i -gt $RDRETRY ] \
6025     && { flock -s 9 ; emergency_shell "No root device \"$root\" found"; } 9>/.console_lock
6026     @@ -254,7 +268,7 @@
6027    
6028     # reset cdrom polling
6029     for cdrom in /sys/block/sr*; do
6030     - [ -e "$cdrom" ] || continue
6031     + [ -e "$cdrom" ] || continue
6032     if [ -e "$cdrom"/events_poll_msecs ]; then
6033     echo -1 > "$cdrom"/events_poll_msecs
6034     fi
6035     @@ -284,7 +298,7 @@
6036    
6037     {
6038     echo -n "Mounted root filesystem "
6039     - while read dev mp rest; do [ "$mp" = "$NEWROOT" ] && echo $dev; done < /proc/mounts
6040     + while read dev mp rest; do [ "$mp" = "$NEWROOT" ] && echo $dev; done < /proc/mounts
6041     } | vinfo
6042    
6043     # pre pivot scripts are sourced just before we switch over to the new root.
6044     @@ -309,46 +323,58 @@
6045    
6046     getarg rd.break rdbreak && emergency_shell -n switch_root "Break before switch_root"
6047    
6048     -# stop udev queue before killing it
6049     -udevadm control --stop-exec-queue
6050     -
6051     -HARD=""
6052     -while pidof udevd >/dev/null 2>&1; do
6053     - for pid in $(pidof udevd); do
6054     - kill $HARD $pid >/dev/null 2>&1
6055     +if [ $UDEVVERSION -lt 168 ]; then
6056     + # stop udev queue before killing it
6057     + udevadm control --stop-exec-queue
6058     +
6059     + HARD=""
6060     + while pidof udevd >/dev/null 2>&1; do
6061     + for pid in $(pidof udevd); do
6062     + kill $HARD $pid >/dev/null 2>&1
6063     + done
6064     + HARD="-9"
6065     done
6066     - HARD="-9"
6067     -done
6068     +else
6069     + udevadm control --exit
6070     + udevadm info --cleanup-db
6071     +fi
6072    
6073     +export RD_TIMESTAMP
6074     +set +x # Turn off debugging for this section
6075     # Clean up the environment
6076     for i in $(export -p); do
6077     i=${i#declare -x}
6078     i=${i#export}
6079     - # skip RD_ vars
6080     - [ "$i" != "${i#RD_}" ] && continue
6081     + strstr "$i" "=" || continue
6082     i=${i%%=*}
6083     - [ "$i" = "root" -o "$i" = "PATH" -o "$i" = "HOME" -o "$i" = "TERM" ] || unset $i
6084     + [ -z "$i" ] && continue
6085     + case $i in
6086     + root|PATH|HOME|TERM|PS4|RD_*)
6087     + :;;
6088     + *)
6089     + unset "$i";;
6090     + esac
6091     done
6092    
6093     initargs=""
6094     -
6095     read CLINE </proc/cmdline
6096     if getarg init= >/dev/null ; then
6097     + set +x # Turn off debugging for this section
6098     ignoreargs="console BOOT_IMAGE"
6099     # only pass arguments after init= to the init
6100     CLINE=${CLINE#*init=}
6101     - set $CLINE
6102     - shift
6103     - for x in "$@"; do
6104     - for s in $ignoreargs; do
6105     - [ "${x%%=*}" = $s ] && continue 2
6106     - done
6107     - initargs="$initargs $x"
6108     + set -- $CLINE
6109     + shift # clear out the rest of the "init=" arg
6110     + for x in "$@"; do
6111     + for s in $ignoreargs; do
6112     + [ "${x%%=*}" = $s ] && continue 2
6113     done
6114     - unset CLINE
6115     + initargs="$initargs $x"
6116     + done
6117     + unset CLINE
6118     else
6119     - set $CLINE
6120     - shift
6121     + set +x # Turn off debugging for this section
6122     + set -- $CLINE
6123     for x in "$@"; do
6124     case "$x" in
6125     [0-9]|s|S|single|emergency|auto ) \
6126     @@ -357,43 +383,42 @@
6127     esac
6128     done
6129     fi
6130     +[ "$RD_DEBUG" = "yes" ] && set -x
6131    
6132     -# Debug: Copy state
6133     -if getargbool 0 rd.copystate -y rdcopystate; then
6134     - cp -axr /tmp/* /run/initramfs/ >/dev/null 2>&1
6135     -fi
6136     -
6137     -if getargbool 1 rd.timestamp; then
6138     - export RD_TIMESTAMP
6139     +if [ -d "$NEWROOT"/run ]; then
6140     + NEWRUN="${NEWROOT}/run"
6141     + mount --bind /run "$NEWRUN"
6142     + NEWINITRAMFSROOT="$NEWRUN/initramfs"
6143     +
6144     + if [ "$NEWINITRAMFSROOT/lib" -ef "/lib" ]; then
6145     + for d in bin etc lib lib64 sbin tmp usr var; do
6146     + [ -h /$d ] && ln -fsn $NEWINITRAMFSROOT/$d /$d
6147     + done
6148     + fi
6149     else
6150     - unset RD_TIMESTAMP
6151     -fi
6152     -
6153     -info "Switching root"
6154     + NEWRUN=/dev/.initramfs
6155     + mkdir -m 0755 "$NEWRUN"
6156     + mount --bind /run/initramfs "$NEWRUN"
6157     +fi
6158    
6159     wait_for_loginit
6160    
6161     +info "Switching root"
6162    
6163     -if [ -d "$NEWROOT"/run ]; then
6164     - mount --move /run "$NEWROOT"/run
6165     -else
6166     - if [ -e /run/initramfs ]; then
6167     - cp -axr /run/initramfs /dev/.initramfs >/dev/null 2>&1
6168     - if [ -e /run/initramfs/live ]; then
6169     - mkdir -m 0755 /dev/.initramfs/live
6170     - mount --move /run/initramfs/live /dev/.initramfs/live
6171     - fi
6172     - fi
6173     - umount -l /run
6174     -fi
6175     +unset PS4
6176    
6177     -export PATH="$OLD_PATH"
6178     +CAPSH=$(command -v capsh)
6179     +SWITCH_ROOT=$(command -v switch_root)
6180     +PATH=$OLDPATH
6181     +export PATH
6182    
6183     if [ -f /etc/capsdrop ]; then
6184     . /etc/capsdrop
6185     info "Calling $INIT with capabilities $CAPS_INIT_DROP dropped."
6186     unset RD_DEBUG
6187     - exec /usr/sbin/capsh --drop="$CAPS_INIT_DROP" -- -c "exec /sbin/switch_root \"$NEWROOT\" \"$INIT\" $initargs" || {
6188     + exec $CAPSH --drop="$CAPS_INIT_DROP" -- \
6189     + -c "exec switch_root \"$NEWROOT\" \"$INIT\" $initargs" || \
6190     + {
6191     warn "Command:"
6192     warn capsh --drop=$CAPS_INIT_DROP -- -c exec switch_root "$NEWROOT" "$INIT" $initargs
6193     warn "failed."
6194     @@ -401,7 +426,7 @@
6195     }
6196     else
6197     unset RD_DEBUG
6198     - exec /sbin/switch_root "$NEWROOT" "$INIT" $initargs || {
6199     + exec $SWITCH_ROOT "$NEWROOT" "$INIT" $initargs || {
6200     warn "Something went very badly wrong in the initramfs. Please "
6201     warn "file a bug against dracut."
6202     emergency_shell
6203     diff -Naur dracut-010/modules.d/99base/initqueue dracut-0e6a94b/modules.d/99base/initqueue
6204     --- dracut-010/modules.d/99base/initqueue 2011-03-31 19:50:31.000000000 +0200
6205     +++ dracut-0e6a94b/modules.d/99base/initqueue 2011-05-31 16:34:37.000000000 +0200
6206     @@ -7,6 +7,8 @@
6207     # Copyright 2008-2010, Red Hat, Inc.
6208     # Harald Hoyer <harald@redhat.com>
6209    
6210     +PATH=/usr/sbin:/usr/bin:/sbin:/bin
6211     +
6212     type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
6213    
6214     while [ $# -gt 0 ]; do
6215     @@ -14,7 +16,9 @@
6216     --onetime)
6217     onetime="yes";;
6218     --settled)
6219     - settled="/settled";;
6220     + qname="/settled";;
6221     + --finished)
6222     + qname="/finished";;
6223     --unique)
6224     unique="yes";;
6225     --name)
6226     @@ -32,16 +36,20 @@
6227     job=${job##*/}
6228     fi
6229    
6230     +exe=$1
6231     +shift
6232     +
6233     +[ -x "$exe" ] || exe=$(command -v $exe)
6234    
6235     if [ -n "$onetime" ]; then
6236     - {
6237     + {
6238     echo '[ -e "$job" ] && rm "$job"'
6239     - echo "$@"
6240     + echo "$exe $@"
6241     } > "/tmp/$$-${job}.sh"
6242     else
6243     - echo "$@" > "/tmp/$$-${job}.sh"
6244     + echo "$exe $@" > "/tmp/$$-${job}.sh"
6245     fi
6246    
6247     -mv -f "/tmp/$$-${job}.sh" "$hookdir/initqueue${settled}/${job}.sh"
6248     -[ -z "$settled" ] && >> $hookdir/initqueue/work
6249     +mv -f "/tmp/$$-${job}.sh" "$hookdir/initqueue${qname}/${job}.sh"
6250     +[ -z "$qname" ] && >> $hookdir/initqueue/work
6251    
6252     diff -Naur dracut-010/modules.d/99base/loginit dracut-0e6a94b/modules.d/99base/loginit
6253     --- dracut-010/modules.d/99base/loginit 2011-03-31 19:50:31.000000000 +0200
6254     +++ dracut-0e6a94b/modules.d/99base/loginit 2011-05-31 16:34:37.000000000 +0200
6255     @@ -7,16 +7,18 @@
6256    
6257     QUIET=$1
6258    
6259     +printf -- "$$" > /run/initramfs/loginit.pid
6260     +
6261     [ -e /dev/kmsg ] && exec 5>/dev/kmsg || exec 5>/dev/null
6262     exec 6>/run/initramfs/init.log
6263    
6264     -while read line; do
6265     +while read line; do
6266     if [ "$line" = "DRACUT_LOG_END" ]; then
6267     - > /run/initramfs/init.log.end
6268     + rm -f /run/initramfs/loginit.pipe
6269     exit 0
6270     fi
6271     - echo "<7>dracut: $line" >&5
6272     + echo "<31>dracut: $line" >&5
6273     # if "quiet" is specified we output to /dev/console
6274     - [ -n "$QUIET" ] && echo "dracut: $line"
6275     + [ -n "$QUIET" ] && echo "dracut: $line"
6276     echo "$line" >&6
6277     done
6278     diff -Naur dracut-010/modules.d/99base/module-setup.sh dracut-0e6a94b/modules.d/99base/module-setup.sh
6279     --- dracut-010/modules.d/99base/module-setup.sh 2011-03-31 19:50:31.000000000 +0200
6280     +++ dracut-0e6a94b/modules.d/99base/module-setup.sh 2011-05-31 16:34:37.000000000 +0200
6281     @@ -7,14 +7,15 @@
6282     }
6283    
6284     depends() {
6285     - echo udev-rules
6286     + echo udev-rules
6287     return 0
6288     }
6289    
6290     install() {
6291     + local _d
6292     dracut_install mount mknod mkdir modprobe pidof sleep chroot \
6293     - sed ls flock cp mv dmesg rm ln rmmod mkfifo
6294     - dracut_install -o less
6295     + sed ls flock cp mv dmesg rm ln rmmod mkfifo umount
6296     + dracut_install -o less
6297     if [ ! -e "${initdir}/bin/sh" ]; then
6298     dracut_install bash
6299     (ln -s bash "${initdir}/bin/sh" || :)
6300     @@ -24,23 +25,18 @@
6301     inst "$moddir/initqueue" "/sbin/initqueue"
6302     inst "$moddir/loginit" "/sbin/loginit"
6303    
6304     - mkdir -m 0755 -p ${initdir}/lib
6305     + [ -e "${initdir}/lib" ] || mkdir -m 0755 -p ${initdir}/lib
6306     mkdir -m 0755 -p ${initdir}/lib/dracut
6307     mkdir -m 0755 -p ${initdir}/lib/dracut/hooks
6308     - for d in $hookdirs emergency \
6309     + for _d in $hookdirs emergency \
6310     initqueue initqueue/finished initqueue/settled; do
6311     - mkdir -m 0755 -p ${initdir}/lib/dracut/hooks/$d
6312     + mkdir -m 0755 -p ${initdir}/lib/dracut/hooks/$_d
6313     done
6314    
6315     mkdir -p ${initdir}/tmp
6316     - # Bail out if switch_root does not exist
6317     - if type -P switch_root >/dev/null; then
6318     - inst $(type -P switch_root) /sbin/switch_root \
6319     - || dfatal "Failed to install switch_root"
6320     - else
6321     - inst "$moddir/switch_root" "/sbin/switch_root" \
6322     - || dfatal "Failed to install switch_root"
6323     - fi
6324     +
6325     + dracut_install switch_root || dfatal "Failed to install switch_root"
6326     +
6327     inst "$moddir/dracut-lib.sh" "/lib/dracut-lib.sh"
6328     inst_hook cmdline 10 "$moddir/parse-root-opts.sh"
6329     mkdir -p "${initdir}/var"
6330     diff -Naur dracut-010/modules.d/99shutdown/module-setup.sh dracut-0e6a94b/modules.d/99shutdown/module-setup.sh
6331     --- dracut-010/modules.d/99shutdown/module-setup.sh 1970-01-01 01:00:00.000000000 +0100
6332     +++ dracut-0e6a94b/modules.d/99shutdown/module-setup.sh 2011-05-31 16:34:37.000000000 +0200
6333     @@ -0,0 +1,27 @@
6334     +#!/bin/bash
6335     +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
6336     +# ex: ts=8 sw=4 sts=4 et filetype=sh
6337     +
6338     +check() {
6339     + return 255
6340     +}
6341     +
6342     +depends() {
6343     + echo base
6344     + return 0
6345     +}
6346     +
6347     +install() {
6348     + local _d
6349     + dracut_install umount
6350     + dracut_install poweroff reboot halt
6351     + dracut_install -o kexec
6352     + inst "$moddir/shutdown" "$prefix/shutdown"
6353     + [ -e "${initdir}/lib" ] || mkdir -m 0755 -p ${initdir}/lib
6354     + mkdir -m 0755 -p ${initdir}/lib/dracut
6355     + mkdir -m 0755 -p ${initdir}/lib/dracut/hooks
6356     + for _d in $hookdirs shutdown shutdown-emergency; do
6357     + mkdir -m 0755 -p ${initdir}/lib/dracut/hooks/$_d
6358     + done
6359     +}
6360     +
6361     diff -Naur dracut-010/modules.d/99shutdown/shutdown dracut-0e6a94b/modules.d/99shutdown/shutdown
6362     --- dracut-010/modules.d/99shutdown/shutdown 1970-01-01 01:00:00.000000000 +0100
6363     +++ dracut-0e6a94b/modules.d/99shutdown/shutdown 2011-05-31 16:34:37.000000000 +0200
6364     @@ -0,0 +1,87 @@
6365     +#!/bin/sh
6366     +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
6367     +# ex: ts=8 sw=4 sts=4 et filetype=sh
6368     +#
6369     +# Licensed under the GPLv2
6370     +#
6371     +# Copyright 2011, Red Hat, Inc.
6372     +# Harald Hoyer <harald@redhat.com>
6373     +
6374     +#!/bin/sh
6375     +. /lib/dracut-lib.sh
6376     +export TERM=linux
6377     +
6378     +emergency_shell()
6379     +{
6380     + set +e
6381     + if [ "$1" = "-n" ]; then
6382     + _rdshell_name=$2
6383     + shift 2
6384     + else
6385     + _rdshell_name=dracut
6386     + fi
6387     + echo ; echo
6388     + warn $@
6389     + source_hook shutdown-emergency
6390     + echo
6391     + if getargbool 1 rd.shell -y rdshell || getarg rd.break rdbreak; then
6392     + [ -x /lib/udev/console_init ] && /lib/udev/console_init /dev/console
6393     + echo "Dropping to debug shell."
6394     + echo
6395     + export PS1="$_rdshell_name:\${PWD}# "
6396     + [ -e /.profile ] || echo "exec 0<>/dev/console 1<>/dev/console 2<>/dev/console" > /.profile
6397     + sh -i -l
6398     + else
6399     + exec /lib/systemd/systemd-shutdown "$@"
6400     + warn "Shutdown has failed. To debug this issue add \"rdshell\" to the kernel command line."
6401     + # cause a kernel panic
6402     + exit 1
6403     + fi
6404     +}
6405     +
6406     +trap "emergency_shell Signal caught!" 0
6407     +
6408     +getarg 'rd.break=pre-shutdown' && emergency_shell -n cmdline "Break before pre-shutdown"
6409     +
6410     +umount_a() {
6411     + local _did_umount="n"
6412     + while read a mp a; do
6413     + if strstr "$mp" oldroot; then
6414     + if umount "$mp"; then
6415     + _did_umount="y"
6416     + echo "Unmounted $mp."
6417     + fi
6418     + fi
6419     + done </proc/mounts
6420     + [ "$_did_umount" = "y" ] && return 0
6421     + return 1
6422     +}
6423     +
6424     +_cnt=0
6425     +while [ $_cnt -le 40 ]; do
6426     + umount_a 2>/dev/null || break
6427     + _cnt=$(($_cnt+1))
6428     +done
6429     +[ $_cnt -ge 40 ] && umount_a
6430     +
6431     +check_finished() {
6432     + local f
6433     + for f in $hookdir/shutdown/*.sh; do
6434     + [ -e "$f" ] || continue
6435     + ( . "$f" ) || return 1
6436     + done
6437     + return 0
6438     +}
6439     +
6440     +_cnt=0
6441     +while [ $_cnt -le 40 ]; do
6442     + check_finished 2>/dev/null && break
6443     + _cnt=$(($_cnt+1))
6444     +done
6445     +[ $_cnt -ge 40 ] && check_finished
6446     +
6447     +getarg 'rd.break=shutdown' && emergency_shell -n cmdline "Break before shutdown"
6448     +[ "$1" = "reboot" ] && reboot -f -d -n --no-wall
6449     +[ "$1" = "poweroff" ] && poweroff -f -d -n --no-wall
6450     +[ "$1" = "halt" ] && halt -f -d -n --no-wall
6451     +[ "$1" = "kexec" ] && kexec -e
6452     diff -Naur dracut-010/NEWS dracut-0e6a94b/NEWS
6453     --- dracut-010/NEWS 2011-03-31 19:50:31.000000000 +0200
6454     +++ dracut-0e6a94b/NEWS 2011-05-31 16:34:37.000000000 +0200
6455     @@ -1,3 +1,9 @@
6456     +dracut-011
6457     +==========
6458     +- use udev-168 features for shutting down udev
6459     +- introduce "--prefix" to put all initramfs files in /run/initramfs
6460     +- new shutdown script
6461     +
6462     dracut-010
6463     ==========
6464     - lots of bugfixes
6465     @@ -62,7 +68,7 @@
6466     - add btrfsctl scan for btrfs multi-devices (raid)
6467     - teach dmsquash live-root to use rootflags
6468     - trigger udev with action=add
6469     -- fixed add_drivers handling
6470     +- fixed add_drivers handling
6471     - add sr_mod
6472     - use pigz instead of gzip, if available
6473     - boot from LVM mirrors and snapshots
6474     @@ -75,7 +81,7 @@
6475    
6476     dracut-005
6477     ==========
6478     -- dcb support to dracut's FCoE support
6479     +- dcb support to dracut's FCoE support
6480     - add readonly overlay support for dmsquash
6481     - add keyboard kernel modules
6482     - dracut.conf: added add_dracutmodules
6483     @@ -113,7 +119,7 @@
6484     - add s390 network support
6485     - fixed dracut-gencmdline for root=UUID or LABEL
6486     - do not destroy assembled raid arrays if mdadm.conf present
6487     -- mount /dev/shm
6488     +- mount /dev/shm
6489     - let udevd not resolve group and user names
6490     - moved network from udev to initqueue
6491     - improved debug output: specifying "rdinitdebug" now logs
6492     @@ -121,7 +127,7 @@
6493     - strip kernel modules which have no x bit set
6494     - redirect stdin, stdout, stderr all RW to /dev/console
6495     so the user can use "less" to view /init.log and dmesg
6496     -- add new device mapper udev rules and dmeventd
6497     +- add new device mapper udev rules and dmeventd
6498     - fixed dracut-gencmdline for root=UUID or LABEL
6499     - do not destroy assembled raid arrays if mdadm.conf present
6500     - mount /dev/shm
6501     @@ -166,17 +172,17 @@
6502     Supported cmdline formats:
6503     fcoe=<networkdevice>:<dcb|nodcb>
6504     fcoe=<macaddress>:<dcb|nodcb>
6505     -
6506     +
6507     Note currently only nodcb is supported, the dcb option is reserved for
6508     future use.
6509     -
6510     +
6511     Note letters in the macaddress must be lowercase!
6512     -
6513     +
6514     Examples:
6515     fcoe=eth0:nodcb
6516     fcoe=4A:3F:4C:04:F8:D7:nodcb
6517    
6518     -- Syslog support for dracut
6519     +- Syslog support for dracut
6520     This module provides syslog functionality in the initrd.
6521     This is especially interesting when complex configuration being
6522     used to provide access to the device the rootfs resides on.
6523     @@ -203,20 +209,20 @@
6524     dracut-0.7
6525     ==========
6526     - dracut: strip binaries in initramfs
6527     -
6528     +
6529     --strip
6530     strip binaries in the initramfs (default)
6531     -
6532     +
6533     --nostrip
6534     do not strip binaries in the initramfs
6535     - dracut-catimages
6536     -
6537     +
6538     Usage: ./dracut-catimages [OPTION]... <initramfs> <base image>
6539     [<image>...]
6540     Creates initial ramdisk image by concatenating several images from the
6541     command
6542     line and /boot/dracut/
6543     -
6544     +
6545     -f, --force Overwrite existing initramfs file.
6546     -i, --imagedir Directory with additional images to add
6547     (default: /boot/dracut/)
6548     @@ -233,44 +239,44 @@
6549     dracut-0.6
6550     ==========
6551     - dracut: add --kernel-only and --no-kernel arguments
6552     -
6553     +
6554     --kernel-only
6555     only install kernel drivers and firmware files
6556     -
6557     +
6558     --no-kernel
6559     do not install kernel drivers and firmware files
6560     -
6561     +
6562     All kernel module related install commands moved from "install"
6563     to "installkernel".
6564     -
6565     +
6566     For "--kernel-only" all installkernel scripts of the specified
6567     modules are used, regardless of any checks, so that all modules
6568     which might be needed by any dracut generic image are in.
6569     -
6570     +
6571     The basic idea is to create two images. One image with the kernel
6572     modules and one without. So if the kernel changes, you only have
6573     to replace one image.
6574     -
6575     +
6576     Grub and the kernel can handle multiple images, so grub entry can
6577     look like this:
6578     -
6579     +
6580     title Fedora (2.6.29.5-191.fc11.i586)
6581     root (hd0,0)
6582     kernel /vmlinuz-2.6.29.5-191.fc11.i586 ro rhgb quiet
6583     initrd /initrd-20090722.img /initrd-kernel-2.6.29.5-191.fc11.i586.img /initrd-config.img
6584     -
6585     +
6586     initrd-20090722.img
6587     the image provided by the initrd rpm
6588     one old backup version is kept like with the kernel
6589     -
6590     +
6591     initrd-kernel-2.6.29.5-191.fc11.i586.img
6592     the image provided by the kernel rpm
6593     -
6594     +
6595     initrd-config.img
6596     optional image with local configuration files
6597    
6598     - dracut: add --kmoddir directory, where to look for kernel modules
6599     -
6600     +
6601     -k, --kmoddir [DIR]
6602     specify the directory, where to look for kernel modules
6603    
6604     @@ -290,18 +296,18 @@
6605     - firmware loading support
6606     - new internal queue (initqueue)
6607     initqueue now loops until /dev/root exists or root is mounted
6608     -
6609     +
6610     init now has the following points to inject scripts:
6611     -
6612     +
6613     /cmdline/*.sh
6614     scripts for command line parsing
6615     -
6616     +
6617     /pre-udev/*.sh
6618     scripts to run before udev is started
6619     -
6620     +
6621     /pre-trigger/*.sh
6622     scripts to run before the main udev trigger is pulled
6623     -
6624     +
6625     /initqueue/*.sh
6626     runs in parallel to the udev trigger
6627     Udev events can add scripts here with /sbin/initqueue.
6628     @@ -313,12 +319,12 @@
6629     filesystem was mounted, the user will be dropped to a shell after
6630     a timeout.
6631     Scripts can remove themselves from the initqueue by "rm $job".
6632     -
6633     +
6634     /pre-mount/*.sh
6635     scripts to run before the root filesystem is mounted
6636     NFS is an exception, because it has no device node to be created
6637     and mounts in the udev events
6638     -
6639     +
6640     /mount/*.sh
6641     scripts to mount the root filesystem
6642     NFS is an exception, because it has no device node to be created
6643     @@ -326,12 +332,12 @@
6644     If the udev queue is empty and no root device is found or no root
6645     filesystem was mounted, the user will be dropped to a shell after
6646     a timeout.
6647     -
6648     +
6649     /pre-pivot/*.sh
6650     scripts to run before the real init is executed and the initramfs
6651     disappears
6652     All processes started before should be killed here.
6653     -
6654     +
6655     The behaviour of the dmraid module demonstrates how to use the new
6656     mechanism. If it detects a device which is part of a raidmember from a
6657     udev rule, it installs a job to scan for dmraid devices, if the udev
6658     diff -Naur dracut-010/README dracut-0e6a94b/README
6659     --- dracut-010/README 2011-03-31 19:50:31.000000000 +0200
6660     +++ dracut-0e6a94b/README 2011-05-31 16:34:37.000000000 +0200
6661     @@ -2,8 +2,8 @@
6662     ------
6663     Dracut is a new initramfs infrastructure.
6664    
6665     -Information about the initial goals and aims can be found at
6666     -https://fedoraproject.org/wiki/Initrdrewrite
6667     +Information about the initial goals and aims can be found at
6668     +https://fedoraproject.org/wiki/Initrdrewrite
6669    
6670     Unlike existing initramfs's, this is an attempt at having as little as
6671     possible hard-coded into the initramfs as possible. The initramfs has
6672     @@ -19,19 +19,19 @@
6673     the script, but it's worth trying to resist the urge as much as we can
6674     as hooks are guaranteed to be the path to slow-down.
6675    
6676     -Most of the initrd generation functionality in dracut is provided by a bunch
6677     +Most of the initramfs generation functionality in dracut is provided by a bunch
6678     of generator modules that are sourced by the main dracut script to install
6679     -specific functionality into the initrd. They live in the modules.d
6680     -subdirectory, and use functionality provided by dracut-functions to do their
6681     +specific functionality into the initramfs. They live in the modules.d
6682     +subdirectory, and use functionality provided by dracut-functions to do their
6683     work.
6684    
6685     Some general rules for writing modules:
6686     * Use one of the inst family of functions to actually install files
6687     - on to the initrd. They handle mangling the pathnames and (for binaries,
6688     + on to the initramfs. They handle mangling the pathnames and (for binaries,
6689     scripts, and kernel modules) installing dependencies as appropriate so
6690     you do not have to.
6691     - * Scripts that end up on the initrd should be POSIX compliant. dracut
6692     - will try to use /bin/dash as /bin/sh for the initrd if it is available,
6693     + * Scripts that end up on the initramfs should be POSIX compliant. dracut
6694     + will try to use /bin/dash as /bin/sh for the initramfs if it is available,
6695     so you should install it on your system -- dash aims for strict POSIX
6696     compliance to the extent possible.
6697     * Hooks MUST be POSIX compliant -- they are sourced by the init script,
6698     @@ -44,35 +44,41 @@
6699     * We have some breakpoints for debugging your hooks. If you pass 'rdbreak'
6700     as a kernel parameter, the initramfs will drop to a shell just before
6701     switching to a new root. You can pass 'rdbreak=hookpoint', and the initramfs
6702     - will break just before hooks in that hookpoint run.
6703     + will break just before hooks in that hookpoint run.
6704    
6705     Also, there is an attempt to keep things as distribution-agnostic as
6706     possible. Every distribution has their own tool here and it's not
6707     something which is really interesting to have separate across them.
6708     So contributions to help decrease the distro-dependencies are welcome.
6709    
6710     -Currently dracut lives on sourceforge.
6711     +Currently dracut lives on kernel.org.
6712     +
6713     +The tarballs can be found here:
6714     + http://www.kernel.org/pub/linux/utils/boot/dracut/
6715     + ftp://ftp.kernel.org/pub/linux/utils/boot/dracut/
6716     +
6717     +Git:
6718     + git://git.kernel.org/pub/scm/boot/dracut/dracut.git
6719     + http://git.kernel.org/pub/scm/boot/dracut/dracut.git
6720     + https://git.kernel.org/pub/scm/boot/dracut/dracut.git
6721     +
6722     +Git Web:
6723     + http://git.kernel.org/?p=boot/dracut/dracut.git
6724     +
6725     +Git Web RSS Feed:
6726     + http://git.kernel.org/?p=boot/dracut/dracut.git;a=rss
6727    
6728     Project Page:
6729     -https://sourceforge.net/projects/dracut/
6730     + http://www.kernel.org/pub/linux/utils/boot/dracut/dracut.html
6731    
6732     -Drop Harald Hoyer <harald@redhat.com> a mail, if you want to help with
6733     -the documentation, git access, etc.
6734     +Project Wiki:
6735     + http://dracut.wiki.kernel.org
6736    
6737     -Git Repository:
6738     -http://dracut.git.sourceforge.net/
6739     -git://dracut.git.sourceforge.net/gitroot/dracut/dracut
6740     -
6741     -Trac Instance:
6742     -http://apps.sourceforge.net/trac/dracut/
6743     -
6744     -The git tree can be found at
6745     -git://dracut.git.sourceforge.net/gitroot/dracut/dracut for now. See the TODO
6746     -file for things which still need to be done and HACKING for some
6747     -instructions on how to get started. There is also a mailing list that
6748     -is being used for the discussion -- initramfs@vger.kernel.org. It is
6749     -a typical vger list, send mail to majordomo@vger.kernel.org with body
6750     -of 'subscribe initramfs email@host.com'
6751     +See the TODO file for things which still need to be done and HACKING for
6752     +some instructions on how to get started. There is also a mailing list
6753     +that is being used for the discussion -- initramfs@vger.kernel.org.
6754     +It is a typical vger list, send mail to majordomo@vger.kernel.org with body
6755     +of 'subscribe initramfs email@host.com'
6756    
6757    
6758     Licensed under the GPLv2
6759     diff -Naur dracut-010/README.generic dracut-0e6a94b/README.generic
6760     --- dracut-010/README.generic 2011-03-31 19:50:31.000000000 +0200
6761     +++ dracut-0e6a94b/README.generic 2011-05-31 16:34:37.000000000 +0200
6762     @@ -1,7 +1,7 @@
6763     To build a generic initramfs, you have to install the following software packages:
6764     * device-mapper
6765     * cryptsetup-luks
6766     - * rpcbind nfs-utils
6767     + * rpcbind nfs-utils
6768     * lvm2
6769     * iscsi-initiator-utils
6770     * nbd
6771     diff -Naur dracut-010/README.modules dracut-0e6a94b/README.modules
6772     --- dracut-010/README.modules 2011-03-31 19:50:31.000000000 +0200
6773     +++ dracut-0e6a94b/README.modules 2011-05-31 16:34:37.000000000 +0200
6774     @@ -4,7 +4,7 @@
6775    
6776     dracut_install_dir/modules.d/
6777     00modname/
6778     - install
6779     + module-setup.sh
6780     check
6781     <other files as needed by the hook>
6782    
6783     @@ -12,45 +12,55 @@
6784     The numeric code must be present and in the range of 00 - 99.
6785     Modules with lower numbers are installed first. This is important
6786     because the dracut install functions (which install files onto
6787     - the initrd) refuse to overwrite already installed files. This makes
6788     - it easy for an earlier module to override the functionality of a
6789     + the initrd) refuse to overwrite already installed files. This makes
6790     + it easy for an earlier module to override the functionality of a
6791     later module, so that you can have a distro or system specific
6792     module override or modify the functionality of a generic module
6793     without having to patch the more generic module.
6794    
6795     -install: dracut sources this script to install the functionality that a
6796     +module-setup.sh:
6797     + dracut sources this script to install the functionality that a
6798     module implements onto the initrd. For the most part, this amounts
6799     to copying files from the host system onto the initrd in a controlled
6800     - manner. dracut supplies several install functions that are
6801     + manner.
6802     +
6803     +install():
6804     + This function of module-setup.sh is called to install all
6805     + non-kernel files. dracut supplies several install functions that are
6806     specialized for different file types. Browse through dracut-functions
6807     fore more details. dracut also provides a $moddir variable if you
6808     need to install a file from the module directory, such as an initrd
6809     hook, a udev rule, or a specialized executable.
6810    
6811     -check: Dracut calls this program to check and see if a module can be installed
6812     +installkernel():
6813     + This function of module-setup.sh is called to install all
6814     + kernel related files.
6815     +
6816     +
6817     +check():
6818     + Dracut calls this function to check and see if a module can be installed
6819     on the initrd.
6820     -
6821     +
6822     When called without options, check should check to make sure that
6823     any files it needs to install into the initrd from the host system
6824     are present. It should exit with a 0 if they are, and a 1 if they are
6825     not.
6826    
6827     - When called with -h, it should perform the same check that it would
6828     - without any options, and it should also check to see if the
6829     + When called with $hostonly set, it should perform the same check
6830     + that it would without it set, and it should also check to see if the
6831     functionality the module implements is being used on the host system.
6832     For example, if this module handles installing support for LUKS
6833     encrypted volumes, it should return 0 if all the tools to handle
6834     encrpted volumes are available and the host system has the root
6835     partition on an encrypted volume, 1 otherwise.
6836    
6837     - When called with -d, it should output a list of dracut modules
6838     +depends():
6839     + This function should output a list of dracut modules
6840     that it relies upon. An example would be the nfs and iscsi modules,
6841     which rely on the network module to detect and configure network
6842     interfaces.
6843    
6844     - Check may take additional options in the future.
6845     -
6846     -Any other files in the module will not be touched by dracut directly.
6847     +Any other files in the module will not be touched by dracut directly.
6848    
6849     You are encouraged to provide a README that describes what the module is for.
6850    
6851     @@ -60,39 +70,39 @@
6852    
6853     init has the following hook points to inject scripts:
6854    
6855     -/cmdline/*.sh
6856     +/lib/dracut/hooks/cmdline/*.sh
6857     scripts for command line parsing
6858    
6859     -/pre-udev/*.sh
6860     +/lib/dracut/hooks/pre-udev/*.sh
6861     scripts to run before udev is started
6862    
6863     -/pre-trigger/*.sh
6864     +/lib/dracut/hooks/pre-trigger/*.sh
6865     scripts to run before the main udev trigger is pulled
6866    
6867     -/initqueue/*.sh
6868     +/lib/dracut/hooks/initqueue/*.sh
6869     runs in parallel to the udev trigger
6870     Udev events can add scripts here with /sbin/initqueue.
6871     If /sbin/initqueue is called with the "--onetime" option, the script
6872     will be removed after it was run.
6873     - If /initqueue/work is created and udev >= 143 then this loop can
6874     - process the jobs in parallel to the udevtrigger.
6875     + If /lib/dracut/hooks/initqueue/work is created and udev >= 143 then
6876     + this loop can process the jobs in parallel to the udevtrigger.
6877     If the udev queue is empty and no root device is found or no root
6878     filesystem was mounted, the user will be dropped to a shell after
6879     a timeout.
6880     Scripts can remove themselves from the initqueue by "rm $job".
6881    
6882     -/pre-mount/*.sh
6883     +/lib/dracut/hooks/pre-mount/*.sh
6884     scripts to run before the root filesystem is mounted
6885     - Network filesystems like NFS that do not use device files are an
6886     + Network filesystems like NFS that do not use device files are an
6887     exception. Root can be mounted already at this point.
6888    
6889     -/mount/*.sh
6890     +/lib/dracut/hooks/mount/*.sh
6891     scripts to mount the root filesystem
6892     If the udev queue is empty and no root device is found or no root
6893     filesystem was mounted, the user will be dropped to a shell after
6894     a timeout.
6895    
6896     -/pre-pivot/*.sh
6897     +/lib/dracut/hooks/pre-pivot/*.sh
6898     scripts to run before the real init is executed and the initramfs
6899     disappears
6900     All processes started before should be killed here.
6901     diff -Naur dracut-010/switch_root.c dracut-0e6a94b/switch_root.c
6902     --- dracut-010/switch_root.c 2011-03-31 19:50:31.000000000 +0200
6903     +++ dracut-0e6a94b/switch_root.c 1970-01-01 01:00:00.000000000 +0100
6904     @@ -1,279 +0,0 @@
6905     -/*
6906     - * switchroot.c - switch to new root directory and start init.
6907     - *
6908     - * Copyright 2002-2009 Red Hat, Inc. All rights reserved.
6909     - *
6910     - * This program is free software; you can redistribute it and/or modify
6911     - * it under the terms of the GNU General Public License as published by
6912     - * the Free Software Foundation; either version 2 of the License, or
6913     - * (at your option) any later version.
6914     - *
6915     - * This program is distributed in the hope that it will be useful,
6916     - * but WITHOUT ANY WARRANTY; without even the implied warranty of
6917     - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6918     - * GNU General Public License for more details.
6919     - *
6920     - * You should have received a copy of the GNU General Public License
6921     - * along with this program. If not, see <http://www.gnu.org/licenses/>.
6922     - *
6923     - * Authors:
6924     - * Peter Jones <pjones@redhat.com>
6925     - * Jeremy Katz <katzj@redhat.com>
6926     - */
6927     -#include <sys/mount.h>
6928     -#include <sys/types.h>
6929     -#include <sys/stat.h>
6930     -#include <sys/param.h>
6931     -#include <fcntl.h>
6932     -#include <stdio.h>
6933     -#include <stdlib.h>
6934     -#include <unistd.h>
6935     -#include <string.h>
6936     -#include <errno.h>
6937     -#include <ctype.h>
6938     -#include <dirent.h>
6939     -#include <err.h>
6940     -#include <libgen.h>
6941     -
6942     -#ifndef MS_MOVE
6943     -#define MS_MOVE 8192
6944     -#endif
6945     -
6946     -/* find the enclosing mount point of a path, by examining the backing device
6947     - * of parent directories until we reach / or find a parent with a differing
6948     - * device.
6949     - * result must be freed.
6950     - */
6951     -static char *get_parent_mount(const char *path)
6952     -{
6953     - struct stat sb;
6954     - char dir[PATH_MAX];
6955     - char tmp[PATH_MAX];
6956     - dev_t inner_dev;
6957     - int r;
6958     -
6959     - r = stat(path, &sb);
6960     - if (r != 0) {
6961     - warn("failed to stat %s", path);
6962     - return NULL;
6963     - }
6964     - inner_dev = sb.st_dev;
6965     -
6966     - /* dirname has some annoying properties of modifying the input... */
6967     - strncpy(dir, path, PATH_MAX);
6968     - dir[PATH_MAX - 1] = 0; /* for safety */
6969     -
6970     - while (1) {
6971     - char *parent;
6972     -
6973     - strncpy(tmp, dir, PATH_MAX);
6974     - tmp[PATH_MAX - 1] = 0;
6975     - parent = dirname(tmp);
6976     -
6977     - r = stat(parent, &sb);
6978     - if (r != 0) {
6979     - warn("failed to stat %s", parent);
6980     - return NULL;
6981     - }
6982     -
6983     - /* if the parent directory's device differs then we have found a mount
6984     - * point */
6985     - if (sb.st_dev != inner_dev)
6986     - return strdup(dir);
6987     -
6988     - strncpy(dir, parent, PATH_MAX);
6989     - dir[PATH_MAX - 1] = 0;
6990     -
6991     - /* maybe we've reached / */
6992     - if (strlen(dir) == 1)
6993     - return strdup(dir);
6994     - }
6995     -}
6996     -
6997     -/* remove all files/directories below dirName -- don't cross mountpoints */
6998     -static int recursiveRemove(char *dirName)
6999     -{
7000     - struct stat rb;
7001     - DIR *dir;
7002     - int rc = -1;
7003     - int dfd;
7004     -
7005     - if (!(dir = opendir(dirName))) {
7006     - warn("failed to open %s", dirName);
7007     - goto done;
7008     - }
7009     -
7010     - dfd = dirfd(dir);
7011     -
7012     - if (fstat(dfd, &rb)) {
7013     - warn("failed to stat %s", dirName);
7014     - goto done;
7015     - }
7016     -
7017     - while(1) {
7018     - struct dirent *d;
7019     -
7020     - errno = 0;
7021     - if (!(d = readdir(dir))) {
7022     - if (errno) {
7023     - warn("failed to read %s", dirName);
7024     - goto done;
7025     - }
7026     - break; /* end of directory */
7027     - }
7028     -
7029     - if (!strcmp(d->d_name, ".") || !strcmp(d->d_name, ".."))
7030     - continue;
7031     -
7032     - if (d->d_type == DT_DIR) {
7033     - struct stat sb;
7034     -
7035     - if (fstatat(dfd, d->d_name, &sb, AT_SYMLINK_NOFOLLOW)) {
7036     - warn("failed to stat %s/%s", dirName, d->d_name);
7037     - continue;
7038     - }
7039     -
7040     - /* remove subdirectories if device is same as dir */
7041     - if (sb.st_dev == rb.st_dev) {
7042     - char subdir[ strlen(dirName) +
7043     - strlen(d->d_name) + 2 ];
7044     -
7045     - sprintf(subdir, "%s/%s", dirName, d->d_name);
7046     - recursiveRemove(subdir);
7047     - } else
7048     - continue;
7049     - }
7050     -
7051     - if (unlinkat(dfd, d->d_name,
7052     - d->d_type == DT_DIR ? AT_REMOVEDIR : 0))
7053     - warn("failed to unlink %s/%s", dirName, d->d_name);
7054     - }
7055     -
7056     - rc = 0; /* success */
7057     -
7058     -done:
7059     - if (dir)
7060     - closedir(dir);
7061     - return rc;
7062     -}
7063     -
7064     -static int switchroot(const char *newroot)
7065     -{
7066     - /* Don't try to unmount the old "/", there's no way to do it. */
7067     - const char *umounts[] = { "/dev", "/proc", "/sys", NULL };
7068     - char *newroot_mnt;
7069     - const char *chroot_path = NULL;
7070     - int i;
7071     - int r = -1;
7072     -
7073     - for (i = 0; umounts[i] != NULL; i++) {
7074     - char newmount[PATH_MAX];
7075     -
7076     - snprintf(newmount, sizeof(newmount), "%s%s", newroot, umounts[i]);
7077     -
7078     - if (mount(umounts[i], newmount, NULL, MS_MOVE, NULL) < 0) {
7079     - warn("failed to mount moving %s to %s",
7080     - umounts[i], newmount);
7081     - warnx("forcing unmount of %s", umounts[i]);
7082     - umount2(umounts[i], MNT_FORCE);
7083     - }
7084     - }
7085     -
7086     - if (chdir(newroot)) {
7087     - warn("failed to change directory to %s", newroot);
7088     - return -1;
7089     - }
7090     -
7091     - recursiveRemove("/");
7092     -
7093     - newroot_mnt = get_parent_mount(newroot);
7094     - if (newroot_mnt && strcmp(newroot, newroot_mnt)) {
7095     - /* newroot is not a mount point, so we have to MS_MOVE the parent
7096     - * mount point and then chroot in to the "subroot" */
7097     - chroot_path = newroot + strlen(newroot_mnt);
7098     - newroot = newroot_mnt;
7099     -
7100     - if (chdir(newroot)) {
7101     - warn("failed to chdir to newroot mount %s", newroot);
7102     - goto err;
7103     - }
7104     - }
7105     -
7106     - if (mount(newroot, "/", NULL, MS_MOVE, NULL) < 0) {
7107     - warn("failed to mount moving %s to /", newroot);
7108     - goto err;
7109     - }
7110     -
7111     - if (chroot(".")) {
7112     - warn("failed to change root");
7113     - goto err;
7114     - }
7115     -
7116     - if (chroot_path) {
7117     - if (chdir(chroot_path)) {
7118     - warn("failed to chdir to subroot %s", chroot_path);
7119     - goto err;
7120     - }
7121     -
7122     - if (chroot(".")) {
7123     - warn("failed to change root to subroot");
7124     - goto err;
7125     - }
7126     - }
7127     -
7128     - r = 0;
7129     -err:
7130     - if (newroot_mnt)
7131     - free(newroot_mnt);
7132     - return r;
7133     -}
7134     -
7135     -static void usage(FILE *output)
7136     -{
7137     - fprintf(output, "usage: %s <newrootdir> <init> <args to init>\n",
7138     - program_invocation_short_name);
7139     - exit(output == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
7140     -}
7141     -
7142     -static void version(void)
7143     -{
7144     - fprintf(stdout, "%s from %s\n", program_invocation_short_name,
7145     - PACKAGE_STRING);
7146     - exit(EXIT_SUCCESS);
7147     -}
7148     -
7149     -int main(int argc, char *argv[])
7150     -{
7151     - char *newroot, *init, **initargs;
7152     -
7153     - if (argv[1] && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")))
7154     - usage(stdout);
7155     - if (argv[1] && (!strcmp(argv[1], "--version") || !strcmp(argv[1], "-V")))
7156     - version();
7157     - if (argc < 3)
7158     - usage(stderr);
7159     -
7160     - newroot = argv[1];
7161     - init = argv[2];
7162     - initargs = &argv[2];
7163     -
7164     - if (!*newroot || !*init)
7165     - usage(stderr);
7166     -
7167     - if (switchroot(newroot))
7168     - errx(EXIT_FAILURE, "failed. Sorry.");
7169     -
7170     - if (access(init, X_OK))
7171     - warn("cannot access %s", init);
7172     -
7173     - /* get session leader */
7174     - setsid();
7175     -
7176     - /* set controlling terminal */
7177     - if (ioctl (0, TIOCSCTTY, 1))
7178     - warn("failed to TIOCSCTTY");
7179     -
7180     - execv(init, initargs);
7181     - err(EXIT_FAILURE, "failed to execute %s", init);
7182     -}
7183     -
7184     diff -Naur dracut-010/test/TEST-01-BASIC/99-idesymlinks.rules dracut-0e6a94b/test/TEST-01-BASIC/99-idesymlinks.rules
7185     --- dracut-010/test/TEST-01-BASIC/99-idesymlinks.rules 1970-01-01 01:00:00.000000000 +0100
7186     +++ dracut-0e6a94b/test/TEST-01-BASIC/99-idesymlinks.rules 2011-05-31 16:34:37.000000000 +0200
7187     @@ -0,0 +1,8 @@
7188     +ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="hda", SYMLINK+="sda"
7189     +ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", KERNEL=="hda*", SYMLINK+="sda$env{MINOR}"
7190     +ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="hdb", SYMLINK+="sdb"
7191     +ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", KERNEL=="hdb*", SYMLINK+="sdb$env{MINOR}"
7192     +ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="hdc", SYMLINK+="sdc"
7193     +ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", KERNEL=="hdc*", SYMLINK+="sdc$env{MINOR}"
7194     +ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="hdd", SYMLINK+="sdd"
7195     +ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", KERNEL=="hdd*", SYMLINK+="sdd$env{MINOR}"
7196     diff -Naur dracut-010/test/TEST-01-BASIC/create-root.sh dracut-0e6a94b/test/TEST-01-BASIC/create-root.sh
7197     --- dracut-010/test/TEST-01-BASIC/create-root.sh 1970-01-01 01:00:00.000000000 +0100
7198     +++ dracut-0e6a94b/test/TEST-01-BASIC/create-root.sh 2011-05-31 16:34:37.000000000 +0200
7199     @@ -0,0 +1,23 @@
7200     +#!/bin/sh
7201     +# don't let udev and this script step on eachother's toes
7202     +for x in 64-lvm.rules 70-mdadm.rules 99-mount-rules; do
7203     + > "/etc/udev/rules.d/$x"
7204     +done
7205     +rm /etc/lvm/lvm.conf
7206     +udevadm control --reload-rules
7207     +set -e
7208     +# save a partition at the beginning for future flagging purposes
7209     +sfdisk -C 1280 -H 2 -S 32 -L /dev/sda <<EOF
7210     +,16
7211     +,
7212     +EOF
7213     +
7214     +mkfs.ext3 -L dracut /dev/sda2
7215     +mkdir -p /root
7216     +mount /dev/sda2 /root
7217     +cp -a -t /root /source/*
7218     +mkdir -p /root/run
7219     +umount /root
7220     +echo "dracut-root-block-created" >/dev/sda1
7221     +poweroff -f
7222     +
7223     diff -Naur dracut-010/test/TEST-01-BASIC/cryptroot-ask dracut-0e6a94b/test/TEST-01-BASIC/cryptroot-ask
7224     --- dracut-010/test/TEST-01-BASIC/cryptroot-ask 1970-01-01 01:00:00.000000000 +0100
7225     +++ dracut-0e6a94b/test/TEST-01-BASIC/cryptroot-ask 2011-05-31 16:34:37.000000000 +0200
7226     @@ -0,0 +1,6 @@
7227     +#!/bin/sh
7228     +
7229     +[ -b /dev/mapper/$2 ] && exit 0
7230     +echo -n test >/keyfile
7231     +/sbin/cryptsetup luksOpen $1 $2 </keyfile
7232     +
7233     diff -Naur dracut-010/test/TEST-01-BASIC/hard-off.sh dracut-0e6a94b/test/TEST-01-BASIC/hard-off.sh
7234     --- dracut-010/test/TEST-01-BASIC/hard-off.sh 1970-01-01 01:00:00.000000000 +0100
7235     +++ dracut-0e6a94b/test/TEST-01-BASIC/hard-off.sh 2011-05-31 16:34:37.000000000 +0200
7236     @@ -0,0 +1,3 @@
7237     +#!/bin/sh
7238     +getarg rd.shell || poweroff -f
7239     +getarg failme && poweroff -f
7240     diff -Naur dracut-010/test/TEST-01-BASIC/Makefile dracut-0e6a94b/test/TEST-01-BASIC/Makefile
7241     --- dracut-010/test/TEST-01-BASIC/Makefile 1970-01-01 01:00:00.000000000 +0100
7242     +++ dracut-0e6a94b/test/TEST-01-BASIC/Makefile 2011-05-31 16:34:37.000000000 +0200
7243     @@ -0,0 +1,10 @@
7244     +all:
7245     + @make -s --no-print-directory -C ../.. all
7246     + @basedir=../.. testdir=../ ./test.sh --all
7247     +setup:
7248     + @make --no-print-directory -C ../.. all
7249     + @basedir=../.. testdir=../ ./test.sh --setup
7250     +clean:
7251     + @basedir=../.. testdir=../ ./test.sh --clean
7252     +run:
7253     + @basedir=../.. testdir=../ ./test.sh --run
7254     diff -Naur dracut-010/test/TEST-01-BASIC/test-init dracut-0e6a94b/test/TEST-01-BASIC/test-init
7255     --- dracut-010/test/TEST-01-BASIC/test-init 1970-01-01 01:00:00.000000000 +0100
7256     +++ dracut-0e6a94b/test/TEST-01-BASIC/test-init 2011-05-31 16:34:37.000000000 +0200
7257     @@ -0,0 +1,17 @@
7258     +#!/bin/sh
7259     +export PATH=/sbin:/bin:/usr/sbin:/usr/bin
7260     +strstr() { [ "${1#*$2*}" != "$1" ]; }
7261     +CMDLINE=$(while read line; do echo $line;done < /proc/cmdline)
7262     +plymouth --quit
7263     +exec >/dev/console 2>&1
7264     +echo "dracut-root-block-success" >/dev/sda1
7265     +export TERM=linux
7266     +export PS1='initramfs-test:\w\$ '
7267     +[ -f /etc/mtab ] || ln -sfn /proc/mounts /etc/mtab
7268     +[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab
7269     +stty sane
7270     +echo "made it to the rootfs!"
7271     +strstr "$CMDLINE" "rd.shell" && sh -i
7272     +echo "Powering down."
7273     +mount -n -o remount,ro /
7274     +poweroff -f
7275     diff -Naur dracut-010/test/TEST-01-BASIC/test.sh dracut-0e6a94b/test/TEST-01-BASIC/test.sh
7276     --- dracut-010/test/TEST-01-BASIC/test.sh 1970-01-01 01:00:00.000000000 +0100
7277     +++ dracut-0e6a94b/test/TEST-01-BASIC/test.sh 2011-05-31 16:34:37.000000000 +0200
7278     @@ -0,0 +1,88 @@
7279     +#!/bin/bash
7280     +TEST_DESCRIPTION="root filesystem on a ext3 filesystem"
7281     +
7282     +KVERSION=${KVERSION-$(uname -r)}
7283     +
7284     +# Uncomment this to debug failures
7285     +#DEBUGFAIL="rd.shell rd.break"
7286     +
7287     +test_run() {
7288     + $testdir/run-qemu -hda root.ext3 -m 256M -nographic \
7289     + -net none -kernel /boot/vmlinuz-$KVERSION \
7290     + -append "root=LABEL=dracut rw quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug $DEBUGFAIL" \
7291     + -initrd initramfs.testing
7292     + grep -m 1 -q dracut-root-block-success root.ext3 || return 1
7293     +}
7294     +
7295     +test_setup() {
7296     +
7297     + if [ ! -e root.ext3 ]; then
7298     +
7299     + # Create the blank file to use as a root filesystem
7300     + dd if=/dev/zero of=root.ext3 bs=1M count=40
7301     +
7302     + kernel=$KVERSION
7303     + # Create what will eventually be our root filesystem onto an overlay
7304     + (
7305     + initdir=overlay/source
7306     + . $basedir/dracut-functions
7307     + dracut_install sh df free ls shutdown poweroff stty cat ps ln ip route \
7308     + /lib/terminfo/l/linux mount dmesg ifconfig dhclient mkdir cp ping dhclient \
7309     + umount strace less
7310     + inst "$basedir/modules.d/40network/dhclient-script" "/sbin/dhclient-script"
7311     + inst "$basedir/modules.d/40network/ifup" "/sbin/ifup"
7312     + dracut_install grep
7313     + inst ./test-init /sbin/init
7314     + find_binary plymouth >/dev/null && dracut_install plymouth
7315     + (cd "$initdir"; mkdir -p dev sys proc etc var/run tmp )
7316     + cp -a /etc/ld.so.conf* $initdir/etc
7317     + sudo ldconfig -r "$initdir"
7318     + )
7319     +
7320     + # second, install the files needed to make the root filesystem
7321     + (
7322     + initdir=overlay
7323     + . $basedir/dracut-functions
7324     + dracut_install sfdisk mkfs.ext3 poweroff cp umount
7325     + inst_hook initqueue 01 ./create-root.sh
7326     + inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
7327     + )
7328     +
7329     + # create an initramfs that will create the target root filesystem.
7330     + # We do it this way so that we do not risk trashing the host mdraid
7331     + # devices, volume groups, encrypted partitions, etc.
7332     + $basedir/dracut -l -i overlay / \
7333     + -m "dash udev-rules base rootfs-block kernel-modules" \
7334     + -d "piix ide-gd_mod ata_piix ext3 sd_mod" \
7335     + --nomdadmconf \
7336     + -f initramfs.makeroot $KVERSION || return 1
7337     + rm -rf overlay
7338     + # Invoke KVM and/or QEMU to actually create the target filesystem.
7339     + $testdir/run-qemu -hda root.ext3 -m 256M -nographic -net none \
7340     + -kernel "/boot/vmlinuz-$kernel" \
7341     + -append "root=/dev/dracut/root rw rootfstype=ext3 quiet console=ttyS0,115200n81 selinux=0" \
7342     + -initrd initramfs.makeroot || return 1
7343     + grep -m 1 -q dracut-root-block-created root.ext3 || return 1
7344     + fi
7345     +
7346     + (
7347     + initdir=overlay
7348     + . $basedir/dracut-functions
7349     + dracut_install poweroff shutdown
7350     + inst_hook emergency 000 ./hard-off.sh
7351     + inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
7352     + )
7353     + sudo $basedir/dracut -l -i overlay / \
7354     + -a "debug" \
7355     + -d "piix ide-gd_mod ata_piix ext3 sd_mod" \
7356     + -f initramfs.testing $KVERSION || return 1
7357     +
7358     +# -o "plymouth network md dmraid multipath fips caps crypt btrfs resume dmsquash-live dm"
7359     +}
7360     +
7361     +test_cleanup() {
7362     + rm -fr overlay mnt
7363     + rm -f root.ext3 initramfs.makeroot initramfs.testing
7364     +}
7365     +
7366     +. $testdir/test-functions
7367     diff -Naur dracut-010/test/TEST-10-RAID/test.sh dracut-0e6a94b/test/TEST-10-RAID/test.sh
7368     --- dracut-010/test/TEST-10-RAID/test.sh 2011-03-31 19:50:31.000000000 +0200
7369     +++ dracut-0e6a94b/test/TEST-10-RAID/test.sh 2011-05-31 16:34:37.000000000 +0200
7370     @@ -24,7 +24,7 @@
7371     initdir=overlay/source
7372     . $basedir/dracut-functions
7373     dracut_install sh df free ls shutdown poweroff stty cat ps ln ip route \
7374     - /lib/terminfo/l/linux mount dmesg ifconfig dhclient mkdir cp ping dhclient
7375     + /lib/terminfo/l/linux mount dmesg ifconfig dhclient mkdir cp ping dhclient
7376     inst "$basedir/modules.d/40network/dhclient-script" "/sbin/dhclient-script"
7377     inst "$basedir/modules.d/40network/ifup" "/sbin/ifup"
7378     dracut_install grep
7379     @@ -34,16 +34,16 @@
7380     cp -a /etc/ld.so.conf* $initdir/etc
7381     sudo ldconfig -r "$initdir"
7382     )
7383     -
7384     +
7385     # second, install the files needed to make the root filesystem
7386     (
7387     initdir=overlay
7388     . $basedir/dracut-functions
7389     - dracut_install sfdisk mke2fs poweroff cp umount
7390     + dracut_install sfdisk mke2fs poweroff cp umount
7391     inst_hook initqueue 01 ./create-root.sh
7392     inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
7393     )
7394     -
7395     +
7396     # create an initramfs that will create the target root filesystem.
7397     # We do it this way so that we do not risk trashing the host mdraid
7398     # devices, volume groups, encrypted partitions, etc.
7399     diff -Naur dracut-010/test/TEST-11-LVM/test-init dracut-0e6a94b/test/TEST-11-LVM/test-init
7400     --- dracut-010/test/TEST-11-LVM/test-init 2011-03-31 19:50:31.000000000 +0200
7401     +++ dracut-0e6a94b/test/TEST-11-LVM/test-init 2011-05-31 16:34:37.000000000 +0200
7402     @@ -1,11 +1,17 @@
7403     #!/bin/sh
7404     export PATH=/sbin:/bin:/usr/sbin:/usr/bin
7405     +strstr() { [ "${1#*$2*}" != "$1" ]; }
7406     +CMDLINE=$(while read line; do echo $line;done < /proc/cmdline)
7407     +plymouth --quit
7408     exec >/dev/console 2>&1
7409     echo "dracut-root-block-success" >/dev/sda1
7410     export TERM=linux
7411     export PS1='initramfs-test:\w\$ '
7412     -[ -f /etc/fstab ] || ln -s /proc/mounts /etc/fstab
7413     +[ -f /etc/mtab ] || ln -sfn /proc/mounts /etc/mtab
7414     +[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab
7415     stty sane
7416     -echo "made it to the rootfs! Powering down."
7417     +echo "made it to the rootfs!"
7418     +strstr "$CMDLINE" "rd.shell" && sh -i
7419     +echo "Powering down."
7420     mount -n -o remount,ro /
7421     poweroff -f
7422     diff -Naur dracut-010/test/TEST-11-LVM/test.sh dracut-0e6a94b/test/TEST-11-LVM/test.sh
7423     --- dracut-010/test/TEST-11-LVM/test.sh 2011-03-31 19:50:31.000000000 +0200
7424     +++ dracut-0e6a94b/test/TEST-11-LVM/test.sh 2011-05-31 16:34:37.000000000 +0200
7425     @@ -4,7 +4,7 @@
7426     KVERSION=${KVERSION-$(uname -r)}
7427    
7428     # Uncomment this to debug failures
7429     -#DEBUGFAIL="rd.shell"
7430     +#DEBUGFAIL="rd.break rd.shell"
7431    
7432     test_run() {
7433     $testdir/run-qemu -hda root.ext2 -m 256M -nographic \
7434     @@ -24,7 +24,7 @@
7435     initdir=overlay/source
7436     . $basedir/dracut-functions
7437     dracut_install sh df free ls shutdown poweroff stty cat ps ln ip route \
7438     - /lib/terminfo/l/linux mount dmesg ifconfig dhclient mkdir cp ping dhclient
7439     + /lib/terminfo/l/linux mount dmesg ifconfig dhclient mkdir cp ping dhclient
7440     inst "$basedir/modules.d/40network/dhclient-script" "/sbin/dhclient-script"
7441     inst "$basedir/modules.d/40network/ifup" "/sbin/ifup"
7442     dracut_install grep
7443     @@ -32,18 +32,19 @@
7444     find_binary plymouth >/dev/null && dracut_install plymouth
7445     (cd "$initdir"; mkdir -p dev sys proc etc var/run tmp )
7446     cp -a /etc/ld.so.conf* $initdir/etc
7447     + mkdir $initdir/run
7448     sudo ldconfig -r "$initdir"
7449     )
7450     -
7451     +
7452     # second, install the files needed to make the root filesystem
7453     (
7454     initdir=overlay
7455     . $basedir/dracut-functions
7456     - dracut_install sfdisk mke2fs poweroff cp umount
7457     + dracut_install sfdisk mke2fs poweroff cp umount
7458     inst_hook initqueue 01 ./create-root.sh
7459     inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
7460     )
7461     -
7462     +
7463     # create an initramfs that will create the target root filesystem.
7464     # We do it this way so that we do not risk trashing the host mdraid
7465     # devices, volume groups, encrypted partitions, etc.
7466     diff -Naur dracut-010/test/TEST-12-RAID-DEG/create-root.sh dracut-0e6a94b/test/TEST-12-RAID-DEG/create-root.sh
7467     --- dracut-010/test/TEST-12-RAID-DEG/create-root.sh 2011-03-31 19:50:31.000000000 +0200
7468     +++ dracut-0e6a94b/test/TEST-12-RAID-DEG/create-root.sh 2011-05-31 16:34:37.000000000 +0200
7469     @@ -39,8 +39,8 @@
7470     . /tmp/mduuid;
7471     } && \
7472     {
7473     -echo "dracut-root-block-created"
7474     -echo MD_UUID=$MD_UUID
7475     +echo "dracut-root-block-created"
7476     +echo MD_UUID=$MD_UUID
7477     }> /dev/sda1
7478     dd if=/dev/zero of=/dev/sda2
7479     poweroff -f
7480     diff -Naur dracut-010/test/TEST-12-RAID-DEG/test.sh dracut-0e6a94b/test/TEST-12-RAID-DEG/test.sh
7481     --- dracut-010/test/TEST-12-RAID-DEG/test.sh 2011-03-31 19:50:31.000000000 +0200
7482     +++ dracut-0e6a94b/test/TEST-12-RAID-DEG/test.sh 2011-05-31 16:34:37.000000000 +0200
7483     @@ -27,7 +27,7 @@
7484     echo "MD_UUID=$MD_UUID"
7485    
7486     client_run || return 1
7487     -
7488     +
7489     # client_run rd.md.conf=0 || return 1
7490    
7491     client_run rd.lvm=0 failme && return 1
7492     @@ -52,14 +52,14 @@
7493     test_setup() {
7494     # Create the blank file to use as a root filesystem
7495     dd if=/dev/zero of=root.ext2 bs=1M count=40
7496     -
7497     +
7498     kernel=$KVERSION
7499     # Create what will eventually be our root filesystem onto an overlay
7500     (
7501     initdir=overlay/source
7502     . $basedir/dracut-functions
7503     dracut_install sh df free ls shutdown poweroff stty cat ps ln ip route \
7504     - /lib/terminfo/l/linux mount dmesg ifconfig dhclient mkdir cp ping dhclient
7505     + /lib/terminfo/l/linux mount dmesg ifconfig dhclient mkdir cp ping dhclient
7506     inst "$basedir/modules.d/40network/dhclient-script" "/sbin/dhclient-script"
7507     inst "$basedir/modules.d/40network/ifup" "/sbin/ifup"
7508     dracut_install grep
7509     @@ -69,7 +69,7 @@
7510     cp -a /etc/ld.so.conf* $initdir/etc
7511     sudo ldconfig -r "$initdir"
7512     )
7513     -
7514     +
7515     # second, install the files needed to make the root filesystem
7516     (
7517     initdir=overlay
7518     @@ -78,7 +78,7 @@
7519     inst_hook initqueue 01 ./create-root.sh
7520     inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
7521     )
7522     -
7523     +
7524     # create an initramfs that will create the target root filesystem.
7525     # We do it this way so that we do not risk trashing the host mdraid
7526     # devices, volume groups, encrypted partitions, etc.
7527     diff -Naur dracut-010/test/TEST-13-ENC-RAID-LVM/create-root.sh dracut-0e6a94b/test/TEST-13-ENC-RAID-LVM/create-root.sh
7528     --- dracut-010/test/TEST-13-ENC-RAID-LVM/create-root.sh 2011-03-31 19:50:31.000000000 +0200
7529     +++ dracut-0e6a94b/test/TEST-13-ENC-RAID-LVM/create-root.sh 2011-05-31 16:34:37.000000000 +0200
7530     @@ -7,18 +7,18 @@
7531     rm /etc/lvm/lvm.conf
7532     udevadm control --reload-rules
7533     # save a partition at the beginning for future flagging purposes
7534     -sfdisk -C 1280 -H 2 -S 32 -L /dev/sda <<EOF
7535     +sfdisk -C 2560 -H 2 -S 32 -L /dev/sda <<EOF
7536     ,16
7537     -,400
7538     -,400
7539     -,400
7540     +,800
7541     +,800
7542     +,800
7543     EOF
7544     echo -n test >keyfile
7545     cryptsetup -q luksFormat /dev/sda2 /keyfile
7546     cryptsetup -q luksFormat /dev/sda3 /keyfile
7547     cryptsetup -q luksFormat /dev/sda4 /keyfile
7548     cryptsetup luksOpen /dev/sda2 dracut_sda2 </keyfile
7549     -cryptsetup luksOpen /dev/sda3 dracut_sda3 </keyfile
7550     +cryptsetup luksOpen /dev/sda3 dracut_sda3 </keyfile
7551     cryptsetup luksOpen /dev/sda4 dracut_sda4 </keyfile
7552     mdadm --create /dev/md0 --run --auto=yes --level=5 --raid-devices=3 /dev/mapper/dracut_sda2 /dev/mapper/dracut_sda3 /dev/mapper/dracut_sda4
7553     # wait for the array to finish initailizing, otherwise this sometimes fails
7554     @@ -44,7 +44,7 @@
7555     cryptsetup luksClose /dev/mapper/dracut_sda4 && \
7556     :; :;} && \
7557     {
7558     - echo "dracut-root-block-created"
7559     + echo "dracut-root-block-created"
7560     for i in /dev/sda[234]; do
7561     udevadm info --query=env --name=$i|grep 'ID_FS_UUID='
7562     done
7563     diff -Naur dracut-010/test/TEST-13-ENC-RAID-LVM/test.sh dracut-0e6a94b/test/TEST-13-ENC-RAID-LVM/test.sh
7564     --- dracut-010/test/TEST-13-ENC-RAID-LVM/test.sh 2011-03-31 19:50:31.000000000 +0200
7565     +++ dracut-0e6a94b/test/TEST-13-ENC-RAID-LVM/test.sh 2011-05-31 16:34:37.000000000 +0200
7566     @@ -10,7 +10,7 @@
7567     LUKSARGS=$(cat luks.txt)
7568    
7569     dd if=/dev/zero of=check-success.img bs=1M count=1
7570     -
7571     +
7572     echo "CLIENT TEST START: $LUKSARGS"
7573     $testdir/run-qemu -hda root.ext2 -hdb check-success.img -m 256M -nographic \
7574     -net none -kernel /boot/vmlinuz-$KVERSION \
7575     @@ -44,7 +44,7 @@
7576    
7577     test_setup() {
7578     # Create the blank file to use as a root filesystem
7579     - dd if=/dev/zero of=root.ext2 bs=1M count=40
7580     + dd if=/dev/zero of=root.ext2 bs=1M count=80
7581    
7582     kernel=$KVERSION
7583     # Create what will eventually be our root filesystem onto an overlay
7584     @@ -52,7 +52,7 @@
7585     initdir=overlay/source
7586     . $basedir/dracut-functions
7587     dracut_install sh df free ls shutdown poweroff stty cat ps ln ip route \
7588     - /lib/terminfo/l/linux mount dmesg ifconfig dhclient mkdir cp ping dhclient
7589     + /lib/terminfo/l/linux mount dmesg ifconfig dhclient mkdir cp ping dhclient
7590     inst "$basedir/modules.d/40network/dhclient-script" "/sbin/dhclient-script"
7591     inst "$basedir/modules.d/40network/ifup" "/sbin/ifup"
7592     dracut_install grep
7593     @@ -62,7 +62,7 @@
7594     cp -a /etc/ld.so.conf* $initdir/etc
7595     sudo ldconfig -r "$initdir"
7596     )
7597     -
7598     +
7599     # second, install the files needed to make the root filesystem
7600     (
7601     initdir=overlay
7602     @@ -71,7 +71,7 @@
7603     inst_hook initqueue 01 ./create-root.sh
7604     inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
7605     )
7606     -
7607     +
7608     # create an initramfs that will create the target root filesystem.
7609     # We do it this way so that we do not risk trashing the host mdraid
7610     # devices, volume groups, encrypted partitions, etc.
7611     @@ -89,9 +89,9 @@
7612     cryptoUUIDS=$(grep --binary-files=text -m 3 ID_FS_UUID root.ext2)
7613     for uuid in $cryptoUUIDS; do
7614     eval $uuid
7615     - printf ' rd.luks.uuid=luks-%s ' $ID_FS_UUID
7616     + printf ' rd.luks.uuid=luks-%s ' $ID_FS_UUID
7617     done > luks.txt
7618     -
7619     +
7620    
7621     (
7622     initdir=overlay
7623     diff -Naur dracut-010/test/TEST-14-IMSM/create-root.sh dracut-0e6a94b/test/TEST-14-IMSM/create-root.sh
7624     --- dracut-010/test/TEST-14-IMSM/create-root.sh 2011-03-31 19:50:31.000000000 +0200
7625     +++ dracut-0e6a94b/test/TEST-14-IMSM/create-root.sh 2011-05-31 16:34:37.000000000 +0200
7626     @@ -7,9 +7,9 @@
7627    
7628     udevadm control --reload-rules
7629     # dmraid does not want symlinks in --disk "..."
7630     -if [ -e /dev/hda ] ; then
7631     +if [ -e /dev/hda ] ; then
7632     echo y|dmraid -f isw -C Test0 --type 1 --disk "/dev/hdb /dev/hdc"
7633     -else
7634     +else
7635     echo y|dmraid -f isw -C Test0 --type 1 --disk "/dev/sdb /dev/sdc"
7636     fi
7637     udevadm settle
7638     @@ -17,18 +17,18 @@
7639     SETS=$(dmraid -c -s)
7640     # scan and activate all DM RAIDS
7641     for s in $SETS; do
7642     - dmraid -ay -i -p --rm_partitions "$s"
7643     - [ -e "/dev/mapper/$s" ] && kpartx -a -p p "/dev/mapper/$s"
7644     + dmraid -ay -i -p --rm_partitions "$s"
7645     + [ -e "/dev/mapper/$s" ] && kpartx -a -p p "/dev/mapper/$s"
7646     done
7647    
7648     udevadm settle
7649     -sfdisk -g /dev/mapper/isw*Test0
7650     +sfdisk -g /dev/mapper/isw*Test0
7651     # save a partition at the beginning for future flagging purposes
7652     -sfdisk -C 1280 -H 2 -S 32 -L /dev/mapper/isw*Test0 <<EOF
7653     +sfdisk -C 2560 -H 2 -S 32 -L /dev/mapper/isw*Test0 <<EOF
7654     ,1
7655     -,300
7656     -,300
7657     -,300
7658     +,600
7659     +,600
7660     +,600
7661     EOF
7662    
7663     udevadm settle
7664     @@ -38,8 +38,8 @@
7665     SETS=$(dmraid -c -s -i)
7666     # scan and activate all DM RAIDS
7667     for s in $SETS; do
7668     - dmraid -ay -i -p --rm_partitions "$s"
7669     - [ -e "/dev/mapper/$s" ] && kpartx -a -p p "/dev/mapper/$s"
7670     + dmraid -ay -i -p --rm_partitions "$s"
7671     + [ -e "/dev/mapper/$s" ] && kpartx -a -p p "/dev/mapper/$s"
7672     done
7673    
7674     udevadm settle
7675     @@ -47,7 +47,7 @@
7676     mdadm --create /dev/md0 --run --auto=yes --level=5 --raid-devices=3 \
7677     /dev/mapper/isw*p2 \
7678     /dev/mapper/isw*p3 \
7679     - /dev/mapper/isw*p4
7680     + /dev/mapper/isw*p4
7681    
7682     # wait for the array to finish initailizing, otherwise this sometimes fails
7683     # randomly.
7684     diff -Naur dracut-010/test/TEST-14-IMSM/test-init dracut-0e6a94b/test/TEST-14-IMSM/test-init
7685     --- dracut-010/test/TEST-14-IMSM/test-init 2011-03-31 19:50:31.000000000 +0200
7686     +++ dracut-0e6a94b/test/TEST-14-IMSM/test-init 2011-05-31 16:34:37.000000000 +0200
7687     @@ -1,5 +1,8 @@
7688     #!/bin/sh
7689     export PATH=/sbin:/bin:/usr/sbin:/usr/bin
7690     +strstr() { [ "${1#*$2*}" != "$1" ]; }
7691     +CMDLINE=$(while read line; do echo $line;done < /proc/cmdline)
7692     +plymouth --quit
7693     exec >/dev/console 2>&1
7694     echo "dracut-root-block-success" >/dev/sda
7695     export TERM=linux
7696     @@ -7,6 +10,8 @@
7697     cat /proc/mdstat
7698     [ -f /etc/fstab ] || ln -s /proc/mounts /etc/fstab
7699     stty sane
7700     -echo "made it to the rootfs! Powering down."
7701     +echo "made it to the rootfs!"
7702     +strstr "$CMDLINE" "rd.shell" && sh -i
7703     +echo "Powering down."
7704     mount -n -o remount,ro /
7705     poweroff -f
7706     diff -Naur dracut-010/test/TEST-14-IMSM/test.sh dracut-0e6a94b/test/TEST-14-IMSM/test.sh
7707     --- dracut-010/test/TEST-14-IMSM/test.sh 2011-03-31 19:50:31.000000000 +0200
7708     +++ dracut-0e6a94b/test/TEST-14-IMSM/test.sh 2011-05-31 16:34:37.000000000 +0200
7709     @@ -4,7 +4,7 @@
7710     KVERSION=${KVERSION-$(uname -r)}
7711    
7712     # Uncomment this to debug failures
7713     -DEBUGFAIL="rd.shell"
7714     +#DEBUGFAIL="rd.shell rd.break"
7715     #DEBUGFAIL="$DEBUGFAIL udev.log-priority=debug"
7716    
7717     client_run() {
7718     @@ -39,8 +39,8 @@
7719     test_setup() {
7720     # Create the blank file to use as a root filesystem
7721     dd if=/dev/zero of=root.ext2 bs=1M count=1
7722     - dd if=/dev/zero of=disk1 bs=1M count=40
7723     - dd if=/dev/zero of=disk2 bs=1M count=40
7724     + dd if=/dev/zero of=disk1 bs=1M count=80
7725     + dd if=/dev/zero of=disk2 bs=1M count=80
7726    
7727     kernel=$KVERSION
7728     # Create what will eventually be our root filesystem onto an overlay
7729     @@ -48,7 +48,7 @@
7730     initdir=overlay/source
7731     . $basedir/dracut-functions
7732     dracut_install sh df free ls shutdown poweroff stty cat ps ln ip route \
7733     - /lib/terminfo/l/linux mount dmesg ifconfig dhclient mkdir cp ping dhclient
7734     + /lib/terminfo/l/linux mount dmesg ifconfig dhclient mkdir cp ping dhclient
7735     inst "$basedir/modules.d/40network/dhclient-script" "/sbin/dhclient-script"
7736     inst "$basedir/modules.d/40network/ifup" "/sbin/ifup"
7737     dracut_install grep
7738     @@ -56,18 +56,19 @@
7739     find_binary plymouth >/dev/null && dracut_install plymouth
7740     (cd "$initdir"; mkdir -p dev sys proc etc var/run tmp )
7741     cp -a /etc/ld.so.conf* $initdir/etc
7742     + mkdir $initdir/run
7743     sudo ldconfig -r "$initdir"
7744     )
7745     -
7746     +
7747     # second, install the files needed to make the root filesystem
7748     (
7749     initdir=overlay
7750     . $basedir/dracut-functions
7751     - dracut_install sfdisk mke2fs poweroff cp umount
7752     + dracut_install sfdisk mke2fs poweroff cp umount
7753     inst_hook initqueue 01 ./create-root.sh
7754     inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
7755     )
7756     -
7757     +
7758     # create an initramfs that will create the target root filesystem.
7759     # We do it this way so that we do not risk trashing the host mdraid
7760     # devices, volume groups, encrypted partitions, etc.
7761     diff -Naur dracut-010/test/TEST-20-NFS/server-init dracut-0e6a94b/test/TEST-20-NFS/server-init
7762     --- dracut-010/test/TEST-20-NFS/server-init 2011-03-31 19:50:31.000000000 +0200
7763     +++ dracut-0e6a94b/test/TEST-20-NFS/server-init 2011-05-31 16:34:37.000000000 +0200
7764     @@ -1,4 +1,4 @@
7765     -#!/bin/sh
7766     +#!/bin/sh
7767     export PATH=/sbin:/bin:/usr/sbin:/usr/bin
7768     export TERM=linux
7769     export PS1='nfstest-server:\w\$ '
7770     diff -Naur dracut-010/test/TEST-20-NFS/test.sh dracut-0e6a94b/test/TEST-20-NFS/test.sh
7771     --- dracut-010/test/TEST-20-NFS/test.sh 2011-03-31 19:50:31.000000000 +0200
7772     +++ dracut-0e6a94b/test/TEST-20-NFS/test.sh 2011-05-31 16:34:37.000000000 +0200
7773     @@ -57,7 +57,7 @@
7774     fi
7775    
7776     # nfsinfo=( server:/path nfs{,4} options )
7777     - nfsinfo=($(awk '{print $2, $3, $4; exit}' client.img))
7778     + nfsinfo=($(awk '{print $2, $3, $4; exit}' client.img))
7779    
7780     if [[ "${nfsinfo[0]%%:*}" != "$server" ]]; then
7781     echo "CLIENT TEST INFO: got server: ${nfsinfo[0]%%:*}"
7782     @@ -210,7 +210,7 @@
7783     /etc/services sleep mount chmod
7784     type -P portmap >/dev/null && dracut_install portmap
7785     type -P rpcbind >/dev/null && dracut_install rpcbind
7786     - [ -f /etc/netconfig ] && dracut_install /etc/netconfig
7787     + [ -f /etc/netconfig ] && dracut_install /etc/netconfig
7788     type -P dhcpd >/dev/null && dracut_install dhcpd
7789     [ -x /usr/sbin/dhcpd3 ] && inst /usr/sbin/dhcpd3 /usr/sbin/dhcpd
7790     instmods nfsd sunrpc ipv6
7791     diff -Naur dracut-010/test/TEST-30-ISCSI/server-init dracut-0e6a94b/test/TEST-30-ISCSI/server-init
7792     --- dracut-010/test/TEST-30-ISCSI/server-init 2011-03-31 19:50:31.000000000 +0200
7793     +++ dracut-0e6a94b/test/TEST-30-ISCSI/server-init 2011-05-31 16:34:37.000000000 +0200
7794     @@ -1,4 +1,4 @@
7795     -#!/bin/sh
7796     +#!/bin/sh
7797     export PATH=/sbin:/bin:/usr/sbin:/usr/bin
7798     export TERM=linux
7799     export PS1='nfstest-server:\w\$ '
7800     diff -Naur dracut-010/test/TEST-30-ISCSI/test.sh dracut-0e6a94b/test/TEST-30-ISCSI/test.sh
7801     --- dracut-010/test/TEST-30-ISCSI/test.sh 2011-03-31 19:50:31.000000000 +0200
7802     +++ dracut-0e6a94b/test/TEST-30-ISCSI/test.sh 2011-05-31 16:34:37.000000000 +0200
7803     @@ -93,16 +93,16 @@
7804     cp -a /etc/ld.so.conf* $initdir/etc
7805     sudo ldconfig -r "$initdir"
7806     )
7807     -
7808     +
7809     # second, install the files needed to make the root filesystem
7810     (
7811     initdir=overlay
7812     . $basedir/dracut-functions
7813     - dracut_install sfdisk mke2fs poweroff cp umount
7814     + dracut_install sfdisk mke2fs poweroff cp umount
7815     inst_hook initqueue 01 ./create-root.sh
7816     inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
7817     )
7818     -
7819     +
7820     # create an initramfs that will create the target root filesystem.
7821     # We do it this way so that we do not risk trashing the host mdraid
7822     # devices, volume groups, encrypted partitions, etc.
7823     @@ -162,7 +162,7 @@
7824     dracut_install /usr/sbin/iscsi-target
7825     instmods iscsi_tcp crc32c ipv6
7826     inst ./targets /etc/iscsi/targets
7827     - [ -f /etc/netconfig ] && dracut_install /etc/netconfig
7828     + [ -f /etc/netconfig ] && dracut_install /etc/netconfig
7829     type -P dhcpd >/dev/null && dracut_install dhcpd
7830     [ -x /usr/sbin/dhcpd3 ] && inst /usr/sbin/dhcpd3 /usr/sbin/dhcpd
7831     inst ./server-init /sbin/init
7832     diff -Naur dracut-010/test/TEST-40-NBD/server-init dracut-0e6a94b/test/TEST-40-NBD/server-init
7833     --- dracut-010/test/TEST-40-NBD/server-init 2011-03-31 19:50:31.000000000 +0200
7834     +++ dracut-0e6a94b/test/TEST-40-NBD/server-init 2011-05-31 16:34:37.000000000 +0200
7835     @@ -1,4 +1,4 @@
7836     -#!/bin/sh
7837     +#!/bin/sh
7838     export PATH=/sbin:/bin:/usr/sbin:/usr/bin
7839     export TERM=linux
7840     export PS1='nbdtest-server:\w\$ '
7841     diff -Naur dracut-010/test/TEST-50-MULTINIC/client-init dracut-0e6a94b/test/TEST-50-MULTINIC/client-init
7842     --- dracut-010/test/TEST-50-MULTINIC/client-init 2011-03-31 19:50:31.000000000 +0200
7843     +++ dracut-0e6a94b/test/TEST-50-MULTINIC/client-init 2011-05-31 16:34:37.000000000 +0200
7844     @@ -1,10 +1,13 @@
7845     #!/bin/sh
7846     export PATH=/sbin:/bin:/usr/sbin:/usr/bin
7847     +strstr() { [ "${1#*$2*}" != "$1" ]; }
7848     +CMDLINE=$(while read line; do echo $line;done < /proc/cmdline)
7849     exec >/dev/console 2>&1
7850     export TERM=linux
7851     export PS1='initramfs-test:\w\$ '
7852     stty sane
7853     echo "made it to the rootfs! Powering down."
7854     -echo OK $(cat /dev/.initramfs/net.ifaces) > /dev/sda
7855     -#sh -i
7856     +[ -e /dev/.initramfs/net.ifaces ] && echo OK $(cat /dev/.initramfs/net.ifaces) > /dev/sda
7857     +[ -e /run/initramfs/net.ifaces ] && echo OK $(cat /run/initramfs/net.ifaces) > /dev/sda
7858     +strstr "$CMDLINE" "rd.shell" && sh -i
7859     poweroff -f
7860     diff -Naur dracut-010/test/TEST-50-MULTINIC/server-init dracut-0e6a94b/test/TEST-50-MULTINIC/server-init
7861     --- dracut-010/test/TEST-50-MULTINIC/server-init 2011-03-31 19:50:31.000000000 +0200
7862     +++ dracut-0e6a94b/test/TEST-50-MULTINIC/server-init 2011-05-31 16:34:37.000000000 +0200
7863     @@ -1,4 +1,4 @@
7864     -#!/bin/sh
7865     +#!/bin/sh
7866     export PATH=/sbin:/bin:/usr/sbin:/usr/bin
7867     export TERM=linux
7868     export PS1='nfstest-server:\w\$ '
7869     diff -Naur dracut-010/test/TEST-50-MULTINIC/test.sh dracut-0e6a94b/test/TEST-50-MULTINIC/test.sh
7870     --- dracut-010/test/TEST-50-MULTINIC/test.sh 2011-03-31 19:50:31.000000000 +0200
7871     +++ dracut-0e6a94b/test/TEST-50-MULTINIC/test.sh 2011-05-31 16:34:37.000000000 +0200
7872     @@ -137,7 +137,7 @@
7873     /etc/services sleep mount chmod
7874     type -P portmap >/dev/null && dracut_install portmap
7875     type -P rpcbind >/dev/null && dracut_install rpcbind
7876     - [ -f /etc/netconfig ] && dracut_install /etc/netconfig
7877     + [ -f /etc/netconfig ] && dracut_install /etc/netconfig
7878     type -P dhcpd >/dev/null && dracut_install dhcpd
7879     [ -x /usr/sbin/dhcpd3 ] && inst /usr/sbin/dhcpd3 /usr/sbin/dhcpd
7880     instmods nfsd sunrpc ipv6
7881     @@ -190,11 +190,11 @@
7882     . $basedir/dracut-functions
7883     dracut_install sh shutdown poweroff stty cat ps ln ip \
7884     /lib/terminfo/l/linux mount dmesg mkdir \
7885     - cp ping grep
7886     + cp ping grep ls
7887     inst ./client-init /sbin/init
7888     (
7889     cd "$initdir"
7890     - mkdir -p dev sys proc etc
7891     + mkdir -p dev sys proc etc run
7892     mkdir -p var/lib/nfs/rpc_pipefs
7893     )
7894     inst /etc/nsswitch.conf /etc/nsswitch.conf
7895     diff -Naur dracut-010/test/test-functions dracut-0e6a94b/test/test-functions
7896     --- dracut-010/test/test-functions 2011-03-31 19:50:31.000000000 +0200
7897     +++ dracut-0e6a94b/test/test-functions 2011-05-31 16:34:37.000000000 +0200
7898     @@ -4,19 +4,19 @@
7899    
7900     while (($# > 0)); do
7901     case $1 in
7902     - --run)
7903     + --run)
7904     echo "TEST RUN: $TEST_DESCRIPTION"
7905     test_run
7906     exit $?;;
7907     - --setup)
7908     + --setup)
7909     echo "TEST SETUP: $TEST_DESCRIPTION"
7910     test_setup
7911     exit $?;;
7912     - --clean)
7913     + --clean)
7914     echo "TEST CLEANUP: $TEST_DESCRIPTION"
7915     test_cleanup
7916     exit $?;;
7917     - --all)
7918     + --all)
7919     echo -n "TEST: $TEST_DESCRIPTION ";
7920     (
7921     test_setup && test_run
7922     diff -Naur dracut-010/TODO dracut-0e6a94b/TODO
7923     --- dracut-010/TODO 2011-03-31 19:50:31.000000000 +0200
7924     +++ dracut-0e6a94b/TODO 2011-05-31 16:34:37.000000000 +0200
7925     @@ -1,2 +1,28 @@
7926     -See https://sourceforge.net/apps/trac/dracut/wiki/TODO
7927     +Current TODO list, broken into things which are relevant for the initramfs itself (/init et al) vs the generator. A lot of things are/should be marked with "FIXME" in the code
7928     +INITRAMFS TODO
7929     +
7930     +- The hard-coded list of udev rules that we care about is kind of lame.
7931     +
7932     +GENERATOR TODO
7933     +
7934     +- Default module specification could use some work
7935     +- udev rule copying, as mentioned above, is a bit too hard-coded
7936     +- pkg-config integration, to make it easy for other packages to use us.
7937     +
7938     +CODE TODO
7939     +- document functions
7940     +- make function vars local, and prefix with "_"
7941     +
7942     +Future Enhancement Requests
7943     +
7944     +Note that our main concern, especially right now, is proving viability of some of the ideas and then showing it with the things that we already support. If things work out, then it should be doable to start putting in support for new things that we don't already have support for. Nothing in this list is guaranteed but if people have ideas about new things, put them here and they'll at least be considered.
7945     +
7946     +- run ssh server to enter crypto password or perform debugging (supported by debian)
7947     +- cryptokey on usbkey rhbz#459485
7948     +- Bug 524727 - Dracut + encrypted root + networking
7949     +
7950     +
7951     +- add recovery image creator (mkrecovery)
7952     +- parameters for automatic kexec fallback
7953     +- parameters for automatic panic fallback
7954