1 |
commit: 5f4d31dfd0eb71c4001afcc6d32a610060901c04 |
2 |
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Feb 6 08:05:54 2012 +0000 |
4 |
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Feb 6 08:19:17 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=5f4d31df |
7 |
|
8 |
copy_binaries, multipath: refactor for ease of use and readability. |
9 |
|
10 |
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org> |
11 |
|
12 |
--- |
13 |
ChangeLog | 3 +++ |
14 |
gen_initramfs.sh | 20 ++++++++++---------- |
15 |
2 files changed, 13 insertions(+), 10 deletions(-) |
16 |
|
17 |
diff --git a/ChangeLog b/ChangeLog |
18 |
index 0dec7c5..6c2a7d7 100644 |
19 |
--- a/ChangeLog |
20 |
+++ b/ChangeLog |
21 |
@@ -5,6 +5,9 @@ |
22 |
# Distributed under the GPL v2 |
23 |
# $Id$ |
24 |
|
25 |
+ 06 Feb 2012; Robin H. Johnson <robbat2@g.o> gen_initramfs.sh: |
26 |
+ Refactor copy_binaries and multipath slightly for ease of usage and readability. |
27 |
+ |
28 |
06 Feb 2012: Richard Yao <ryao@×××××××××××××.edu> gen_initramfs.sh: |
29 |
Refactor multipath initramfs generation using copy_binaries. |
30 |
|
31 |
|
32 |
diff --git a/gen_initramfs.sh b/gen_initramfs.sh |
33 |
index 02e6554..43fd77f 100755 |
34 |
--- a/gen_initramfs.sh |
35 |
+++ b/gen_initramfs.sh |
36 |
@@ -4,11 +4,14 @@ |
37 |
CPIO_ARGS="--quiet -o -H newc" |
38 |
|
39 |
copy_binaries() { |
40 |
- |
41 |
- local destdir=$1 files=$2 |
42 |
- |
43 |
- # Copy files |
44 |
- lddtree $files | tr ')(' '\n' |awk '/=>/{ if($3 ~ /^\//){print $3}}' | sort | uniq | cpio -p --make-directories --dereference --quiet $destdir |
45 |
+ local destdir=$1 |
46 |
+ shift |
47 |
+ lddtree "$@" \ |
48 |
+ | tr ')(' '\n' \ |
49 |
+ | awk '/=>/{ if($3 ~ /^\//){print $3}}' \ |
50 |
+ | sort \ |
51 |
+ | uniq \ |
52 |
+ | cpio -p --make-directories --dereference --quiet $destdir |
53 |
|
54 |
} |
55 |
|
56 |
@@ -159,13 +162,10 @@ append_multipath(){ |
57 |
rm -r "${TEMP}/initramfs-multipath-temp" |
58 |
fi |
59 |
print_info 1 ' Multipath support being added' |
60 |
- mkdir -p "${TEMP}/initramfs-multipath-temp/bin/" |
61 |
- mkdir -p "${TEMP}/initramfs-multipath-temp/etc/" |
62 |
- mkdir -p "${TEMP}/initramfs-multipath-temp/sbin/" |
63 |
- mkdir -p "${TEMP}/initramfs-multipath-temp/lib/" |
64 |
+ mkdir -p "${TEMP}"/initramfs-multipath-temp/{bin,etc,sbin,lib}/ |
65 |
|
66 |
# Copy files |
67 |
- copy_binaries "${TEMP}/initramfs-multipath-temp" "$(echo /sbin/{multipath,kpartx,mpath_prio_*,devmap_name,dmsetup} /lib64/udev/scsi_id /bin/mountpoint)" |
68 |
+ copy_binaries "${TEMP}/initramfs-multipath-temp" /sbin/{multipath,kpartx,mpath_prio_*,devmap_name,dmsetup} /lib64/udev/scsi_id /bin/mountpoint |
69 |
|
70 |
if [ -x /sbin/multipath ] |
71 |
then |