From d19fc94d1484c3c8e3af591007469b58313eff58 Mon Sep 17 00:00:00 2001 From: Rafal Stefanowski Date: Thu, 24 Mar 2022 12:18:40 +0100 Subject: [PATCH] Improve package creation - ddiskit related modifications - fix for resolving weak-modules symlinks Signed-off-by: Rafal Stefanowski --- modules/Makefile | 3 ++- .../pckgen.d/deb/debian/CAS_NAME-modules.dkms | 4 ++-- tools/pckgen.d/rpm/CAS_NAME.spec | 20 +++++++++++-------- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/modules/Makefile b/modules/Makefile index 2986831..e3d42d8 100644 --- a/modules/Makefile +++ b/modules/Makefile @@ -26,7 +26,7 @@ OCFDIR=$(PWD)/../ocf PWD=$(shell pwd) KERNEL_VERSION ?= "$(shell uname -r)" KERNEL_DIR ?= "/lib/modules/$(KERNEL_VERSION)/build" -MODULES_DIR=/lib/modules/$(shell uname -r)/extra +MODULES_DIR=/lib/modules/$(KERNEL_VERSION)/extra/block/opencas DISK_MODULE = cas_disk CACHE_MODULE = cas_cache @@ -68,6 +68,7 @@ uninstall: $(call remove-file,$(DESTDIR)$(MODULES_DIR)/$(CACHE_MODULE).ko) $(call remove-file,$(DESTDIR)$(MODULES_DIR)/$(DISK_MODULE).ko) + $(call remove-directory,$(DESTDIR)$(MODULES_DIR)) @$(DEPMOD) diff --git a/tools/pckgen.d/deb/debian/CAS_NAME-modules.dkms b/tools/pckgen.d/deb/debian/CAS_NAME-modules.dkms index f588239..4862cb7 100644 --- a/tools/pckgen.d/deb/debian/CAS_NAME-modules.dkms +++ b/tools/pckgen.d/deb/debian/CAS_NAME-modules.dkms @@ -4,8 +4,8 @@ BUILT_MODULE_NAME[0]="cas_disk" BUILT_MODULE_NAME[1]="cas_cache" BUILT_MODULE_LOCATION[0]="modules/cas_disk/" BUILT_MODULE_LOCATION[1]="modules/cas_cache/" -DEST_MODULE_LOCATION[0]="/extra" -DEST_MODULE_LOCATION[1]="/extra" +DEST_MODULE_LOCATION[0]="/extra/block/opencas" +DEST_MODULE_LOCATION[1]="/extra/block/opencas" PRE_BUILD="./configure" MAKE[0]="make -j -C modules/ KERNEL_VERSION=$kernelver" AUTOINSTALL=yes diff --git a/tools/pckgen.d/rpm/CAS_NAME.spec b/tools/pckgen.d/rpm/CAS_NAME.spec index b80c45c..c23f70d 100644 --- a/tools/pckgen.d/rpm/CAS_NAME.spec +++ b/tools/pckgen.d/rpm/CAS_NAME.spec @@ -1,5 +1,5 @@ # -# Copyright(c) 2020-2021 Intel Corporation +# Copyright(c) 2020-2022 Intel Corporation # SPDX-License-Identifier: BSD-3-Clause # @@ -108,7 +108,8 @@ if [ $1 -eq 0 ]; then . /etc/os-release if [[ ! "$ID_LIKE" =~ suse|sles ]]; then # Search for all CAS modules to remove them from weak-modules - find /lib/modules/*/extra/ -name "cas_*.ko" >/var/run/rpm-open-cas-linux-modules + # Use realpath to resolve any possible symlinks (needed for weak-modules) + realpath $(find /lib/modules/*/extra/block/opencas/ -name "cas_*.ko") >/var/run/rpm-open-cas-linux-modules fi fi @@ -116,8 +117,7 @@ fi if [ $1 -eq 0 ]; then . /etc/os-release if [[ ! "$ID_LIKE" =~ suse|sles ]]; then - # realpath to resolve any possible symlinks (needed for weak-modules) - modules=( $(realpath $(cat /var/run/rpm-open-cas-linux-modules)) ) + modules=( $(cat /var/run/rpm-open-cas-linux-modules) ) rm -f /var/run/rpm-open-cas-linux-modules printf "%s\n" "${modules[@]}" | weak-modules --no-initramfs --remove-modules fi @@ -126,7 +126,7 @@ fi %files -%defattr(-, root, root) +%defattr(-, root, root, 755) %license LICENSE %doc README.md %dir /etc/opencas/ @@ -155,12 +155,16 @@ fi %ghost /lib/opencas/__pycache__ %files modules_%{kver_filename} -%defattr(-, root, root) -/lib/modules/%{kver}/extra/cas_cache.ko -/lib/modules/%{kver}/extra/cas_disk.ko +%defattr(644, root, root, 755) +%license LICENSE +/lib/modules/%{kver} %changelog +* Mon Mar 21 2022 Rafal Stefanowski - 22.03-1 +- Update modules destination directory and permissions +- Add license to modules package +- Fix resolving of weak-modules symlinks * Mon Nov 22 2021 Michal Mielewczyk - 21.06-1 - Update dependencies * Mon Feb 8 2021 Rafal Stefanowski - 21.03-1