Gentoo Archives: gentoo-commits

From: Sebastian Pipping <sping@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/genkernel:master commit in: /
Date: Sun, 08 Apr 2012 18:34:14
Message-Id: 1333909628.10a2bde198877d240a20d45a93cb523df13d35a0.sping@gentoo
1 commit: 10a2bde198877d240a20d45a93cb523df13d35a0
2 Author: Sebastian Pipping <sebastian <AT> pipping <DOT> org>
3 AuthorDate: Sun Apr 8 18:27:08 2012 +0000
4 Commit: Sebastian Pipping <sping <AT> gentoo <DOT> org>
5 CommitDate: Sun Apr 8 18:27:08 2012 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=10a2bde1
7
8 Refactor code selecting best available initrd compression
9
10 ---
11 gen_initramfs.sh | 26 +++++++++++++++-----------
12 1 files changed, 15 insertions(+), 11 deletions(-)
13
14 diff --git a/gen_initramfs.sh b/gen_initramfs.sh
15 index 066c389..082d525 100755
16 --- a/gen_initramfs.sh
17 +++ b/gen_initramfs.sh
18 @@ -715,17 +715,21 @@ create_initramfs() {
19 xz|lzma|bzip2|gzip|lzop) compression=${COMPRESS_INITRD_TYPE} ;;
20 lzo) compression=lzop ;;
21 best)
22 - if grep -sq '^CONFIG_RD_XZ=y' ${KERNEL_DIR}/.config && test -n "${cmd_xz}" ; then
23 - compression=xz
24 - elif grep -sq '^CONFIG_RD_LZMA=y' ${KERNEL_DIR}/.config && test -n "${cmd_lzma}" ; then
25 - compression=lzma
26 - elif grep -sq '^CONFIG_RD_BZIP2=y' ${KERNEL_DIR}/.config && test -n "${cmd_bzip2}" ; then
27 - compression=bzip2
28 - elif grep -sq '^CONFIG_RD_GZIP=y' ${KERNEL_DIR}/.config && test -n "${cmd_gzip}" ; then
29 - compression=gzip
30 - elif grep -sq '^CONFIG_RD_LZO=y' ${KERNEL_DIR}/.config && test -n "${cmd_lzop}" ; then
31 - compression=lzop
32 - fi ;;
33 + for tuple in \
34 + 'CONFIG_RD_XZ cmd_xz xz' \
35 + 'CONFIG_RD_LZMA cmd_lzma lzma' \
36 + 'CONFIG_RD_BZIP2 cmd_bzip2 bzip' \
37 + 'CONFIG_RD_GZIP cmd_gzip gzip' \
38 + 'CONFIG_RD_LZO cmd_lzop lzop'; do
39 + set -- ${tuple}
40 + kernel_option=$1
41 + cmd_variable_name=$2
42 + if grep -sq "^${kernel_option}=y" ${KERNEL_DIR}/.config && test -n "${!cmd_variable_name}" ; then
43 + compression=$3
44 + break
45 + fi
46 + done
47 + ;;
48 *)
49 gen_die "Compression '${COMPRESS_INITRD_TYPE}' unknown"
50 ;;