diff options
author | maximilian attems <maks@debian.org> | 2007-08-16 10:07:42 +0200 |
---|---|---|
committer | maximilian attems <maks@debian.org> | 2007-08-16 10:07:42 +0200 |
commit | 286148ccc99630bb60168e27b6aba1b14c1f737f (patch) | |
tree | b26bc9c3bd4e976bfc95e63976e04d609182c43f /hook-functions | |
parent | 45e9e24621bb7833ef20cc4c0a8ee1c4f2c8eefa (diff) | |
download | initramfs-tools-286148ccc99630bb60168e27b6aba1b14c1f737f.tar.gz initramfs-tools-286148ccc99630bb60168e27b6aba1b14c1f737f.zip |
hook-functions factor out sys_walk_mod_add()
add it as a function of it's own
Diffstat (limited to 'hook-functions')
-rw-r--r-- | hook-functions | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/hook-functions b/hook-functions index 0f66aa2..0a50051 100644 --- a/hook-functions +++ b/hook-functions @@ -182,10 +182,28 @@ copy_modules_dir() done } -# only copy relevant modules +# walk /sys for relevant modules +sys_walk_mod_add() +{ + local driver_path module + device_path="$1" + + while [ "${device_path}" != "/sys" ]; do + driver_path="$(readlink -f ${device_path}/driver)" + if [ -e "$driver_path" ]; then + module="$(basename $(readlink -f $driver_path))" + if [ -n "${module}" ]; then + force_load "${module}" + fi + fi + device_path="$(dirname ${device_path})" + done +} + +# find and only copy root relevant modules dep_add_modules() { - local root rootfs block minor device_path module x + local block minor root rootfs root_dev_path x # findout root block device + fstype eval "$(mount | awk '/ \/ / {print "root=" $1 "\nrootfs=" $5; exit}')" @@ -220,18 +238,8 @@ dep_add_modules() # Add rootfs force_load "${rootfs}" - # walk /sys for relevant modules - device_path=$(readlink -f /sys/block/${block}/device) - while [ "${device_path}" != "/sys" ]; do - driver_path="$(readlink -f ${device_path}/driver)" - if [ -e "$driver_path" ]; then - module="$(basename $(readlink -f $driver_path))" - if [ -n "${module}" ]; then - force_load "${module}" - fi - fi - device_path="$(dirname ${device_path})" - done + root_dev_path=$(readlink -f /sys/block/${block}/device) + sys_walk_mod_add ${root_dev_path} if [ -e /proc/ide ]; then for x in ide-generic ide-disk ide-cd; do |