diff --git a/tools/pckgen b/tools/pckgen index b8dc278..7446e9c 100755 --- a/tools/pckgen +++ b/tools/pckgen @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright(c) 2020-2021 Intel Corporation +# Copyright(c) 2020-2022 Intel Corporation # SPDX-License-Identifier: BSD-3-Clause # @@ -16,6 +16,7 @@ CAS_NAME="open-cas-linux" CAS_HOMEPAGE="https://open-cas.github.io" CAS_GIT="https://github.com/Open-CAS/open-cas-linux.git" CAS_LICENSE_NAME="BSD-3-Clause" +CAS_MODULES_DIR="extra/block/opencas" SUPPORTED_FROM_VERSION="20.03" THIS=$(basename "$0") ARCH="$(uname -i)" @@ -298,6 +299,7 @@ rpm_spec_prepare() { sed -i "s//$CAS_NAME/g" "$RPM_SPECS_DIR/$CAS_NAME.spec" sed -i "s//$CAS_VERSION/g" "$RPM_SPECS_DIR/$CAS_NAME.spec" sed -i "s//$CAS_LICENSE_NAME/g" "$RPM_SPECS_DIR/$CAS_NAME.spec" + sed -i "s||$CAS_MODULES_DIR|g" "$RPM_SPECS_DIR/$CAS_NAME.spec" sed -i "s//${CAS_HOMEPAGE//\//\\/}/g" "$RPM_SPECS_DIR/$CAS_NAME.spec" sed -i "s//$PACKAGE_MAINTAINER/g" "$RPM_SPECS_DIR/$CAS_NAME.spec" if [ "$DEBUG" ]; then @@ -341,6 +343,7 @@ deb_control_files_prepare() { sed -i "s//$CAS_NAME/g" "$file" sed -i "s//$CAS_VERSION/g" "$file" sed -i "s//$CAS_LICENSE_NAME/g" "$file" + sed -i "s||$CAS_MODULES_DIR|g" "$file" sed -i "s//${CAS_HOMEPAGE//\//\\/}/g" "$file" sed -i "s//${CAS_GIT//\//\\/}/g" "$file" sed -i "s//$PACKAGE_MAINTAINER/g" "$file" diff --git a/tools/pckgen.d/deb/debian/CAS_NAME-modules.dkms b/tools/pckgen.d/deb/debian/CAS_NAME-modules.dkms index 4862cb7..efdddfd 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/block/opencas" -DEST_MODULE_LOCATION[1]="/extra/block/opencas" +DEST_MODULE_LOCATION[0]="/" +DEST_MODULE_LOCATION[1]="/" 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 c23f70d..43fc2b8 100644 --- a/tools/pckgen.d/rpm/CAS_NAME.spec +++ b/tools/pckgen.d/rpm/CAS_NAME.spec @@ -24,7 +24,7 @@ Group: System Vendor: Intel Corporation License: URL: -Source0: https://github.com/Open-CAS/open-cas-linux/releases/download/v%{version}/%{name}-%{version}.tar.gz +Source0: https://github.com/Open-CAS//releases/download/v%{version}/%{name}-%{version}.tar.gz Packager: BuildRequires: coreutils, gawk, gcc, kernel-devel, kernel-headers, make Requires: -modules-%{version}, python3, sed, python3-packaging, python3-PyYAML @@ -88,7 +88,7 @@ depmod . /etc/os-release # Determine the exact location of installed modules to add them to weak-modules for file in $(rpm -ql $(rpm -qa | grep -modules)); do -if [[ "$file" =~ cas_.*\.ko$ ]]; then +if [[ "$file" =~ .*\.ko$ ]]; then # realpath to resolve any possible symlinks (needed for weak-modules) modules+=( $(realpath "$file") ) fi @@ -109,7 +109,7 @@ if [ $1 -eq 0 ]; then if [[ ! "$ID_LIKE" =~ suse|sles ]]; then # Search for all CAS modules to remove them from weak-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 + realpath $(find /lib/modules/%{kver}/ -name "*.ko") >/var/run/rpm--modules fi fi @@ -117,8 +117,8 @@ fi if [ $1 -eq 0 ]; then . /etc/os-release if [[ ! "$ID_LIKE" =~ suse|sles ]]; then - modules=( $(cat /var/run/rpm-open-cas-linux-modules) ) - rm -f /var/run/rpm-open-cas-linux-modules + modules=( $(cat /var/run/rpm--modules) ) + rm -f /var/run/rpm--modules printf "%s\n" "${modules[@]}" | weak-modules --no-initramfs --remove-modules fi depmod