copy_binaries, multipath: refactor for ease of use and readability.
authorRobin H. Johnson <robbat2@gentoo.org>
Mon, 6 Feb 2012 08:05:54 +0000 (08:05 +0000)
committerRobin H. Johnson <robbat2@gentoo.org>
Mon, 6 Feb 2012 08:19:17 +0000 (08:19 +0000)
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
ChangeLog
gen_initramfs.sh

index 0dec7c56d66cf63ab39f1113ddc8785927d845fa..6c2a7d7af2b54d3a3fcd1239ae8e676853815878 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
 
index 02e6554dabcb14dd27f28ba10fbe872bea389e48..43fd77f4767eb6e7d74cb0235373589ffea5257e 100755 (executable)
@@ -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