diff options
Diffstat (limited to 'mkinitramfs')
| -rw-r--r-- | mkinitramfs | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/mkinitramfs b/mkinitramfs index f06811e..4dabfce 100644 --- a/mkinitramfs +++ b/mkinitramfs @@ -1,7 +1,17 @@ #!/bin/sh +# For dependency ordered mkinitramfs hook scripts. +. /usr/share/initramfs-tools/scripts/functions + # Takes a file containing a list of modules to be added as an argument # Figures out dependancies and adds it in. +# +# File syntax: +# +# # comment +# modprobe_module_name [args ...] +# [...] +# manual_add_modules() { # Sanity check @@ -9,8 +19,8 @@ manual_add_modules() return fi - for x in $(sed -e '/^#/d' ${1}); do - for y in $(modprobe --set-version=${version} --show-depends ${x} | awk '{ print $2 }'); do + sed -e '/^#/d' ${1} | while read module rest; do + for y in $(modprobe --set-version=${version} --show-depends ${module} | awk '{ print $2 }'); do # Prune duplicates if [ -e ${TMPDIR}/${y} ]; then continue @@ -18,7 +28,7 @@ manual_add_modules() mkdir -p ${TMPDIR}/$(dirname ${y}) ln -s ${y} ${TMPDIR}/$(dirname ${y}) - echo $(basename ${y} .ko) >>${TMPDIR}/conf/modules + echo $(basename ${y} .ko) "${rest}" >>${TMPDIR}/conf/modules done done } @@ -51,7 +61,7 @@ auto_add_modules() copy_modules_dir kernel/fs/xfs # These aren't caught by the above but really need to be there: - for x in mbcache nfs af_packet raid1; do + for x in mbcache nfs af_packet raid1 ide-cd ide-disk ide-generic; do for y in $(modprobe --set-version=${version} --show-depends ${x} | awk '{ print $2 }'); do # Prune duplicates if [ -e ${TMPDIR}/${y} ]; then @@ -99,9 +109,6 @@ while getopts "d:ko:r:" flag; do o) outfile="${OPTARG}" ;; - v) - version="${OPTARG}" - ;; k) keep="y" ;; @@ -112,14 +119,18 @@ shift $((${OPTIND} - 1)) . ${CONFDIR}/initramfs.conf -if [ x${outfile} = x ] || [ ${#} -ne 1 ]; then +if [ x${outfile} = x ]; then usage fi # And by "version" we really mean path to kernel modules # This is braindead, and exists to preserve the interface with mkinitrd -version=${1} -[ $# -gt 0 ] || unset version +if [ ${#} -ne 1 ]; then + version=$(uname -r) +else + version="${1}" +fi + case ${version} in /lib/modules/*/[!/]*) ;; @@ -136,8 +147,6 @@ case ${version} in ;; esac -version="${version-$(uname -r)}" - if [ -d ${outfile} ]; then echo "${outfile} is a directory" exit 1 @@ -193,6 +202,11 @@ ln -s /etc/modprobe.d/aliases ${TMPDIR}/etc/modprobe.d ln -s /sbin/mdadm ${TMPDIR}/sbin ln -s /sbin/mdrun ${TMPDIR}/sbin +run_scripts /usr/share/initramfs-tools/hooks +run_scripts /etc/mkinitramfs/hooks + +# FIXME catenate extra cpio.gz here >>${outfile} + (cd ${TMPDIR} && find . | cpio --quiet --dereference -o -H newc | gzip -9 >${outfile}) if [ "${keep}" = "y" ]; then |
