#!/bin/sh
#
# store the multipath tool in the initrd
# hotplug & udev will take care of calling it when appropriate
# this tool is statically linked against klibc : no additional libs
#
cp /sbin/multipath $INITRDDIR/sbin
cp /sbin/kpartx $INITRDDIR/sbin

#
# feed the dependencies too
# scsi_id is dynamicaly linked, so store the libs too
#
cp /lib/udev/scsi_id $INITRDDIR/lib/udev/
cp /bin/mountpoint $INITRDDIR/bin

PROGS="/lib/udev/scsi_id /bin/mountpoint"
LIBS=`ldd $PROGS | grep -v linux-gate.so | sort -u | \
awk '{print $3}'`
for i in $LIBS
do
	mkdir -p `dirname $INITRDDIR/$i`
	cp $i $INITRDDIR/$i
done

#
# config file ?
#
if [ -f /etc/multipath.conf ]
then
	cp /etc/multipath.conf $INITRDDIR/etc/
fi
