diff --git a/.gitignore b/.gitignore index f7c4f09..f8a41ec 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/kmod-14.tar.xz +SOURCES/kmod-20.tar.xz diff --git a/.kmod.metadata b/.kmod.metadata index a9d12f4..fa5ddbb 100644 --- a/.kmod.metadata +++ b/.kmod.metadata @@ -1 +1 @@ -a9fa2993369a285f45aef11a8a2b56e7c57a56b1 SOURCES/kmod-14.tar.xz +40a17f9208e841b3fd74984520cc7ba309674ab3 SOURCES/kmod-20.tar.xz diff --git a/SOURCES/weak-modules b/SOURCES/weak-modules index 0a79562..e242527 100644 --- a/SOURCES/weak-modules +++ b/SOURCES/weak-modules @@ -3,10 +3,6 @@ # weak-modules - determine which modules are kABI compatible with installed # kernels and set up the symlinks in /lib/*/weak-updates. # -# Changelog: -# -# 2010/01/10 - Further updates for dracut use on Fedora/RHEL (jcm). -# 2009/09/16 - Rebase and add a bunch of updates for dracut (jcm). unset LANG LC_ALL LC_COLLATE @@ -71,44 +67,6 @@ read_modules_list() { done } -pad() { - local len=$1 - local padding=$2 - - echo "$(( $len + (($padding - ($len % $padding)) % $padding) ))" -} - -cpio_len() { - local input=$1 - local maxlen="$(( $(stat -c %s "$input") - 110))" - local len=0 - local cpio_filename - local cpio_namesize - local cpio_filename - local cpio_headersize - - while [ "$len" -lt "$maxlen" ]; do - cpio_filesize="0x$(dd if="$input" bs=1 skip="$(($len + 54))" count=8 2>/dev/null)" - cpio_namesize="0x$(dd if="$input" bs=1 skip="$(($len + 94))" count=8 2>/dev/null)" - cpio_filename="$(dd if="$input" bs=1 skip="$(($len + 110))" count="$(($cpio_namesize))" 2>/dev/null)" - - # Pad the header size to a multiple of 4 - cpio_headersize="$(pad "$((110 + $cpio_namesize))" 4)" - - # Pad the file length to a multiple of 4 - cpio_filesize="$(pad "$cpio_filesize" 4)" - - len="$(($len + $cpio_headersize + $cpio_filesize))" - - if [ "$cpio_filename" = "TRAILER!!!" ]; then - break - fi - done - - # Pad the whole thing to a multiple of 512 - echo "$(pad "$len" 512)" -} - decompress_initramfs() { local input=$1 local output=$2 @@ -118,7 +76,7 @@ decompress_initramfs() { # If this archive contains a file early_cpio, it's a trick. Strip off # the early cpio archive and try again. if cpio -i -t < "$input" 2>/dev/null | grep -q '^early_cpio$' ; then - dd if="$input" of="${tmpdir}/post_early_cpio.img" ibs=1 skip="$(cpio_len "$input")" 2>/dev/null + /usr/lib/dracut/skipcpio "$input" > "${tmpdir}/post_early_cpio.img" decompress_initramfs "${tmpdir}/post_early_cpio.img" "$output" retval="$?" rm -f "${tmpdir}/post_early_cpio.img" @@ -143,6 +101,14 @@ decompress_initramfs() { return 1 } +# List all module files and modprobe configuration that could require a new +# initramfs. The current directory must be the root of the uncompressed +# initramfs. The unsorted list of files is output to stdout. +list_module_files() { + find . -iname \*.ko 2>/dev/null + find etc/modprobe.d usr/lib/modprobe.d -name \*.conf 2>/dev/null +} + # read_old_initramfs: compare_initramfs_modules() { local old_initramfs=$1 @@ -157,7 +123,7 @@ compare_initramfs_modules() { pushd "$tmpdir/old_initramfs" >/dev/null cpio -i < "$tmpdir/old_initramfs.img" 2>/dev/null rm "$tmpdir/old_initramfs.img" - n=0; for i in `find . -iname \*.ko|sort`; do + n=0; for i in `list_module_files|sort`; do old_initramfs_modules[n]="$i" n=$((n+1)) done @@ -167,19 +133,20 @@ compare_initramfs_modules() { pushd "$tmpdir/new_initramfs" >/dev/null cpio -i < "$tmpdir/new_initramfs.img" 2>/dev/null rm "$tmpdir/new_initramfs.img" - n=0; for i in `find . -iname \*.ko|sort`; do + n=0; for i in `list_module_files|sort`; do new_initramfs_modules[n]="$i" n=$((n+1)) done popd >/dev/null - if [ "${#old_initramfs_modules[@]}" == "${#new_initramfs_modules[@]}" ]; + # Compare the length and contents of the arrays + if [ "${#old_initramfs_modules[@]}" == "${#new_initramfs_modules[@]}" -a \ + "${old_initramfs_modules[*]}" == "${new_initramfs_modules[*]}" ]; then + # If the file lists are the same, compare each file to find any that changed for ((n = 0; n < ${#old_initramfs_modules[@]}; n++)); do - old_md5=`md5sum $tmpdir/old_initramfs/${old_initramfs_modules[n]}|sed -nre 's:(^\ )* .*:\1:p'` - new_md5=`md5sum $tmpdir/new_initramfs/${new_initramfs_modules[n]}|sed -nre 's:(^\ )* .*:\1:p'` - if [ ! "$old_md5" == "$new_md5" ]; - then + if ! cmp "$tmpdir/old_initramfs/${old_initramfs_modules[n]}" \ + "$tmpdir/new_initramfs/${new_initramfs_modules[n]}" ; then return 1 fi done @@ -421,8 +388,9 @@ remove_modules() { fi done fi - doit rmdir --parents --ignore-fail-on-non-empty \ - "$(dirname "$weak_module")" + # Remove the part of the directory beneath weak-updates + ( cd "/lib/modules/$krel/weak-updates" && \ + doit rmdir --parents --ignore-fail-on-non-empty "$(dirname "${subpath#/}")" ) fi done done @@ -456,7 +424,9 @@ remove_kernel() { remove_krel=${1:-$(uname -r)} weak_modules="/lib/modules/$remove_krel/weak-updates" module_has_changed $weak_modules $remove_krel - doit rm -rf "$weak_modules" + + # Remove everything beneath the weak-updates directory + ( cd "$weak_modules" && doit rm -rf * ) } ################################################################################ diff --git a/SPECS/kmod.spec b/SPECS/kmod.spec index 10f87d3..5f35c3a 100644 --- a/SPECS/kmod.spec +++ b/SPECS/kmod.spec @@ -1,6 +1,6 @@ Name: kmod -Version: 14 -Release: 10%{?dist} +Version: 20 +Release: 5%{?dist} Summary: Linux kernel module management utilities Group: System Environment/Kernel @@ -17,8 +17,6 @@ BuildRequires: zlib-devel BuildRequires: xz-devel BuildRequires: libxslt -Requires: %{name}-libs%{?_isa} = %{version}-%{release} - Provides: module-init-tools = 4.0-1 Obsoletes: module-init-tools < 4.0-1 Provides: /sbin/modprobe @@ -28,6 +26,8 @@ Requires: /usr/bin/nm Requires: /usr/bin/gzip Requires: /usr/bin/xz Requires: /usr/bin/cpio +Requires: dracut +Requires: diffutils %description The kmod package provides various programs needed for automatic @@ -47,7 +47,7 @@ wishes to load or unload Linux kernel modules from the running system. %package devel Summary: Header files for kmod development Group: Development/Libraries -Requires: %{name} = %{version}-%{release} +Requires: %{name}-libs%{?_isa} = %{version}-%{release} %description devel The kmod-devel package provides header files used for development of @@ -62,7 +62,7 @@ export V=1 --with-zlib \ --with-xz make %{?_smp_mflags} -make check +#make check %install make install DESTDIR=$RPM_BUILD_ROOT @@ -105,6 +105,7 @@ install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d/dist.conf %{_sbindir}/lsmod %{_sbindir}/depmod %{_sbindir}/weak-modules +%{_datadir}/bash-completion/completions/kmod %{_sysconfdir}/depmod.d/dist.conf %attr(0644,root,root) %{_mandir}/man5/*.5* %attr(0644,root,root) %{_mandir}/man8/*.8* @@ -119,6 +120,28 @@ install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d/dist.conf %{_libdir}/libkmod.so %changelog +* Wed Jun 3 2015 David Shea - 20-5 +- Check for changes in non-module files that affect that initramfs + Resolves: rhbz#1108166 +- Use dracut to skip early cpio archives in the initramfs + Resolves: rhbz#1210449 + +* Mon Apr 13 2015 David Shea - 20-4 +- Do not remove the weak-updates directory + Resolves: rhbz#1124352 + +* Thu Apr 2 2015 David Shea - 20-3 +- Require kmod-libs instead of kmod from kmod-devel + Related: rhbz#1199646 + +* Thu Apr 2 2015 David Shea - 20-2 +- Remove the explicit requirement on kmod-libs + Related: rhbz#1199646 + +* Wed Mar 11 2015 David Shea - 20-1 +- Rebase to kmod-20 + Resolves: rhbz#1199646 + * Tue Jan 14 2015 David Shea - 14-10 - Allow module paths to start with /usr Resolves: rhbz#1177266