dracut-install: Add support for compressed kernel modules
When a module is compressed, uncompress it before packing into initrd. Since initrd is already compressed, it makes no sense to put the compressed module files. The patch contains a slight refactoring and adds a helper function to get the command for uncompressing a file per extension.master
parent
11e1f68065
commit
3e53195bce
|
|
@ -541,6 +541,14 @@ inst_libdir_file() {
|
||||||
[[ $_files ]] && inst_multiple $_files
|
[[ $_files ]] && inst_multiple $_files
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# get a command to decompress the given file
|
||||||
|
get_decompress_cmd() {
|
||||||
|
case "$1" in
|
||||||
|
*.gz) echo 'gzip -f -d' ;;
|
||||||
|
*.bz2) echo 'bzip2 -d' ;;
|
||||||
|
*.xz) echo 'xz -f -d' ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
# install function decompressing the target and handling symlinks
|
# install function decompressing the target and handling symlinks
|
||||||
# $@ = list of compressed (gz or bz2) files or symlinks pointing to such files
|
# $@ = list of compressed (gz or bz2) files or symlinks pointing to such files
|
||||||
|
|
@ -552,11 +560,8 @@ inst_decompress() {
|
||||||
|
|
||||||
for _src in $@
|
for _src in $@
|
||||||
do
|
do
|
||||||
case ${_src} in
|
_cmd=$(get_decompress_cmd ${_src})
|
||||||
*.gz) _cmd='gzip -f -d' ;;
|
[[ -z "${_cmd}" ]] && return 1
|
||||||
*.bz2) _cmd='bzip2 -d' ;;
|
|
||||||
*) return 1 ;;
|
|
||||||
esac
|
|
||||||
inst_simple ${_src}
|
inst_simple ${_src}
|
||||||
# Decompress with chosen tool. We assume that tool changes name e.g.
|
# Decompress with chosen tool. We assume that tool changes name e.g.
|
||||||
# from 'name.gz' to 'name'.
|
# from 'name.gz' to 'name'.
|
||||||
|
|
@ -928,6 +933,9 @@ install_kmod_with_fw() {
|
||||||
inst_simple "$1" "/lib/modules/$kernel/${1##*/lib/modules/$kernel/}"
|
inst_simple "$1" "/lib/modules/$kernel/${1##*/lib/modules/$kernel/}"
|
||||||
ret=$?
|
ret=$?
|
||||||
(($ret != 0)) && return $ret
|
(($ret != 0)) && return $ret
|
||||||
|
local _cmd=$(get_decompress_cmd "$1")
|
||||||
|
[[ -n "${_cmd}" ]] && \
|
||||||
|
${_cmd} "${initdir}/lib/modules/$kernel/${1##*/lib/modules/$kernel/}"
|
||||||
|
|
||||||
local _modname=${1##*/} _fwdir _found _fw
|
local _modname=${1##*/} _fwdir _found _fw
|
||||||
_modname=${_modname%.ko*}
|
_modname=${_modname%.ko*}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue