lvm2/mkinitrd-devmapper-setup.sh
Dr. Werner Fink fc4fb0b87f Accepting request 183370 from home:olh:branches:Base:System
- Remove usage of absolute paths in mkinitrd scripts

- Fix parsing lvdisplay -c output with more than 10 volumes in 
  mkinitrd-lvm2-setup.sh (bnc#826727)

OBS-URL: https://build.opensuse.org/request/show/183370
OBS-URL: https://build.opensuse.org/package/show/Base:System/lvm2?expand=0&rev=62
2013-07-20 11:40:59 +00:00

41 lines
1.2 KiB
Bash

#!/bin/bash
#
#%stage: devicemapper
#%depends: dmroot
#
# no dmsetup -> no dm
if [ -x "$(type -p dmsetup)" ]; then
dm_blockdev=
# if any device before was on dm we have to activate it
[ "$tmp_root_dm" ] && root_dm=1
blockdev="$(dm_resolvedeps_recursive $blockdev)"
[ "$?" = 0 ] && root_dm=1
# include dm when using dm based block devs
[ "$DM_BLOCK" ] && root_dm=1
# include modules
if [ -n "$root_dm" ] ; then
# Add all dm modules
dm_modules=
for table in $(dmsetup table | cut -f 4 -d ' ' | sort | uniq); do
if [ "$table" ] && [ "$table" != "linear" ] &&
[ "$table" != "striped" ] && [ "$table" != "snapshot-origin" ] ; then
dm_modules="$dm_modules dm-$table"
fi
done
fi
# include dm block var from sysconfig
mkdir -p $tmp_mnt/etc/sysconfig
grep DM_BLOCK /etc/sysconfig/kernel > $tmp_mnt/etc/sysconfig/kernel
mkdir -p $tmp_mnt/usr/lib/udev/rules.d
cp /usr/lib/udev/rules.d/10-dm.rules $tmp_mnt/usr/lib/udev/rules.d/
cp /usr/lib/udev/rules.d/13-dm-disk.rules $tmp_mnt/usr/lib/udev/rules.d
cp /usr/lib/udev/rules.d/95-dm-notify.rules $tmp_mnt/usr/lib/udev/rules.d
save_var root_dm
save_var dm_modules
fi