diff options
author | Jonathan Bauer | 2018-08-23 14:07:54 +0200 |
---|---|---|
committer | Jonathan Bauer | 2018-08-23 14:07:54 +0200 |
commit | d9f5d3bd972f2d8c8f260693c172774ae0db707b (patch) | |
tree | ae5dd006dd363a992ac6fd716251a1a2c0e0d918 /builder/build-initramfs.sh | |
parent | added missing description for the --init option (diff) | |
download | systemd-init-d9f5d3bd972f2d8c8f260693c172774ae0db707b.tar.gz systemd-init-d9f5d3bd972f2d8c8f260693c172774ae0db707b.tar.xz systemd-init-d9f5d3bd972f2d8c8f260693c172774ae0db707b.zip |
autodetect libkmod version to decide which dracut version to install
Diffstat (limited to 'builder/build-initramfs.sh')
-rwxr-xr-x | builder/build-initramfs.sh | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/builder/build-initramfs.sh b/builder/build-initramfs.sh index 0a0dc493..a646018c 100755 --- a/builder/build-initramfs.sh +++ b/builder/build-initramfs.sh @@ -67,7 +67,6 @@ core.import change_root # region properties # shellcheck disable=SC2034 build_initramfs__doc_test_setup__='exceptions.activate' -dracut_resource_url='https://www.kernel.org/pub/linux/utils/boot/dracut/dracut-047.tar.gz' file_path='/boot/initramfs.img' dracut_parameter=(--force --no-hostonly) verbose='no' @@ -85,6 +84,7 @@ declare -A core_dependencies=( [dmsetup]='create a (temporary) writable layer during boot' \ [grep]='retrieve right boot partition during boot' \ [mktemp]='create save temporary files and dictionaries' \ + [pkg-config]='retrieve information of installed development packages' \ [tee]='read from standard input and write to standard output and files' \ [readlink]="connect dracut module with dracut's module system" \ [rm]='remove (temporary) files' \ @@ -429,10 +429,20 @@ initialize_dracut() { `initialize_dracut` ' + # First check what version to get + # Autodetect the kmod version present on the system to decide which dracut version to get + # * v47 requires kmod >= 23 (Available in Ubuntu 18.04) + # * v46 works with kmod == 20 (CentOS 7.5 only provides kmod v20) + if [ "$(pkg-config --modversion libkmod)" -ge 23 ]; then + dracut_version="047" + else + dracut_version="046" + fi + dracut_resource_url="https://www.kernel.org/pub/linux/utils/boot/dracut/dracut-$dracut_version.tar.gz" if [[ ! -f "${_root_dir}/dracut/install/dracut-install" ]] then mkdir --parents "${_root_dir}/dracut" - logging.info 'Download and extract dracut.' + logging.info "Download and extract dracut version $dracut_version" curl --location "$dracut_resource_url" | tar --extract --gzip \ --directory "${_root_dir}/dracut" \ --strip-components 1 |