Refactor code selecting best available initrd compression

cleanup-cruft
Sebastian Pipping 13 years ago
parent 0da4543b8a
commit 10a2bde198

@ -715,17 +715,21 @@ create_initramfs() {
xz|lzma|bzip2|gzip|lzop) compression=${COMPRESS_INITRD_TYPE} ;; xz|lzma|bzip2|gzip|lzop) compression=${COMPRESS_INITRD_TYPE} ;;
lzo) compression=lzop ;; lzo) compression=lzop ;;
best) best)
if grep -sq '^CONFIG_RD_XZ=y' ${KERNEL_DIR}/.config && test -n "${cmd_xz}" ; then for tuple in \
compression=xz 'CONFIG_RD_XZ cmd_xz xz' \
elif grep -sq '^CONFIG_RD_LZMA=y' ${KERNEL_DIR}/.config && test -n "${cmd_lzma}" ; then 'CONFIG_RD_LZMA cmd_lzma lzma' \
compression=lzma 'CONFIG_RD_BZIP2 cmd_bzip2 bzip' \
elif grep -sq '^CONFIG_RD_BZIP2=y' ${KERNEL_DIR}/.config && test -n "${cmd_bzip2}" ; then 'CONFIG_RD_GZIP cmd_gzip gzip' \
compression=bzip2 'CONFIG_RD_LZO cmd_lzop lzop'; do
elif grep -sq '^CONFIG_RD_GZIP=y' ${KERNEL_DIR}/.config && test -n "${cmd_gzip}" ; then set -- ${tuple}
compression=gzip kernel_option=$1
elif grep -sq '^CONFIG_RD_LZO=y' ${KERNEL_DIR}/.config && test -n "${cmd_lzop}" ; then cmd_variable_name=$2
compression=lzop if grep -sq "^${kernel_option}=y" ${KERNEL_DIR}/.config && test -n "${!cmd_variable_name}" ; then
fi ;; compression=$3
break
fi
done
;;
*) *)
gen_die "Compression '${COMPRESS_INITRD_TYPE}' unknown" gen_die "Compression '${COMPRESS_INITRD_TYPE}' unknown"
;; ;;

Loading…
Cancel
Save