diff options
author | maximilian attems <maks@debian.org> | 2007-08-08 01:02:16 +0200 |
---|---|---|
committer | maximilian attems <maks@debian.org> | 2007-08-08 01:02:16 +0200 |
commit | ccb150b16473ce974a0fbbb236c0dd95a022ec43 (patch) | |
tree | da4989f298df3f46b610b3976acf40dfd49626af | |
parent | f917408f4bb541f44973be3f7ef4a48ba6528e9a (diff) | |
download | initramfs-tools-ccb150b16473ce974a0fbbb236c0dd95a022ec43.tar.gz initramfs-tools-ccb150b16473ce974a0fbbb236c0dd95a022ec43.zip |
hook-functions: fix dep_add_modules() for lvm, md and luks root
a better shot and try for finding the underlying root devices
in the case of MODULES=dep and /sys walk.
dep_add_modules() should be splitted..
-rw-r--r-- | debian/changelog | 6 | ||||
-rw-r--r-- | hook-functions | 26 |
2 files changed, 26 insertions, 6 deletions
diff --git a/debian/changelog b/debian/changelog index 60f216b..f0da4a9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -initramfs-tools (0.90) UNRELEASED; urgency=low +initramfs-tools (0.90~beta1) UNRELEASED; urgency=low [ maximilian attems ] * hook-functions: Fix xen i386 boots with optimized 2.5. (closes: 420754) @@ -6,11 +6,13 @@ initramfs-tools (0.90) UNRELEASED; urgency=low * debian/control: Bump dep on klibc-utils from etch. (closes: 435031) * scripts/functions: Implement non-zero panic bootarg. Style fix for maybe_break(). + * hook-functions: dep_add_modules() fix for md, lv, luks root. + (closes: #426917, #429237, #426446) [ David Härdeman ] * hook-functions: Protect all variable with local, plus coding style fixes. - -- maximilian attems <maks@debian.org> Tue, 07 Aug 2007 14:09:18 +0200 + -- maximilian attems <maks@debian.org> Wed, 08 Aug 2007 00:50:22 +0200 initramfs-tools (0.89) unstable; urgency=low diff --git a/hook-functions b/hook-functions index b371cbb..ef4a94e 100644 --- a/hook-functions +++ b/hook-functions @@ -185,16 +185,34 @@ copy_modules_dir() # only copy relevant modules dep_add_modules() { - local x + local root rootfs block minor device_path module x # findout root block device + fstype eval "$(mount | awk '/ \/ / {print "root=" $1 "\nrootfs=" $5; exit}')" - block=${root#/dev/} - block=${block%[0-9]*} + + # lvm luks root + if [ "${root#/dev/mapper/}" != "${root}" ]; then + minor=$((0x$(stat --format "%T" ${root}) % 256)) + block=$(ls -1 /sys/block/dm-${minor}/slaves | head -n 1) + if [ "${block#dm-}" != "${block}" ]; then + block=$(ls -1 /sys/block/${block}/slaves | head -n 1) + fi + block=${block%[0-9]*} + # md root + elif [ "${root#/dev/md}" != "${root}" ]; then + root=${root#/dev/} + block=$(awk "/^${root}/{print substr(\$5, 1, 3); exit}" \ + /proc/mdstat) + # classical root device + else + block=${root#/dev/} + block=${block%[0-9]*} + fi # Error out if /sys lack block dev if [ -z "${block}" ] || [ ! -e /sys/block/${block} ]; then - echo "Error: missing ${block} root ${root} /sys entry" + echo "mkinitramfs: missing ${block} root ${root} /sys entry" + echo "mkinitramfs: Error use MODULES=most" exit 1 fi |