From 91c9bcca43961bd7fda81b6a8b70b3a5ef94b211ce7117a4bb40cba34a8f2abc Mon Sep 17 00:00:00 2001 From: Martin Wilck Date: Fri, 2 Jul 2021 09:37:20 +0000 Subject: [PATCH] Accepting request 903661 from home:mwilck:suse-module-tools Remove set_version service, which conflicted with extract_file and messed up the spec file. OBS-URL: https://build.opensuse.org/request/show/903661 OBS-URL: https://build.opensuse.org/package/show/Base:System/suse-module-tools?expand=0&rev=118 --- _service | 1 - suse-module-tools-16.0.4.obscpio | 3 - suse-module-tools.spec | 200 +++++++++++-------------------- 3 files changed, 69 insertions(+), 135 deletions(-) delete mode 100644 suse-module-tools-16.0.4.obscpio diff --git a/_service b/_service index b7c9485..9e596b3 100644 --- a/_service +++ b/_service @@ -15,7 +15,6 @@ */suse-module-tools.spec suse-module-tools.spec - *.tar diff --git a/suse-module-tools-16.0.4.obscpio b/suse-module-tools-16.0.4.obscpio deleted file mode 100644 index dd18c7f..0000000 --- a/suse-module-tools-16.0.4.obscpio +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a4186329fde129bd7de4ad88612e7eb4c62a8f8b18486f6058b46448b59222dc -size 93707 diff --git a/suse-module-tools.spec b/suse-module-tools.spec index 95834ec..c02e2d7 100644 --- a/suse-module-tools.spec +++ b/suse-module-tools.spec @@ -15,17 +15,27 @@ # Please submit bugfixes or comments via https://bugs.opensuse.org/ # +# missing in SLE15 (systemd-rpm-macros) +%{!?_modulesloaddir: %global _modulesloaddir /usr/lib/modules-load.d} -# Define _rpmmacrodir if it's not defined yet -%{!?_rpmmacrodir: %global _rpmmacrodir %{_rpmconfigdir}/macros.d} -%define modules_load_dir /usr/lib/modules-load.d +# Location for modprobe and depmod .conf files +# +# This assumes post-usr-merge (20210527) for Tumbleweed +%if 0%{?suse_version} >= 1550 +%global modprobe_dir /usr/lib/modprobe.d +%global depmod_dir /usr/lib/depmod.d +%else +%global modprobe_dir /lib/modprobe.d +%global depmod_dir /lib/depmod.d +%endif # List of legacy file systems to be blacklisted by default %global fs_blacklist adfs affs bfs befs cramfs efs erofs exofs freevxfs hfs hpfs jfs minix nilfs2 ntfs omfs qnx4 qnx6 sysv ufs -%if 0%{?sle_version} >= 120200 && 0%{?sle_version} < 150000 -%global softdep_br_netfilter 1 -%endif +# List of all files installed under modprobe.d +# Note: this list contains files installed by previous versions, like 00-system-937216.conf! +%global modprobe_conf_files 00-system 00-system-937216 10-unsupported-modules 50-blacklist 60-blacklist_fs-* 99-local +%global modprobe_conf_rpmsave %(echo "%{modprobe_conf_files}" | sed 's,\\([^ ]*\\),%{_sysconfdir}/modprobe.d/\\1.conf.rpmsave,g') Name: suse-module-tools Version: 16.0.5 @@ -41,6 +51,7 @@ Requires: /usr/bin/gzip Requires: /usr/bin/sed Requires: coreutils Requires: findutils +Requires: systemd-rpm-macros Requires: rpm Requires(post): /usr/bin/grep Requires(post): /usr/bin/sed @@ -52,6 +63,10 @@ Recommends: dracut Recommends: kmod # This release requires the dracut module 90nvdimm Conflicts: dracut < 49.1 +# TW: conflict with pre-usrmerge +%if 0%{?suse_version} >= 1550 +Conflicts: filesystem < 15.5-40.2 +%endif %description This package contains helper scripts for KMP installation and @@ -76,6 +91,7 @@ SLE 11 and later. It is still used by the DKMS module packaging framework. %setup -q %build +sed -i 's/@FS_BLACKLIST@.*/%{fs_blacklist}/' README.md %install # now assemble the parts for modprobe.conf @@ -86,27 +102,23 @@ ln -f modprobe.conf/modprobe.conf.ppc64 modprobe.conf/modprobe.conf.$RPM_ARCH if [ -f "modprobe.conf/modprobe.conf.$RPM_ARCH" ]; then cat "modprobe.conf/modprobe.conf.$RPM_ARCH" >>00-system.conf fi +install -d -m 755 "%{buildroot}%{modprobe_dir}" install -d -m 755 "%{buildroot}%{_sysconfdir}/modprobe.d" install -pm644 "10-unsupported-modules.conf" \ - "%{buildroot}%{_sysconfdir}/modprobe.d/" -install -pm644 00-system.conf "%{buildroot}%{_sysconfdir}/modprobe.d/" + "%{buildroot}%{modprobe_dir}/" +install -pm644 00-system.conf "%{buildroot}%{modprobe_dir}/" -%if 0%{?softdep_br_netfilter} -# softdep bridge->br_netfilter, SLE only -install -pm644 modprobe.conf/00-system-937216.conf %{buildroot}%{_sysconfdir}/modprobe.d -%endif %if 0%{?suse_version} >= 1550 || 0%{?sle_version} >= 150100 -install -pm644 modprobe.conf/modprobe.conf.blacklist "%{buildroot}%{_sysconfdir}/modprobe.d/50-blacklist.conf" +install -pm644 modprobe.conf/modprobe.conf.blacklist "%{buildroot}%{modprobe_dir}/50-blacklist.conf" %endif -install -pm644 modprobe.conf/modprobe.conf.local "%{buildroot}%{_sysconfdir}/modprobe.d/99-local.conf" +install -d -m 755 "%{buildroot}/%{depmod_dir}" install -d -m 755 "%{buildroot}%{_sysconfdir}/depmod.d" -install -pm 644 "depmod-00-system.conf" \ - "%{buildroot}%{_sysconfdir}/depmod.d/00-system.conf" +install -pm 644 "depmod-00-system.conf" "%{buildroot}%{depmod_dir}/00-system.conf" # "/usr/lib/module-init-tools" name hardcoded in KMPs, mkinitrd, etc. install -d -m 755 "%{buildroot}/usr/lib/module-init-tools" -install -pm 755 weak-modules{,2} "%{buildroot}/usr/lib/module-init-tools/" -install -pm 755 driver-check.sh "%{buildroot}/usr/lib/module-init-tools/" +install -pm 755 -t "%{buildroot}/usr/lib/module-init-tools/" \ + weak-modules{,2} driver-check.sh unblacklist lsinitrd-quick %if 0%{?suse_version} < 1550 # rpm macros and helper @@ -126,8 +138,8 @@ install -pm 644 50-kernel-uname_r.conf "%{buildroot}%{_unitdir}/systemd-sysctl.s # Ensure that the sg driver is loaded early (bsc#1036463) # Not needed in SLE11, where sg is loaded via udev rule. -install -d -m 755 "%{buildroot}%{modules_load_dir}" -install -pm 644 sg.conf "%{buildroot}%{modules_load_dir}" +install -d -m 755 "%{buildroot}%{_modulesloaddir}" +install -pm 644 sg.conf "%{buildroot}%{_modulesloaddir}" %ifarch ppc64 ppc64le install -d -m 755 %{buildroot}/usr/lib/systemd/system-generators install -m 755 udev-trigger-generator %{buildroot}/usr/lib/systemd/system-generators @@ -138,131 +150,58 @@ mkdir -p %{buildroot}%{_defaultlicensedir} %if 0%{?suse_version} >= 1550 || 0%{?sle_version} >= 150100 for mod in %{fs_blacklist}; do echo "\ +# DO NOT EDIT THIS FILE! +# # The $mod file system is blacklisted by default because it isn't actively # supported by SUSE, not well maintained, or may have security vulnerabilites. -# To enable autoloading the $mod file system module, comment out the -# \"blacklist $mod\" statement below. ENABLE AT YOUR OWN RISK. -# -# File system modules loaded at installation time of the %{name} package -# are not blacklisted. This is achieved by commenting out the blacklist -# line in the post-installation script. To prevent the post-installation -# script from modifying this file, delete the line containing \"THIS FILE MAY -# BE MODIFIED\" at the bottom. blacklist $mod -# __THIS FILE MAY BE MODIFIED__" \ - >%{buildroot}%{_sysconfdir}/modprobe.d/60-blacklist_fs-"$mod".conf +# The filesystem can be un-blacklisted by running \"modprobe $mod\". +# See README.md in the %{name} package for details. +install $mod /usr/lib/module-init-tools/unblacklist $mod; /sbin/modprobe --ignore-install $mod +" \ + >%{buildroot}%{modprobe_dir}/60-blacklist_fs-"$mod".conf done %endif %post -%if 0%{?sle_version} >= 150000 -# Delete obsolete unsupported-modules file from SLE11 -rm -f %{_sysconfdir}/modprobe.d/unsupported-modules -%else -# Logic for releases below CODE 15 -%if 0%{?is_opensuse} == 1 -allowed=1 -%else -allowed=0 -%endif -test_allow_on_install() -{ - # configure handling of unsupported modules - # default is to allow them - allow=1 - # if the obsolete LOAD_UNSUPPORTED_MODULES_AUTOMATICALLY variable is - # set to no, don't allow (this was used in SLES 9 and 10) - if test -e %{_sysconfdir}/sysconfig/hardware/config; then - . %{_sysconfdir}/sysconfig/hardware/config - if test "x$LOAD_UNSUPPORTED_MODULES_AUTOMATICALLY" = "xno"; then - allow=0 - fi - # obsolete - rm %{_sysconfdir}/sysconfig/hardware/config - fi - # don't change the setting during upgrade - if test "$1" != 1; then - allow= - return - fi - # on SLES, the default is not to allow unsupported modules - if grep -qs "Enterprise Server" %{_sysconfdir}/os-release; then - allow=0 - else - return - fi - # unless the admin passed "oem-modules=1" to the kernel during install - if grep -qs '\' /proc/cmdline; then - allow=1 - return - fi - # or if the installer already loaded some unsupported modules - # (see TAINT_NO_SUPPORT in /etc/src/linux/include/linux/kernel.h) - tainted=$(cat /proc/sys/kernel/tainted 2>/dev/null || echo 0) - if test $((tainted & (1<<30))) != 0; then - allow=1 - return - fi -} -# upgrade from old locations -if test -e %{_sysconfdir}/modprobe.d/unsupported-modules; then - mv -f %{_sysconfdir}/modprobe.d/unsupported-modules \ - %{_sysconfdir}/modprobe.d/10-unsupported-modules.conf -fi -test_allow_on_install "$@" -if test -n "$allow" -a "$allow" != "$allowed"; then - sed -ri 's/^( *allow_unsupported_modules *) [01]/\1 '"$allow"'/' \ - %{_sysconfdir}/modprobe.d/10-unsupported-modules.conf -fi -%endif +exit 0 -# upgrade from old locations -if test -e %{_sysconfdir}/modprobe.conf.local; then - mv -f %{_sysconfdir}/modprobe.conf.local \ - %{_sysconfdir}/modprobe.d/99-local.conf -fi - -# Avoid systems becoming unbootable by blacklisting filesystem -# modules. Modules loaded at installation time will not be -# blacklisted (the blacklist statement is commented out). -# config(noreplace) makes sure that this is not overwritten by rpm. -%if 0%{?suse_version} >= 1550 || 0%{?sle_version} >= 150100 -for mod in %{fs_blacklist}; do - conf=%{_sysconfdir}/modprobe.d/60-blacklist_fs-"$mod".conf - if [ -f "$conf" ] && \ - grep -q '^# __THIS FILE MAY BE MODIFIED__$' "$conf" && \ - sed '/^nodev/d;' /proc/filesystems | grep -q "\<$mod\>"; then - sed -i ' -/^# next line was commented out by postinstall script of %{name}$/d -/^blacklist '"$mod"'/{i\ -# next line was commented out by postinstall script of %{name} -s/^/# / -}' "$conf" - fi +%pre +# Avoid restoring old .rpmsave files in %posttrans +for f in %{modprobe_conf_rpmsave}; do + if [ -f ${f} ]; then + mv -f ${f} ${f}.%{name} + fi done -%endif +if [ -f %{_sysconfdir}/depmod.d/00-system.conf.rpmsave ]; then + mv -f %{_sysconfdir}/depmod.d/00-system.conf.rpmsave \ + %{_sysconfdir}/depmod.d/00-system.conf.rpmsave.%{name} +fi +exit 0 + +%posttrans +# If the user had modified any of the configuration files installed under +# /etc, they'll now be renamed to .rpmsave files. Restore them. +for f in %{modprobe_conf_rpmsave}; do + if [ -f ${f} ]; then + mv -fv ${f} ${f%.rpmsave} + fi +done +if [ -f %{_sysconfdir}/depmod.d/00-system.conf.rpmsave ]; then + mv -fv %{_sysconfdir}/depmod.d/00-system.conf.rpmsave \ + %{_sysconfdir}/depmod.d/00-system.conf +fi +exit 0 %files %defattr(-,root,root) -%if 0%{?sle_version:%{sle_version}}%{!?sle_version:150000} <= 120200 -%dir %{_defaultlicensedir} -%endif %license LICENSE -%doc README.SUSE +%doc README.md +%{modprobe_dir} %dir %{_sysconfdir}/modprobe.d -%config %{_sysconfdir}/modprobe.d/00-system.conf -%if 0%{?softdep_br_netfilter} -%config(noreplace) %{_sysconfdir}/modprobe.d/00-system-937216.conf -%endif -%config(noreplace) %{_sysconfdir}/modprobe.d/10-unsupported-modules.conf -%if 0%{?suse_version} >= 1550 || 0%{?sle_version} >= 150100 -%config(noreplace) %{_sysconfdir}/modprobe.d/50-blacklist.conf -%config(noreplace) %{_sysconfdir}/modprobe.d/60-blacklist_fs-*.conf -%endif -%config(noreplace) %{_sysconfdir}/modprobe.d/99-local.conf +%{depmod_dir} %dir %{_sysconfdir}/depmod.d -%config %{_sysconfdir}/depmod.d/00-system.conf %if 0%{?suse_version} < 1550 %{_rpmmacrodir}/macros.initrd %endif @@ -270,8 +209,7 @@ done /usr/lib/module-init-tools %exclude /usr/lib/module-init-tools/weak-modules %{_unitdir}/systemd-sysctl.service.d -%dir %{modules_load_dir} -%{modules_load_dir}/sg.conf +%{_modulesloaddir} %ifarch ppc64 ppc64le /usr/lib/systemd/system-generators %endif