summaryrefslogtreecommitdiffstats
path: root/install/autodetect
blob: 6371d353db34da806b3408aab29b340a8d7ff830 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# vim: set ft=sh:

install ()
{
    msg ":: Autodetecting modules"
    MODULE_FILE="$(mktemp /tmp/initcpio_modules.XXXXXX)"
    #blegh, we'll let /tmp clean itself up
    AUTODETECT=" $((auto_modules "/scsi/" | grep -ve "imm" -e "pcmcia" -e "ide") && echo "sd_mod sr_mod") 
                 $(auto_modules "/block/" && echo "sd_mod sr_mod")
                 $(auto_modules "/fusion/" && echo "sd_mod sr_mod")
                 $(auto_modules "/usb/" && echo "usb_storage usbhid sd_mod sr_mod")
                 $(auto_modules "/ide/")
                 $(auto_modules "/ieee1394/" && echo "sbp2 sd_mod sr_mod")
                 $(auto_modules "/cdrom/") 
                 $(cat /proc/filesystems | grep -v nodev) "

    for m in $AUTODETECT; do
        modname="$(basename ${m%%\.ko})"
        grep "${modname}" "${MODULE_FILE}" >/dev/null 2>&1 && continue
        echo "${modname}" >> "${MODULE_FILE}"
        # fixing missing depends for filesystems
        [ "$m" = "ext3" ] && echo "jbd" >> "${MODULE_FILE}"
        [ "$m" = "afs" ] && echo "rxrpc" >> "${MODULE_FILE}"
        [ "$m" = "cramfs" ] && echo "zlib_inflate" >> "${MODULE_FILE}"
        [ "$m" = "isofs" ] && echo "zlib_inflate" >> "${MODULE_FILE}"
        [ "$m" = "msdos" ] && echo "fat" >> "${MODULE_FILE}"
        [ "$m" = "vfat" ] && echo "fat" >> "${MODULE_FILE}"
        [ "$m" = "ocfs2" ] && echo -e "ocfs2_dlm\njbd\nocfs2_nodemanager\nconfigfs" >> "${MODULE_FILE}"
    done

    BINARIES=""
    FILES=""
    SCRIPT=""
}

help ()
{
cat <<HELPEOF
  This hook shrinks your initramdisk to a smaller size 
  by autodetecting your needed modules. Be sure to verify
  included modules are correct and none are missing.
  This hook must be run before other subsystem hooks in
  order to take advantage of auto-detection.  Any hooks
  placed before 'autodetect' will be installed in full.
HELPEOF
}