# Distributed under the GPL v2
# $Id$
+ 06 Feb 2012; Robin H. Johnson <robbat2@gentoo.org> gen_initramfs.sh:
+ Refactor copy_binaries and multipath slightly for ease of usage and readability.
+
06 Feb 2012: Richard Yao <ryao@cs.stonybrook.edu> gen_initramfs.sh:
Refactor multipath initramfs generation using copy_binaries.
CPIO_ARGS="--quiet -o -H newc"
copy_binaries() {
-
- local destdir=$1 files=$2
-
- # Copy files
- lddtree $files | tr ')(' '\n' |awk '/=>/{ if($3 ~ /^\//){print $3}}' | sort | uniq | cpio -p --make-directories --dereference --quiet $destdir
+ local destdir=$1
+ shift
+ lddtree "$@" \
+ | tr ')(' '\n' \
+ | awk '/=>/{ if($3 ~ /^\//){print $3}}' \
+ | sort \
+ | uniq \
+ | cpio -p --make-directories --dereference --quiet $destdir
}
rm -r "${TEMP}/initramfs-multipath-temp"
fi
print_info 1 ' Multipath support being added'
- mkdir -p "${TEMP}/initramfs-multipath-temp/bin/"
- mkdir -p "${TEMP}/initramfs-multipath-temp/etc/"
- mkdir -p "${TEMP}/initramfs-multipath-temp/sbin/"
- mkdir -p "${TEMP}/initramfs-multipath-temp/lib/"
+ mkdir -p "${TEMP}"/initramfs-multipath-temp/{bin,etc,sbin,lib}/
# Copy files
- copy_binaries "${TEMP}/initramfs-multipath-temp" "$(echo /sbin/{multipath,kpartx,mpath_prio_*,devmap_name,dmsetup} /lib64/udev/scsi_id /bin/mountpoint)"
+ copy_binaries "${TEMP}/initramfs-multipath-temp" /sbin/{multipath,kpartx,mpath_prio_*,devmap_name,dmsetup} /lib64/udev/scsi_id /bin/mountpoint
if [ -x /sbin/multipath ]
then