copy_binaries, multipath: refactor for ease of use and readability.

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
cleanup-cruft
Robin H. Johnson 13 years ago
parent a871576d17
commit 5f4d31dfd0

@ -5,6 +5,9 @@
# 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.

@ -4,11 +4,14 @@
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
}
@ -159,13 +162,10 @@ append_multipath(){
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

Loading…
Cancel
Save