1 # Check if $1 is equal to any argument in $1 .. $*.
13 # Check the old value of INITRD_MODULES:
14 # - Remove modules that no longer exist.
15 # - Add modules that were built into the kernel before.
17 update_INITRD_MODULES() {
18 # MD_MODS is the list of modules that require md.o.
19 local MD_MODS="linear multipath raid0 raid1 raid5"
21 # NON_SCSI is a whitelist of modules that are no scsi drivers. Any
22 # module not listed here is assumed to be a scsi driver, and the
23 # low-level scsi modules are added to INITRD_MODULES.
24 local NON_SCSI="jbd ext3 jfs xfs reiserfs $MD_MODS md"
26 local result maybe_scsi need_md have_md have_scsi have_sd m
28 m="${m%.o}" ; m="${m%.ko}"
30 contains "$m" $NON_SCSI || maybe_scsi=1
31 contains "$m" $MD_MODS && need_md=1
32 [ "$m" == md ] && have_md=1
33 if contains "$m" scsi_mod sd_mod ; then
37 if contains "$m" xfs_dmapi xfs_support ; then
38 echo "Module $m no longer exists, and was removed from" \
43 result[${#result[@]}]="$m"
45 if [ -n "$maybe_scsi" -o -n "$have_scsi" -o -n "$have_sd" ]; then
46 [ -z "$have_scsi" -o -z "$have_sd" ] \
47 && echo "Adding SCSI disk modules to INITRD_MODULES" >&2
48 result=(scsi_mod sd_mod ${result[@]})
50 if [ -n "$need_md" -a -z "$have_md" ]; then
51 echo "Adding RAID support module to INITRD_MODULES" >&2
52 result=(md ${result[@]})