diff --git a/0001-Module-replace-the-module-with-new-module.patch b/0001-Module-replace-the-module-with-new-module.patch index d35c21350282a0e5e9231074319fe046f38da84f..a1a75d95c474777b970d40609b2573efcbc55125 100644 --- a/0001-Module-replace-the-module-with-new-module.patch +++ b/0001-Module-replace-the-module-with-new-module.patch @@ -1,6 +1,6 @@ -From 0eac0869e201a08170cb2255b623eab9d78072f8 Mon Sep 17 00:00:00 2001 +From 07f9e62e5239c678f0a341315490fb9c3015da03 Mon Sep 17 00:00:00 2001 From: Jason Luan -Date: Wed, 16 Sep 2020 01:21:50 +0000 +Date: Mon, 3 Mar 2025 13:10:30 +0800 Subject: [PATCH 1/2] Module: replace the module with new module Signed-off-by: fu.lin @@ -12,88 +12,92 @@ Signed-off-by: fu.lin 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c -index 12d8ed1..fd9861a 100644 +index 0d74100..e72717f 100644 --- a/libkmod/libkmod-module.c +++ b/libkmod/libkmod-module.c -@@ -911,8 +911,11 @@ KMOD_EXPORT int kmod_module_insert_module(struct kmod_module *mod, - kernel_flags |= MODULE_INIT_IGNORE_VERMAGIC; - if (flags & KMOD_INSERT_FORCE_MODVERSION) - kernel_flags |= MODULE_INIT_IGNORE_MODVERSIONS; -+ if (flags & KMOD_INSERT_REPLACE) -+ kernel_flags |= MODULE_REPLACE_MODULE; +@@ -638,8 +638,11 @@ static int do_finit_module(struct kmod_module *mod, unsigned int flags, const ch + kernel_flags |= MODULE_INIT_IGNORE_VERMAGIC; + if (flags & KMOD_INSERT_FORCE_MODVERSION) + kernel_flags |= MODULE_INIT_IGNORE_MODVERSIONS; ++ if (flags & KMOD_INSERT_REPLACE) ++ kernel_flags |= MODULE_REPLACE_MODULE; - err = finit_module(kmod_file_get_fd(mod->file), args, kernel_flags); + err = finit_module(kmod_file_get_fd(mod->file), args, kernel_flags); + - if (err == 0 || errno != ENOSYS) - goto init_finished; - } + if (err < 0) + err = -errno; + diff --git a/libkmod/libkmod.h b/libkmod/libkmod.h -index 7251aa7..a56e5b4 100644 +index 1c0d118..9c5d3e2 100644 --- a/libkmod/libkmod.h +++ b/libkmod/libkmod.h -@@ -153,6 +153,9 @@ enum kmod_remove { +@@ -709,6 +709,9 @@ int kmod_module_unref_list(struct kmod_list *list); enum kmod_insert { KMOD_INSERT_FORCE_VERMAGIC = 0x1, KMOD_INSERT_FORCE_MODVERSION = 0x2, + -+ /* custom flag */ ++ /* custom flag */ + KMOD_INSERT_REPLACE = 0x1000, }; - /* Flags to kmod_module_probe_insert_module() */ -@@ -164,6 +167,9 @@ enum kmod_probe { - KMOD_PROBE_DRY_RUN = 0x00010, - KMOD_PROBE_FAIL_ON_LOADED = 0x00020, + /** +@@ -760,6 +763,9 @@ enum kmod_probe { + KMOD_PROBE_DRY_RUN = 0x00010, + KMOD_PROBE_FAIL_ON_LOADED = 0x00020, + /* custom flag */ -+ KMOD_PROBE_REPLACE = 0x01000, ++ KMOD_PROBE_REPLACE = 0x01000, + /* codes below can be used in return value, too */ - KMOD_PROBE_APPLY_BLACKLIST_ALL = 0x10000, - KMOD_PROBE_APPLY_BLACKLIST = 0x20000, + KMOD_PROBE_APPLY_BLACKLIST_ALL = 0x10000, + KMOD_PROBE_APPLY_BLACKLIST = 0x20000, diff --git a/shared/missing.h b/shared/missing.h -index 4c0d136..4d2253b 100644 +index 53b766e..bd7fe34 100644 --- a/shared/missing.h +++ b/shared/missing.h @@ -15,6 +15,13 @@ - # define MODULE_INIT_IGNORE_VERMAGIC 2 - #endif + #define MODULE_INIT_IGNORE_VERMAGIC 2 + #define MODULE_INIT_COMPRESSED_FILE 4 +#ifndef MODULE_REPLACE_MODULE +# define MODULE_REPLACE_MODULE 0x1000 +#else +_Static_assert(MODULE_REPLACE_MODULE == 0x1000, -+ "MODULE_REPLACE_MODULE != 0x1000, change `KMOD_INSERT_REPLACE` and `KMOD_PROBE_REPLACE` defination"); ++ "MODULE_REPLACE_MODULE != 0x1000, change `KMOD_INSERT_REPLACE` and `KMOD_PROBE_REPLACE` defination"); +#endif + #ifndef __NR_finit_module - # define __NR_finit_module -1 - #endif + #warning __NR_finit_module missing - kmod might not work correctly + #define __NR_finit_module -1 diff --git a/tools/insmod.c b/tools/insmod.c -index c422971..f0be196 100644 +index fef0072..687e155 100644 --- a/tools/insmod.c +++ b/tools/insmod.c -@@ -29,9 +29,10 @@ +@@ -16,13 +16,14 @@ #include "kmod.h" --static const char cmdopts_s[] = "psfVh"; -+static const char cmdopts_s[] = "psfVrh"; +-static const char cmdopts_s[] = "fsvVh"; ++static const char cmdopts_s[] = "fsvVrh"; static const struct option cmdopts[] = { - {"version", no_argument, 0, 'V'}, + // clang-format off + { "force", no_argument, 0, 'f' }, + { "syslog", no_argument, 0, 's' }, + { "verbose", no_argument, 0, 'v' }, + { "version", no_argument, 0, 'V' }, + {"replace", no_argument, 0, 'r'}, - {"help", no_argument, 0, 'h'}, - {NULL, 0, 0, 0} - }; -@@ -42,6 +43,7 @@ static void help(void) - "\t%s [options] filename [args]\n" - "Options:\n" - "\t-V, --version show version\n" -+ "\t-r, --replace replace module\n" - "\t-h, --help show this help\n", - program_invocation_short_name); + { "help", no_argument, 0, 'h' }, + { NULL, 0, 0, 0 }, + // clang-format on +@@ -38,6 +39,7 @@ static void help(void) + "\t-s, --syslog print to syslog, not stderr\n" + "\t-v, --verbose enables more messages\n" + "\t-V, --version show version\n" ++ "\t-r, --replace replace module\n" + "\t-h, --help show this help\n", + program_invocation_short_name); } -@@ -90,6 +92,9 @@ static int do_insmod(int argc, char *argv[]) +@@ -85,6 +87,9 @@ static int do_insmod(int argc, char *argv[]) case 'h': help(); return EXIT_SUCCESS; @@ -101,8 +105,8 @@ index c422971..f0be196 100644 + flags |= KMOD_INSERT_REPLACE; + break; case 'V': - puts(PACKAGE " version " VERSION); - puts(KMOD_FEATURES); + kmod_version(); + return EXIT_SUCCESS; -- -2.35.1 +2.43.5 diff --git a/0002-Module-suspend-the-module-by-rmmod-r-option.patch b/0002-Module-suspend-the-module-by-rmmod-r-option.patch index d84410e0ff046dd3c86a74fc92b019e058ba2dea..f8ca061ecf6f0f2f2443de8a3d2d167131d7f72a 100644 --- a/0002-Module-suspend-the-module-by-rmmod-r-option.patch +++ b/0002-Module-suspend-the-module-by-rmmod-r-option.patch @@ -1,6 +1,6 @@ -From 3466b9698c4372ec81ed71384e1845898b7044d0 Mon Sep 17 00:00:00 2001 +From 34df0e7e2b8cdfb53cae2038944ddbaf281edd1c Mon Sep 17 00:00:00 2001 From: Ruidong Cao -Date: Fri, 25 Sep 2020 03:00:25 -0400 +Date: Mon, 3 Mar 2025 13:15:40 +0800 Subject: [PATCH 2/2] Module: suspend the module by rmmod r option Signed-off-by: Ruidong Cao @@ -13,10 +13,10 @@ Signed-off-by: fu.lin 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c -index fd9861a..96f462a 100644 +index e72717f..d9ddb99 100644 --- a/libkmod/libkmod-module.c +++ b/libkmod/libkmod-module.c -@@ -846,7 +846,7 @@ KMOD_EXPORT int kmod_module_remove_module(struct kmod_module *mod, +@@ -598,7 +598,7 @@ KMOD_EXPORT int kmod_module_remove_module(struct kmod_module *mod, unsigned int return -ENOENT; /* Filter out other flags and force ONONBLOCK */ @@ -26,57 +26,58 @@ index fd9861a..96f462a 100644 err = delete_module(mod->name, flags); diff --git a/libkmod/libkmod.h b/libkmod/libkmod.h -index a56e5b4..78d11b3 100644 +index 9c5d3e2..4a4e0d0 100644 --- a/libkmod/libkmod.h +++ b/libkmod/libkmod.h -@@ -147,6 +147,9 @@ enum kmod_remove { - KMOD_REMOVE_NOWAIT = O_NONBLOCK, /* always set */ - /* libkmod-only defines, not passed to kernel */ +@@ -819,6 +819,9 @@ enum kmod_remove { + KMOD_REMOVE_FORCE = O_TRUNC, + KMOD_REMOVE_NOWAIT = O_NONBLOCK, KMOD_REMOVE_NOLOG = 1, + + /* custom flag */ + KMOD_REMOVE_REPLACE = 0x1000, }; - /* Insertion flags */ + /** diff --git a/shared/missing.h b/shared/missing.h -index 4d2253b..19fb36f 100644 +index bd7fe34..826dcaf 100644 --- a/shared/missing.h +++ b/shared/missing.h @@ -19,7 +19,7 @@ # define MODULE_REPLACE_MODULE 0x1000 #else _Static_assert(MODULE_REPLACE_MODULE == 0x1000, -- "MODULE_REPLACE_MODULE != 0x1000, change `KMOD_INSERT_REPLACE` and `KMOD_PROBE_REPLACE` defination"); -+ "MODULE_REPLACE_MODULE != 0x1000, change `KMOD_INSERT_REPLACE`, `KMOD_REMOVE_REPLACE` and `KMOD_PROBE_REPLACE` defination"); +- "MODULE_REPLACE_MODULE != 0x1000, change `KMOD_INSERT_REPLACE` and `KMOD_PROBE_REPLACE` defination"); ++ "MODULE_REPLACE_MODULE != 0x1000, change `KMOD_INSERT_REPLACE`, `KMOD_REMOVE_REPLACE` and `KMOD_PROBE_REPLACE` defination"); #endif #ifndef __NR_finit_module diff --git a/tools/rmmod.c b/tools/rmmod.c -index 3942e7b..1278234 100644 +index 962d850..0907dea 100644 --- a/tools/rmmod.c +++ b/tools/rmmod.c -@@ -36,9 +36,10 @@ - static int verbose = DEFAULT_VERBOSE; - static int use_syslog; +@@ -20,10 +20,11 @@ --static const char cmdopts_s[] = "fsvVwh"; -+static const char cmdopts_s[] = "frsvVwh"; + #include "kmod.h" + +-static const char cmdopts_s[] = "fsvVh"; ++static const char cmdopts_s[] = "frsvVh"; static const struct option cmdopts[] = { - {"force", no_argument, 0, 'f'}, + // clang-format off + { "force", no_argument, 0, 'f' }, + {"replace", no_argument, 0, 'r'}, - {"syslog", no_argument, 0, 's'}, - {"verbose", no_argument, 0, 'v'}, - {"version", no_argument, 0, 'V'}, -@@ -54,6 +55,7 @@ static void help(void) - "\t-f, --force forces a module unload and may crash your\n" - "\t machine. This requires Forced Module Removal\n" - "\t option in your kernel. DANGEROUS\n" -+ "\t-r, --replace replace module\n" - "\t-s, --syslog print to syslog, not stderr\n" - "\t-v, --verbose enables more messages\n" - "\t-V, --version show version\n" -@@ -120,6 +122,9 @@ static int do_rmmod(int argc, char *argv[]) + { "syslog", no_argument, 0, 's' }, + { "verbose", no_argument, 0, 'v' }, + { "version", no_argument, 0, 'V' }, +@@ -39,6 +40,7 @@ static void help(void) + "Options:\n" + "\t-f, --force DANGEROUS: forces a module unload and may\n" + "\t crash your machine\n" ++ "\t-r, --replace replace module\n" + "\t-s, --syslog print to syslog, not stderr\n" + "\t-v, --verbose enables more messages\n" + "\t-V, --version show version\n" +@@ -103,6 +105,9 @@ static int do_rmmod(int argc, char *argv[]) case 'f': flags |= KMOD_REMOVE_FORCE; break; @@ -84,8 +85,8 @@ index 3942e7b..1278234 100644 + flags |= KMOD_REMOVE_REPLACE; + break; case 's': - use_syslog = 1; + use_syslog = true; break; -- -2.35.1 +2.43.5 diff --git a/0003-clear-file-memory-if-map-fails.patch b/0003-clear-file-memory-if-map-fails.patch deleted file mode 100644 index fcf1b400413c3f4bc686a1211e95f669c5c43dec..0000000000000000000000000000000000000000 --- a/0003-clear-file-memory-if-map-fails.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 90b271fbd2b9708a8fa79b7e98d90c7919e7ed73 Mon Sep 17 00:00:00 2001 -From: Emil Velikov -Date: Mon, 12 Feb 2024 17:23:05 +0000 -Subject: libkmod: clear file->memory if map fails - -On mmap failure file->memory is set to -1, which we'll happily pass down -to munmap later on. - -More importantly, since we do a NULL check in kmod_file_load_contents() -we will exit the function without (re)attempting the load again. - -Since we ignore the return code for the load function(s), one can end up -calling kmod_elf_get_memory() and feed that -1 into init_module. - -Signed-off-by: Emil Velikov -Reviewed-by: Lucas De Marchi -Signed-off-by: Lucas De Marchi ---- - libkmod/libkmod-file.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/libkmod/libkmod-file.c b/libkmod/libkmod-file.c -index b6a8cc9..1e1dd35 100644 ---- a/libkmod/libkmod-file.c -+++ b/libkmod/libkmod-file.c -@@ -401,8 +401,10 @@ static int load_reg(struct kmod_file *file) - file->size = st.st_size; - file->memory = mmap(NULL, file->size, PROT_READ, MAP_PRIVATE, - file->fd, 0); -- if (file->memory == MAP_FAILED) -+ if (file->memory == MAP_FAILED) { -+ file->memory = NULL; - return -errno; -+ } - file->direct = true; - return 0; - } --- -2.27.0 - diff --git a/kmod-30.tar.xz b/kmod-30.tar.xz deleted file mode 100644 index 9a7932aa1e651c69f6913da502166671de454cdf..0000000000000000000000000000000000000000 Binary files a/kmod-30.tar.xz and /dev/null differ diff --git a/kmod-34.1.tar.xz b/kmod-34.1.tar.xz new file mode 100644 index 0000000000000000000000000000000000000000..22ceee310d46bea1675a2a44771a9b66c2d84cbb Binary files /dev/null and b/kmod-34.1.tar.xz differ diff --git a/kmod.changes b/kmod.changes index 894f12830ba9aa3a581e1b7302224fe1cf1e99f1..905e78c5e027af5356846854483d0319046ceca2 100644 --- a/kmod.changes +++ b/kmod.changes @@ -1,4 +1,8 @@ %changelog +* Thu Mar 6 2025 Funda Wang - 34-1 +- update to version 34.1 +- python binding removed in 32 + * Tue May 07 2024 guoqinglan - 30-3 - Reinitialize libtool to remove Rpath diff --git a/kmod.spec b/kmod.spec index b61184d50dacacdf8d8e1ffc6022c6d69f65613d..7d2679eb87dc189c35155270ef9a3c9b09a559a1 100644 --- a/kmod.spec +++ b/kmod.spec @@ -1,22 +1,20 @@ Name: kmod -Version: 30 -Release: 4 +Version: 34.1 +Release: 1 Summary: Kernel module management -# GPLv2+ is used by programs, LGPLv2+ is used for libraries. -License: GPLv2+ and LGPLv2+ -URL: http://git.kernel.org/?p=utils/kernel/kmod/kmod.git;a=summary +License: GPL-2.0-or-later +URL: https://git.kernel.org/?p=utils/kernel/kmod/kmod.git;a=summary Source0: https://www.kernel.org/pub/linux/utils/kernel/kmod/%{name}-%{version}.tar.xz Source1: weak-modules Source2: depmod.conf.dist Source3: kmod.changes -BuildRequires: gcc chrpath zlib-devel xz-devel libxslt openssl-devel libtool gtk-doc +BuildRequires: gcc chrpath zlib-devel xz-devel scdoc openssl-devel libtool gtk-doc Provides: module-init-tools = 4.0-1 Provides: /sbin/modprobe -Patch: 0001-Module-replace-the-module-with-new-module.patch -Patch: 0002-Module-suspend-the-module-by-rmmod-r-option.patch -Patch: 0003-clear-file-memory-if-map-fails.patch +Patch0001: 0001-Module-replace-the-module-with-new-module.patch +Patch0002: 0002-Module-suspend-the-module-by-rmmod-r-option.patch %description The kmod package provides several commands to manage the kernel modules, @@ -24,7 +22,7 @@ such as insmod to load and rmmod to unload the modules. %package libs Summary: Libraries to handle kernel module loading and unloading -License: LGPLv2+ +License: LGPL-2.1-or-later %description libs The kmod-libs package provides runtime libraries for any application that @@ -32,28 +30,15 @@ wishes to load or unload Linux kernel modules from the running system. %package devel Summary: Header files for kmod development -Requires: %{name} = %{version}-%{release} %{name}-libs +License: LGPL-2.1-or-later +Requires: %{name} = %{version}-%{release} +Requires: %{name}-libs = %{version}-%{release} %description devel The kmod-devel package provides header files used for loading or unloading kernel modules. -%package -n python3-kmod -Summary: Python3 bindings for kmod/libkmod. -BuildRequires: python3 python3-devel python3-Cython kmod-devel kmod-libs -Requires: python3 - -%description -n python3-kmod -python3-kmod is a Python3 wrapper module for libkmod, exposing common -module operations: listing installed modules, modprobe, and rmmod. - -%package help -Summary: Documents and man pages for the kmod -Requires: man info - -%description help -The kmod-help package provides several documents and the man pages to help -developers to understand the kmod. +%package_help %prep %autosetup -n %{name}-%{version} -p1 @@ -61,14 +46,14 @@ developers to understand the kmod. %build # Reinitialize libtool to remove Rpath autoreconf -vif -%configure --with-openssl --with-zlib --with-xz --enable-python +%configure --with-openssl --with-zlib --with-xz --with-fishcompletiondir=%{fish_completions_dir} %make_build %install %make_install -rm -f %{buildroot}%{python3_sitearch}/kmod/*.la +%delete_la pushd $RPM_BUILD_ROOT/%{_mandir}/man5 -ln -s modprobe.d.5.gz modprobe.conf.5.gz +ln -s modprobe.d.5 modprobe.conf.5 popd mkdir -p $RPM_BUILD_ROOT%{_sbindir} @@ -81,43 +66,36 @@ done mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/modprobe.d mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/modprobe.d -mkdir -p $RPM_BUILD_ROOT/sbin install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}/weak-modules install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d/dist.conf -%post -p /sbin/ldconfig - -%postun -p /sbin/ldconfig - %files -%exclude %{_libdir}/*.la - %dir %{_sysconfdir}/*.d %dir %{_prefix}/lib/modprobe.d -%{_bindir}/kmod +%{_bindir}/* %{_sbindir}/* -%{_datadir}/bash-completion/ +%{bash_completions_dir}/* +%{zsh_completions_dir}/* +%{fish_completions_dir}/* %{_sysconfdir}/depmod.d/dist.conf %files libs -%{!?_licensedir:%global license %%doc} %license COPYING %{_libdir}/libkmod.so.* %files devel %{_includedir}/libkmod.h %{_libdir}/pkgconfig/libkmod.pc +%{_datadir}/pkgconfig/kmod.pc %{_libdir}/libkmod.so -%files -n python3-kmod -%{python3_sitearch}/kmod/ - %files help %attr(0644,root,root) %{_mandir}/man5/*.5* %attr(0644,root,root) %{_mandir}/man8/*.8* -%doc TODO NEWS README.md +%doc NEWS README.md %include %{SOURCE3} + diff --git a/kmod.yaml b/kmod.yaml index 1ac209d4f112f47e69e0edd567c03cc271cf6bb3..eb87315ac393d1895d9ff0e3e8a62e976eae9a1e 100644 --- a/kmod.yaml +++ b/kmod.yaml @@ -1,5 +1,4 @@ version_control: git src_repo: https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git tag_prefix: ^v -seperator: - +separator: diff --git a/weak-modules b/weak-modules index dc7ce2be4ac8e2ac846218630d2dfea759d9e6b8..76523a7054172d75591b28a828c3ccc3de36ded5 100644 --- a/weak-modules +++ b/weak-modules @@ -63,10 +63,10 @@ rpmsort() { fi echo ${rpmlist[@]} | \ - awk '{print $1 ":" $1}' | \ - awk -F":" '{gsub(/([a-zA-Z])+/,"",$1);print}' | \ - sort ${REVERSE} -V | \ - awk -F" " '{print $NF}' + sed -e 's/-/../g' | \ + sort ${REVERSE} -n -t"." -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 -k6,6 -k7,7 \ + -k8,8 -k9,9 -k10,10 | \ + sed -e 's/\.\./-/g' } # krel_of_module: @@ -520,26 +520,31 @@ finish_sandbox() { # Auxiliary functions to find symvers file make_kernel_file_names() { local krel="$1" - local file="$2" - local suffix="$3" + shift + local file="$1" + shift - echo "${BASEDIR}/boot/${file}-${krel}${suffix}" - echo "${BASEDIR}/lib/modules/${krel}/${file}${suffix}" + for suffix in "$@"; do + echo "${BASEDIR}/boot/${file}-${krel}${suffix}" + echo "${BASEDIR}/lib/modules/${krel}/${file}${suffix}" + done } find_kernel_file() { local krel="$1" - local file="$2" - local suffix="$3" - local print="$4" + shift + local file="$1" + shift + local print="$1" + shift local i if [[ "$print" != "" ]]; then - make_kernel_file_names "$krel" "$file" "$suffix" + make_kernel_file_names "$krel" "$file" "$@" return 0 fi - for i in $(make_kernel_file_names "$krel" "$file" "$suffix"); do + for i in $(make_kernel_file_names "$krel" "$file" "$@"); do if [[ -r "$i" ]]; then echo "$i" return 0 @@ -563,7 +568,7 @@ find_symvers_file() { local krel="$1" local print="$2" - find_kernel_file "$krel" symvers .gz "$print" + find_kernel_file "$krel" symvers "$print" .xz .gz } # find_systemmap_file: @@ -573,7 +578,7 @@ find_systemmap_file() { local print="$2" local no_suffix="" - find_kernel_file "$krel" System.map "$no_suffix" "$print" + find_kernel_file "$krel" System.map "$print" "$no_suffix" } #### Main logic @@ -753,6 +758,7 @@ validate_weak_links() { # to return to caller that original proposal is not valid # here 0 is true, 1 is false, since it will be the return code local is_configuration_valid=0 + local cat_prog tmp=$(mktemp -p $tmpdir) compatible_modules=() @@ -761,7 +767,12 @@ validate_weak_links() { local symvers_path=$(find_symvers_file "$krel") [[ -n "$symvers_path" ]] || return - zcat "$symvers_path" > $tmpdir/symvers-$krel + cat_prog="cat" + case "$symvers" in + *.gz) cat_prog="zcat" ;; + *.xz) cat_prog="xzcat" ;; + esac + "$cat_prog" "$symvers_path" > $tmpdir/symvers-$krel fi while ((is_updates_changed)); do @@ -935,7 +946,7 @@ do_make_groups() declare -a mods while read i; do - read -a mods <<< "$i" + read -a mods <<< "$i" echo "${mods[0]}" |grep -q "extra/" || continue @@ -985,7 +996,7 @@ filter_extra_absoluted() while read i; do # skip non-extra. The check is not perfect, but ok # to speed up handling in general cases - echo "$i" |grep -q "^extra/" || continue + echo "$i" |grep -q "extra/" || continue read -a mods <<< "$i" for j in "${!mods[@]}"; do @@ -1078,9 +1089,7 @@ remove_kernel() { module_has_changed $weak_modules $remove_krel # Remove everything beneath the weak-updates directory - if [ -d "$weak_modules" ]; then - ( cd "$weak_modules" && doit rm -rf * ) - fi + ( cd "$weak_modules" && doit rm -rf * ) } ################################################################################