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 | |
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
-rw-r--r-- | debian/changelog | 3 | ||||
-rw-r--r-- | hook-functions | 36 |
2 files changed, 24 insertions, 15 deletions
diff --git a/debian/changelog b/debian/changelog index 34f7103..da0b63e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,8 +2,9 @@ initramfs-tools (0.91) unstable; urgency=low * scripts/functions: simplify panic() * mkinitramfs: Kick empty dir modules. + * hook-functions: Factor sys_walk_mod_add() out of dep_add_modules(). - -- maximilian attems <maks@debian.org> Thu, 16 Aug 2007 00:25:22 +0200 + -- maximilian attems <maks@debian.org> Thu, 16 Aug 2007 10:06:09 +0200 initramfs-tools (0.90) unstable; urgency=low 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 |