blob: a338d3bc4f8f845b4c62cfe037bd473d0e672f86 (
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
# vim: set ft=sh:
install ()
{
MODULE_FILE="$(mktemp /tmp/initcpio_modules.XXXXXX)"
#blegh, we'll let /tmp clean itself up
AUTODETECT="$(auto_modules -e '/scsi/' -e '/block' -e '/fusion/' \
-e '/usb/' -e '/ide/' -e '/ieee1394/' -e '/cdrom' \
-e '/net/' -e '/pcmcia')"
#Filesystem detection, use sysfs instead of /proc
for blk in $(ls /sys/block/*/*/dev | cut -d/ -f5); do
eval $(/usr/lib/klibc/bin/fstype < /dev/${blk})
for mod in $(find "${MODULEDIR}" -type f -name "${FSTYPE}.ko"); do
if [ "x${mod}" != "x" ]; then
AUTODETECT="${AUTODETECT} ${mod}"
fi
done
done
if [ -e /sbin/mdadm ]; then
if [ $UID -eq 0 -o "$(groups | grep disk)" != "" ]; then
AUTODETECT="$AUTODETECT
$(mdadm -E -s /dev/hd* /dev/sd* /dev/rd/* /dev/ida/* /dev/cciss/* /dev/ataraid/* \
| awk -Flevel= '{print $2}' | awk '{print $1}')"
else
err "User does not have proper permissions to read superblocks, raid modules are not detected"
fi
fi
for m in $AUTODETECT; do
modname="$(basename ${m%%\.ko})"
grep "${modname}" "${MODULE_FILE}" >/dev/null 2>&1 && continue
case "${m}" in
#*/ieee1394/*) echo -e "sbp2\nsd_mod\nsr_mod" >> "${MODULE_FILE}";;
*ext3*) echo "jbd" >> "${MODULE_FILE}" ;;
*afs*)echo "rxrpc" >> "${MODULE_FILE}" ;;
*cramfs*) echo "zlib_inflate" >> "${MODULE_FILE}" ;;
*isofs*) echo "zlib_inflate" >> "${MODULE_FILE}" ;;
*msdos*) echo "fat" >> "${MODULE_FILE}" ;;
*vfat*)echo -e "fat\nnls_cp437" >> "${MODULE_FILE}" ;;
*ocfs2*) echo -e "ocfs2_dlm\njbd\nocfs2_nodemanager\nconfigfs" >> "${MODULE_FILE}" ;;
esac
echo "${modname}" >> "${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
}
|