Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
40 lines (32 sloc) 1.19 KB
#!/bin/bash
build() {
if [[ ! -d /sys/devices ]]; then
err "/sys does not appear to be mounted. Unable to use autodetection"
return 1
fi
# generate a list of modules from aliases in /sys/devices
find /sys/devices -name modalias -exec sort -u {} + |
xargs modprobe -d "${basedir:-/}" -S "$kernver" -aR |
sort -u >>"$autodetect_cache"
if (( UID == 0 )) || in_array 'disk' $(groups); then
if ! findmnt -uno fstype ${basedir:-/} >>"$autodetect_cache"; then
err "failed to detect root filesystem"
fi
if [[ -x /sbin/mdadm ]]; then
/sbin/mdadm -Esv /dev/[hrsv]d* /dev/{ida,cciss,ataraid,mapper}/* |
sed -n 's/.*level=\([^ ]\+\) .*/\1/p' |
sed 's/\<raid[456]\>/raid456/g' | sort -u >>"$autodetect_cache"
fi
else
err "User does not have proper permissions to read superblocks, raid and filesystem modules are not detected"
fi
}
helpmsg() {
cat<<HELPEOF
This builder autodetects needed modules for the initramfs. This does not add
any modules on its own, but rather serves as a basis for limiting what the
following builders will add. Any buidlers placed prior to this will be
installed in full.
HELPEOF
}
# vim: set et ts=2 sw=2:
Jump to Line
Something went wrong with that request. Please try again.