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:04
Message-Id: 1333908197.b7efd3d65836d2ddba3396154e77e7ce62ed0710.sping@gentoo
1 commit: b7efd3d65836d2ddba3396154e77e7ce62ed0710
2 Author: Sebastian Pipping <sebastian <AT> pipping <DOT> org>
3 AuthorDate: Sun Apr 8 18:03:17 2012 +0000
4 Commit: Sebastian Pipping <sping <AT> gentoo <DOT> org>
5 CommitDate: Sun Apr 8 18:03:17 2012 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=b7efd3d6
7
8 Be more helpful when requested compression is not available
9
10 ---
11 gen_initramfs.sh | 18 +++++++++++++++---
12 1 files changed, 15 insertions(+), 3 deletions(-)
13
14 diff --git a/gen_initramfs.sh b/gen_initramfs.sh
15 index be0da85..a33fa7e 100755
16 --- a/gen_initramfs.sh
17 +++ b/gen_initramfs.sh
18 @@ -705,9 +705,15 @@ create_initramfs() {
19 cmd_bzip2=$(type -p bzip2)
20 cmd_gzip=$(type -p gzip)
21 cmd_lzop=$(type -p lzop)
22 + pkg_xz='app-arch/xz-utils'
23 + pkg_lzma='app-arch/xz-utils'
24 + pkg_bzip2='app-arch/bzip2'
25 + pkg_gzip='app-arch/gzip'
26 + pkg_lzop='app-arch/lzop'
27 local compression
28 case ${COMPRESS_INITRD_TYPE} in
29 - xz|lzma|bzip2|gzip|lzo) compression=${COMPRESS_INITRD_TYPE} ;;
30 + xz|lzma|bzip2|gzip) compression=${COMPRESS_INITRD_TYPE} ;;
31 + lzo) compression=lzop ;;
32 best)
33 if grep -sq '^CONFIG_RD_XZ=y' ${KERNEL_DIR}/.config && test -n "${cmd_xz}" ; then
34 compression=xz
35 @@ -718,18 +724,24 @@ create_initramfs() {
36 elif grep -sq '^CONFIG_RD_GZIP=y' ${KERNEL_DIR}/.config && test -n "${cmd_gzip}" ; then
37 compression=gzip
38 elif grep -sq '^CONFIG_RD_LZO=y' ${KERNEL_DIR}/.config && test -n "${cmd_lzop}" ; then
39 - compression=lzo
40 + compression=lzop
41 fi ;;
42 *)
43 gen_die "Compression '${COMPRESS_INITRD_TYPE}' unknown"
44 ;;
45 esac
46 +
47 + # Check for actual availability
48 + cmd_variable_name=cmd_${compression}
49 + pkg_variable_name=pkg_${compression}
50 + [[ -z "${!cmd_variable_name}" ]] && gen_die "Compression '${compression}' is not available. Please install package '${!pkg_variable_name}'."
51 +
52 case $compression in
53 xz) compress_ext='.xz' compress_cmd="${cmd_xz} -e --check=none -z -f -9" ;;
54 lzma) compress_ext='.lzma' compress_cmd="${cmd_lzma} -z -f -9" ;;
55 bzip2) compress_ext='.bz2' compress_cmd="${cmd_bzip2} -z -f -9" ;;
56 gzip) compress_ext='.gz' compress_cmd="${cmd_gzip} -f -9" ;;
57 - lzo) compress_ext='.lzo' compress_cmd="${cmd_lzop} -f -9" ;;
58 + lzop) compress_ext='.lzo' compress_cmd="${cmd_lzop} -f -9" ;;
59 esac
60
61 if [ -n "${compression}" ]; then