mkdir -p "$initdir/$d";
done
-# source any third-party package provided modules
-for f in "$dsrc/modules"/*; do
- [[ -x $f ]] && . "$f"
+# source all our modules
+for f in "$dsrc/modules"/*[^~]; do
+ mod=${f##*/}; mod=${mod#[0-9][0-9]}
+ if [[ $dracutmodules = all ]] || strstr "$dracutmodules" "$mod"; then
+ [[ -x $f ]] && . "$f"
+ fi
done
## final stuff that has to happen
IF_RTLD=""
IF_dynamic=""
+strstr() { [[ ! ${1#*$2*} = $1 ]]; }
+
# $1 = file to copy to ramdisk
# $2 (optional) Name for the file on the ramdisk
# Location of the image dir is assumed to be $initdir
[[ -f $initdir$target ]] && return 0
# I love bash!
while read line; do
- [[ $line =~ '([^ ]*/lib[^/]*/[^ ]*\.so[^ ]*|not found)' ]] || continue
- FILE=${BASH_REMATCH[1]}
- [[ $FILE = 'not found' ]] && {
+ [[ $line = 'not a dynamic executable' ]] && return 1
+ [[ $line =~ 'not found' ]] &&{
echo "Missing a shared library required by $bin." >&2
echo "Run \"ldd $bin\" to find out what it is." >&2
echo "dracut cannot create an initrd." >&2
exit 1
- }
+ }
+ [[ $line =~ '([^ ]*/lib[^/]*/[^ ]*\.so[^ ]*)' ]] || continue
+ FILE=${BASH_REMATCH[1]}
+ [[ -f ${initdir}$FILE ]] && continue
# see if we are loading an optimized version of a shared lib.
[[ $FILE =~ '^(/lib[^/]*).*' ]] && {
TLIBDIR=${BASH_REMATCH[1]}
inst "$realsrc" && ln -s "$realsrc" "$target"
}
+# udev rules always get installed in the same place, so
+# create a function to install them to make life simpler.
+inst_rules() {
+ for rule in "$@"; do
+ inst_simple "$rule" "/lib/udev/rules.d/${rule##*/}"
+ done
+}
+
# general purpose installation function
# Same args as above.
inst() {
#!/bin/bash
-inst cryptsetup
\ No newline at end of file
+inst cryptsetup
+inst_rules "$dsrc/rules.d/63-luks.rules"
\ No newline at end of file
#!/bin/bash
-inst lvm
\ No newline at end of file
+inst lvm
+inst_rules "$dsrc/rules.d/64-lvm.rules"
\ No newline at end of file
# ultimately, /lib/initramfs/rules.d or somesuch which includes links/copies
# of the rules we want so that we just copy those in would be best
mkdir -p "$initdir/lib/udev/rules.d"
-for rule in /lib/udev/rules.d/10-console* /lib/udev/rules.d/40-redhat* /lib/udev/rules.d/50* /lib/udev/rules.d/60-persistent-storage.rules /lib/udev/rules.d/61*edd* /lib/udev/rules.d/64* /lib/udev/rules.d/80* /lib/udev/rules.d/95* $rulesdir/*.rules ; do
- inst "$rule" "/lib/udev/rules.d/${rule##*/}"
-done
+dracut_install udevd udevadm /lib/udev/*_id /lib/udev/console_*
+inst_rules /lib/udev/rules.d/10-console* /lib/udev/rules.d/40-redhat* \
+ /lib/udev/rules.d/50* /lib/udev/rules.d/60-persistent-storage.rules \
+ /lib/udev/rules.d/61*edd* /lib/udev/rules.d/64* /lib/udev/rules.d/80* \
+ /lib/udev/rules.d/95*
\ No newline at end of file
#!/bin/bash
-dracut_install mount mknod mkdir modprobe udevd udevadm pidof sleep \
- chroot echo sed sh ls /lib/udev/vol_id /lib/udev/console_init
+dracut_install mount mknod mkdir modprobe pidof sleep chroot echo sed sh ls
# install our scripts and hooks
inst "$initfile" "/init"