From bc5c92d3edebf0ed26633895468a332108df6996 Mon Sep 17 00:00:00 2001 From: Rafal Stefanowski Date: Mon, 14 Sep 2020 13:12:06 +0200 Subject: [PATCH 1/2] Fix typo in casctl manpage title line Signed-off-by: Rafal Stefanowski --- utils/casctl.8 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/casctl.8 b/utils/casctl.8 index 1ae4e6b..7806483 100644 --- a/utils/casctl.8 +++ b/utils/casctl.8 @@ -1,4 +1,4 @@ -.TH casctl.8 __CAS_DATE__ v__CAS_VERSION__ +.TH casctl 8 __CAS_DATE__ v__CAS_VERSION__ .SH NAME casctl \- whole-configuration-manager for Open CAS. From ef70bce15440e851f61bcac8f9dc06a24527d9ff Mon Sep 17 00:00:00 2001 From: Rafal Stefanowski Date: Mon, 14 Sep 2020 14:17:28 +0200 Subject: [PATCH 2/2] Update automatic package generator - add DEB package creation functionality - update RPM spec file to work with SLES Signed-off-by: Rafal Stefanowski --- Makefile | 10 + utils/pckgen | 180 ++++++++++++++++-- .../deb/debian/CAS_NAME-modules.install | 1 + utils/pckgen.d/deb/debian/CAS_NAME.docs | 1 + utils/pckgen.d/deb/debian/CAS_NAME.install | 8 + utils/pckgen.d/deb/debian/CAS_NAME.manpages | 3 + utils/pckgen.d/deb/debian/changelog | 11 ++ utils/pckgen.d/deb/debian/compat | 1 + utils/pckgen.d/deb/debian/control | 30 +++ utils/pckgen.d/deb/debian/copyright | 7 + utils/pckgen.d/deb/debian/rules | 21 ++ utils/pckgen.d/deb/debian/source/format | 1 + .../rpm/CAS_NAME.spec} | 59 +++--- 13 files changed, 291 insertions(+), 42 deletions(-) create mode 100644 utils/pckgen.d/deb/debian/CAS_NAME-modules.install create mode 100644 utils/pckgen.d/deb/debian/CAS_NAME.docs create mode 100644 utils/pckgen.d/deb/debian/CAS_NAME.install create mode 100644 utils/pckgen.d/deb/debian/CAS_NAME.manpages create mode 100644 utils/pckgen.d/deb/debian/changelog create mode 100644 utils/pckgen.d/deb/debian/compat create mode 100644 utils/pckgen.d/deb/debian/control create mode 100644 utils/pckgen.d/deb/debian/copyright create mode 100755 utils/pckgen.d/deb/debian/rules create mode 100644 utils/pckgen.d/deb/debian/source/format rename utils/{open-cas-linux.spec.base => pckgen.d/rpm/CAS_NAME.spec} (72%) diff --git a/Makefile b/Makefile index 156b55d..63ac67c 100644 --- a/Makefile +++ b/Makefile @@ -17,10 +17,14 @@ $(DIRS): ifneq ($(MAKECMDGOALS),archives) ifneq ($(MAKECMDGOALS),rpm) ifneq ($(MAKECMDGOALS),srpm) +ifneq ($(MAKECMDGOALS),deb) +ifneq ($(MAKECMDGOALS),dsc) cd $@ && $(MAKE) $(MAKECMDGOALS) endif endif endif +endif +endif archives: @utils/pckgen $(PWD) tar zip @@ -30,3 +34,9 @@ rpm: srpm: @utils/pckgen $(PWD) srpm --debug + +deb: + @utils/pckgen $(PWD) deb + +dsc: + @utils/pckgen $(PWD) dsc diff --git a/utils/pckgen b/utils/pckgen index a0ab241..909a79d 100755 --- a/utils/pckgen +++ b/utils/pckgen @@ -13,19 +13,27 @@ 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-Clear" SUPPORTED_FROM_VERSION="20.03" THIS=$(basename "$0") ARCH="$(uname -i)" SYS_INFO="/etc/os-release" SCRIPT_BASE_DIR=$(dirname $(realpath "$0")) -BASE_SPEC="$SCRIPT_BASE_DIR/$CAS_NAME.spec.base" +RPM_SPEC_FILE="$SCRIPT_BASE_DIR/$THIS.d/rpm/CAS_NAME.spec" +DEB_CONTROL_FILES_DIR="$SCRIPT_BASE_DIR/$THIS.d/deb/debian" +PACKAGE_MAINTAINER="Rafal Stefanowski " +PACKAGE_DATE="$(date -R)" TEMP_TEMPLATE="opencas-${THIS}" -DEPENDENCIES=(sed git mktemp rsync) +DEPENDENCIES=(git mktemp rsync sed) # Dependencies for particular packages creation: DEPENDENCIES_TAR=(tar) DEPENDENCIES_ZIP=(zip) -DEPENDENCIES_RPM=(tar rpmbuild) +DEPENDENCIES_RPM=(rpmbuild tar) DEPENDENCIES_SRPM=("${DEPENDENCIES_RPM[@]}") +DEPENDENCIES_DEB=(debuild dh fakeroot tar) +DEPENDENCIES_DSC=("${DEPENDENCIES_DEB[@]}") # List of relative submodule directories: SUBMODULES=( "ocf" @@ -57,7 +65,9 @@ print_help() { echo " tar generate tar archive" echo " zip generate zip archive" echo " rpm generate RPM packages" - echo " srpm generate SRPM package" + echo " srpm generate SRPM (source RPM) package" + echo " deb generate DEB packages" + echo " dsc generate DSC (source DEB) package" echo echo "Options:" echo " -o, --output-dir put all created files in the given directory;" @@ -171,16 +181,34 @@ create_temp() { fi } +rename_templates() { + # Due to inconsistent ordering in 'find' output, it is necessary to + # rerun files renaming in order to include files and subdirectories + # when both need to be renamed. To prevent infinite loops, rerun is not + # based on 'mv' command exit status, but on specified subdirectory depth. + # This mechanism seems to be much simpler then piping the output through + # various external utilities. + SUBDIR_DEPTH=3 + while [ $((SUBDIR_DEPTH--)) -gt 0 ]; do + for filename in $(find "$@"); do + if [[ "$filename" =~ CAS_NAME ]]; then + mv "$filename" "${filename//CAS_NAME/${CAS_NAME}}" 2>/dev/null + fi + done + done +} + archive_prepare() { if [ "$ARCHIVE_PREPARED" ]; then return 0 fi - echo "--- Copying sources to the working directory" + echo "--- Copying sources to the working directory and cleaning" local TEMP_SOURCES_DIR="$TEMP_DIR/$CAS_FILENAME" rm -rf "$TEMP_SOURCES_DIR" mkdir -p "$TEMP_SOURCES_DIR" rsync -a --exclude={/packages,.git*,.pep8speaks.yml} "$SOURCES_DIR/" "$TEMP_SOURCES_DIR" + make -C "$TEMP_SOURCES_DIR" clean distclean >/dev/null ARCHIVE_PREPARED="archive_prepared" } @@ -231,14 +259,42 @@ rpm_obtain_sources() { fi } -rpm_spec_prepare() { - echo "--- Preparing SPEC file" - if [ ! -f "$BASE_SPEC" ]; then - error "SPEC file '$BASE_SPEC' not found" +deb_obtain_sources() { + echo "--- Obtaining CAS sources for DEBs" + generate_tar temp + mkdir -p "$DEB_BUILD_DIR" + cp -v "$TEMP_DIR/$SOURCES_TAR_NAME" "$DEB_BUILD_DIR/$DEB_TAR_NAME" + + if [ ! -f "$DEB_BUILD_DIR/$DEB_TAR_NAME" ]; then + error "couldn't obtain $DEB_TAR_NAME sources tarball!" fi - cp -v "$BASE_SPEC" "$RPM_SPECS_DIR/$CAS_NAME.spec" + tar -C "$DEB_BUILD_DIR" -zxf "$DEB_BUILD_DIR/$DEB_TAR_NAME" + if [ $? -ne 0 ] || [ ! -d "$DEB_SOURCES_DIR" ]; then + error "couldn't unpack tar archive '$DEB_BUILD_DIR/$DEB_TAR_NAME'"\ + "or it contains wrong sources dir name"\ + "(should be '$(basename $DEB_SOURCES_DIR)')" + fi +} + +rpm_spec_prepare() { + echo "--- Preparing SPEC file" + if [ ! -f "$RPM_SPEC_FILE" ]; then + error "SPEC file '$RPM_SPEC_FILE' not found" + fi + + cp "$RPM_SPEC_FILE" "$RPM_SPECS_DIR" + if ! ls -A "$RPM_SPECS_DIR/"* &>/dev/null; then + error "couldn't copy SPEC file to working directory '$RPM_SPECS_DIR'" + fi + + rename_templates "$RPM_SPECS_DIR" + + 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_HOMEPAGE//\//\\/}/g" "$RPM_SPECS_DIR/$CAS_NAME.spec" + sed -i "s//$PACKAGE_MAINTAINER/g" "$RPM_SPECS_DIR/$CAS_NAME.spec" if [ "$DEBUG" ]; then echo "--- Debug RPMs will be built as well" sed -i "s/%define debug_package %{nil}//g" "$RPM_SPECS_DIR/$CAS_NAME.spec" @@ -249,6 +305,41 @@ rpm_spec_prepare() { fi } +deb_control_files_prepare() { + echo "--- Preparing DEB control files" + if ! ls -A "$DEB_CONTROL_FILES_DIR/"* &>/dev/null; then + error "DEB control files directory '$DEB_CONTROL_FILES_DIR' not found or empty" + fi + + cp -r "$DEB_CONTROL_FILES_DIR" "$DEB_SOURCES_DIR" + if ! ls -A "$DEB_SOURCES_DIR/debian/"* &>/dev/null; then + error "couldn't copy DEB control files to working directory '$DEB_SOURCES_DIR'" + fi + + rename_templates "$DEB_SOURCES_DIR/debian/" + + # Parsing the CAS license file to fit Debian copyright file format + sed '${/^$/d}' "$CAS_LICENSE" > "$TEMP_DIR/LICENSE.deb.tmp" + sed -i 's/^$/./' "$TEMP_DIR/LICENSE.deb.tmp" + rm -f "$TEMP_DIR/LICENSE.deb" + while read -r line; do + echo " $line" >> "$TEMP_DIR/LICENSE.deb" + done < "$TEMP_DIR/LICENSE.deb.tmp" + rm -f "$TEMP_DIR/LICENSE.deb.tmp" + cat "$TEMP_DIR/LICENSE.deb" >> "$DEB_SOURCES_DIR/debian/copyright" + + # Replacing tags + for file in $(find "$DEB_SOURCES_DIR/debian/" -type f); do + 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_HOMEPAGE//\//\\/}/g" "$file" + sed -i "s//${CAS_GIT//\//\\/}/g" "$file" + sed -i "s//$PACKAGE_MAINTAINER/g" "$file" + sed -i "s//$PACKAGE_DATE/g" "$file" + done +} + generate_rpm() { if [ "$RPM_BUILT" ]; then return 0 @@ -273,7 +364,7 @@ generate_rpm() { if [ $? -ne 0 ]; then error "couldn't create RPM packages" fi - mv -t "$OUTPUT_DIR" "$RPM_RPMS_DIR/$ARCH"/* + mv -ft "$OUTPUT_DIR" "$RPM_RPMS_DIR/$ARCH"/* fi if [ "$GENERATE_SRPM" ] && [ ! "$GENERATE_RPM" ]; then echo "--- Building source SRPM package" @@ -281,7 +372,7 @@ generate_rpm() { if [ $? -ne 0 ]; then error "couldn't create SRPM package" fi - mv -t "$OUTPUT_DIR" "$RPM_SRPMS_DIR"/* + mv -ft "$OUTPUT_DIR" "$RPM_SRPMS_DIR"/* fi if [ "$GENERATE_SRPM" ] && [ "$GENERATE_RPM" ]; then echo "--- Building source and binary RPM packages" @@ -289,8 +380,8 @@ generate_rpm() { if [ $? -ne 0 ]; then error "couldn't create RPM packages" fi - mv -t "$OUTPUT_DIR" "$RPM_SRPMS_DIR"/* - mv -t "$OUTPUT_DIR" "$RPM_RPMS_DIR/$ARCH"/* + mv -ft "$OUTPUT_DIR" "$RPM_SRPMS_DIR"/* + mv -ft "$OUTPUT_DIR" "$RPM_RPMS_DIR/$ARCH"/* fi RPM_BUILT="rpm_built" @@ -300,6 +391,51 @@ generate_srpm() { generate_rpm } +generate_deb() { + if [ "$DEB_BUILT" ]; then + return 0 + fi + + deb_obtain_sources + deb_control_files_prepare + + if [ ! "$GENERATE_DSC" ] && [ "$GENERATE_DEB" ]; then + echo "--- Building binary DEB packages" + (cd "$DEB_SOURCES_DIR" && debuild -us -uc -b) + if [ $? -ne 0 ]; then + error "couldn't create DEB packages" + fi + mv -ft "$OUTPUT_DIR" "$DEB_BUILD_DIR/$CAS_NAME"*deb + fi + if [ "$GENERATE_DSC" ] && [ ! "$GENERATE_DEB" ]; then + echo "--- Building DSC (source DEB) package" + (cd "$DEB_SOURCES_DIR" && debuild -us -uc -S -d) + if [ $? -ne 0 ]; then + error "couldn't create DSC package" + fi + mv -ft "$OUTPUT_DIR" "$DEB_BUILD_DIR/$CAS_NAME"*.dsc + mv -ft "$OUTPUT_DIR" "$DEB_BUILD_DIR/$CAS_NAME"*.orig.tar.gz + mv -ft "$OUTPUT_DIR" "$DEB_BUILD_DIR/$CAS_NAME"*.debian.tar.xz + fi + if [ "$GENERATE_DSC" ] && [ "$GENERATE_DEB" ]; then + echo "--- Building DEB and DSC (source DEB) packages" + (cd "$DEB_SOURCES_DIR" && debuild -us -uc -F) + if [ $? -ne 0 ]; then + error "couldn't create DEB and DSC packages" + fi + mv -ft "$OUTPUT_DIR" "$DEB_BUILD_DIR/$CAS_NAME"*deb + mv -ft "$OUTPUT_DIR" "$DEB_BUILD_DIR/$CAS_NAME"*.dsc + mv -ft "$OUTPUT_DIR" "$DEB_BUILD_DIR/$CAS_NAME"*.orig.tar.gz + mv -ft "$OUTPUT_DIR" "$DEB_BUILD_DIR/$CAS_NAME"*.debian.tar.xz + fi + + DEB_BUILT="deb_built" +} + +generate_dsc() { + generate_deb +} + if (( ! $# )); then invalid_usage "no arguments given\n$(usage)\n" @@ -319,6 +455,12 @@ while (( $# )); do srpm) GENERATE_SRPM="generate_srpm" ;; + deb) + GENERATE_DEB="generate_deb" + ;; + dsc) + GENERATE_DSC="generate_dsc" + ;; --output-dir|-o) OUTPUT_DIR="$2" if ! dirname $OUTPUT_DIR &>/dev/null; then @@ -350,12 +492,17 @@ done check_options +# Following line removes all temporary (build process) files and dirs +# even if this script ends with an error. For debuging purposes, when +# build-time files are needed for inspection, simply comment it out. trap clean EXIT + create_temp ### Variables that relates on arguments passed to this script: +CAS_LICENSE="$SOURCES_DIR/LICENSE" # By default all created packages will be put in: : ${OUTPUT_DIR:="$SOURCES_DIR/packages"} # RPM building directories: @@ -364,6 +511,7 @@ RPM_SOURCES_DIR="$RPM_BUILD_DIR/SOURCES" RPM_SPECS_DIR="$RPM_BUILD_DIR/SPECS" RPM_RPMS_DIR="$RPM_BUILD_DIR/RPMS" RPM_SRPMS_DIR="$RPM_BUILD_DIR/SRPMS" +DEB_BUILD_DIR="$TEMP_DIR/debuild" # Version file location: VERSION_FILE="$SOURCES_DIR/.metadata/cas_version" # CAS version generator location: @@ -376,6 +524,10 @@ CAS_FILENAME="$CAS_NAME-$CAS_VERSION" # CAS sources archives filenames: SOURCES_TAR_NAME="$CAS_FILENAME.tar.gz" SOURCES_ZIP_NAME="$CAS_FILENAME.zip" +DEB_TAR_NAME="${CAS_NAME}_${CAS_VERSION}.orig.tar.gz" +# DEB sources dir needs to be obtained after version checking +# because its name contains version number +DEB_SOURCES_DIR="$DEB_BUILD_DIR/$CAS_NAME-$CAS_VERSION" diff --git a/utils/pckgen.d/deb/debian/CAS_NAME-modules.install b/utils/pckgen.d/deb/debian/CAS_NAME-modules.install new file mode 100644 index 0000000..f24e80a --- /dev/null +++ b/utils/pckgen.d/deb/debian/CAS_NAME-modules.install @@ -0,0 +1 @@ +lib/modules/ diff --git a/utils/pckgen.d/deb/debian/CAS_NAME.docs b/utils/pckgen.d/deb/debian/CAS_NAME.docs new file mode 100644 index 0000000..b43bf86 --- /dev/null +++ b/utils/pckgen.d/deb/debian/CAS_NAME.docs @@ -0,0 +1 @@ +README.md diff --git a/utils/pckgen.d/deb/debian/CAS_NAME.install b/utils/pckgen.d/deb/debian/CAS_NAME.install new file mode 100644 index 0000000..9ff5928 --- /dev/null +++ b/utils/pckgen.d/deb/debian/CAS_NAME.install @@ -0,0 +1,8 @@ +etc/ +lib/opencas/ +lib/udev/ +sbin/ +var/ +utils/open-cas.shutdown lib/systemd/system-shutdown/ +utils/open-cas.service lib/systemd/system/ +utils/open-cas-shutdown.service lib/systemd/system/ diff --git a/utils/pckgen.d/deb/debian/CAS_NAME.manpages b/utils/pckgen.d/deb/debian/CAS_NAME.manpages new file mode 100644 index 0000000..3b87284 --- /dev/null +++ b/utils/pckgen.d/deb/debian/CAS_NAME.manpages @@ -0,0 +1,3 @@ +utils/opencas.conf.5 +utils/casadm.8 +utils/casctl.8 diff --git a/utils/pckgen.d/deb/debian/changelog b/utils/pckgen.d/deb/debian/changelog new file mode 100644 index 0000000..06ab4b8 --- /dev/null +++ b/utils/pckgen.d/deb/debian/changelog @@ -0,0 +1,11 @@ + (-1) trusty; urgency=medium + + * pckgen: automated package generation + + -- + +open-cas-linux (20.03.2.0295-1) trusty; urgency=medium + + * Initial OpenCAS DEB package release + + -- Rafal Stefanowski Mon, 07 Sep 2020 14:17:04 +0200 diff --git a/utils/pckgen.d/deb/debian/compat b/utils/pckgen.d/deb/debian/compat new file mode 100644 index 0000000..48082f7 --- /dev/null +++ b/utils/pckgen.d/deb/debian/compat @@ -0,0 +1 @@ +12 diff --git a/utils/pckgen.d/deb/debian/control b/utils/pckgen.d/deb/debian/control new file mode 100644 index 0000000..4500338 --- /dev/null +++ b/utils/pckgen.d/deb/debian/control @@ -0,0 +1,30 @@ +Source: +Section: utils +Priority: optional +Maintainer: +Build-Depends: debhelper (>= 11), gawk, libelf-dev, linux-headers-generic +Standards-Version: 4.1.2 +Homepage: +Vcs-Git: + +Package: +Architecture: amd64 +Depends: ${shlibs:Depends}, ${misc:Depends}, python3, + -modules (= -1) +Description: Open Cache Acceleration Software + Open Cache Acceleration Software (Open CAS) is an open source project + encompassing block caching software libraries, adapters, tools and more. + The main goal of this cache acceleration software is to accelerate a + backend block device(s) by utilizing a higher performance device(s). + This package contains tools and utilities for managing CAS and monitor + running cache instances (no kernel modules). + +Package: -modules +Architecture: amd64 +Depends: ${misc:Depends} +Description: Open Cache Acceleration Software kernel modules (${kver}) + Open Cache Acceleration Software (Open CAS) is an open source project + encompassing block caching software libraries, adapters, tools and more. + The main goal of this cache acceleration software is to accelerate a + backend block device(s) by utilizing a higher performance device(s). + This package contains only CAS kernel modules. diff --git a/utils/pckgen.d/deb/debian/copyright b/utils/pckgen.d/deb/debian/copyright new file mode 100644 index 0000000..b46df79 --- /dev/null +++ b/utils/pckgen.d/deb/debian/copyright @@ -0,0 +1,7 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: Intel Corporation +Source: + +Files: * +Copyright: 2019-2020 Intel Corporation +License: diff --git a/utils/pckgen.d/deb/debian/rules b/utils/pckgen.d/deb/debian/rules new file mode 100755 index 0000000..6d64753 --- /dev/null +++ b/utils/pckgen.d/deb/debian/rules @@ -0,0 +1,21 @@ +#!/usr/bin/make -f + +# output every command that modifies files on the build system +#export DH_VERBOSE = 1 + +%: + dh $@ + +override_dh_auto_configure : + ./configure + +override_dh_auto_install : + make install_files DESTDIR="$(shell pwd)/debian/tmp" + +override_dh_installsystemd : + dh_installsystemd --no-start + +override_dh_missing : + +override_dh_gencontrol : + dh_gencontrol -- -Vkver="$(shell uname -r)" diff --git a/utils/pckgen.d/deb/debian/source/format b/utils/pckgen.d/deb/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/utils/pckgen.d/deb/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/utils/open-cas-linux.spec.base b/utils/pckgen.d/rpm/CAS_NAME.spec similarity index 72% rename from utils/open-cas-linux.spec.base rename to utils/pckgen.d/rpm/CAS_NAME.spec index 5bc0bee..7a2dadc 100644 --- a/utils/open-cas-linux.spec.base +++ b/utils/pckgen.d/rpm/CAS_NAME.spec @@ -4,7 +4,7 @@ # # -# This is a base SPEC file for generating OpenCAS RPMs automatically. +# This is a template SPEC file for generating OpenCAS RPMs automatically. # It contains tags in form of which are substituted with particular # values in the build time. # @@ -15,24 +15,18 @@ %define kver_filename k%{expand:%(kname="%{kver}"; echo "${kname%.*}" | sed -r "y/-/_/;")} -Name: open-cas-linux -Version: -Release: 1%{?dist} -Summary: Open Cache Acceleration Software -Group: System -License: BSD-3-Clause -URL: https://open-cas.github.io/ -Source0: https://github.com/Open-CAS/open-cas-linux/releases/download/v%{version}/%{name}-%{version}.tar.gz -BuildRequires: gcc -BuildRequires: kernel-devel -BuildRequires: kernel-headers -BuildRequires: make -BuildRequires: elfutils-libelf-devel -BuildRequires: coreutils -BuildRequires: gawk -Requires: python3 -Requires: sed -Requires: open-cas-linux-modules-%{version} +Name: +Version: +Release: 1%{?dist} +Summary: Open Cache Acceleration Software +Group: System +Vendor: Intel Corporation +License: +URL: +Source0: https://github.com/Open-CAS/open-cas-linux/releases/download/v%{version}/%{name}-%{version}.tar.gz +Packager: +BuildRequires: coreutils, gawk, gcc, kernel-devel, kernel-headers, make +Requires: -modules-%{version}, python3, sed %description Open Cache Acceleration Software (Open CAS) is an open source project encompassing block caching software libraries, adapters, tools and more. @@ -43,16 +37,16 @@ running cache instances. %package modules_%{kver_filename} -Summary: Open Cache Acceleration Software kernel modules -Group: System -Requires: kmod -Provides: open-cas-linux-modules-%{version} +Summary: Open Cache Acceleration Software kernel modules +Group: System +Requires: kmod +Provides: -modules-%{version} %description modules_%{kver_filename} Open Cache Acceleration Software (Open CAS) is an open source project encompassing block caching software libraries, adapters, tools and more. The main goal of this cache acceleration software is to accelerate a backend block device(s) by utilizing a higher performance device(s). -This package contains CAS kernel modules. +This package contains only CAS kernel modules. %prep @@ -88,13 +82,19 @@ fi %post modules_%{kver_filename} depmod -modules=( $(realpath $(modinfo -F filename cas_cache cas_disk)) ) -printf "%s\n" "${modules[@]}" | weak-modules --no-initramfs --add-modules +. /etc/os-release +if [[ ! "$ID_LIKE" =~ suse|sles ]]; then + modules=( $(realpath $(modinfo -F filename cas_cache cas_disk)) ) + printf "%s\n" "${modules[@]}" | weak-modules --no-initramfs --add-modules +fi %postun modules_%{kver_filename} if [ $1 -eq 0 ]; then - modules=( $(realpath $(modinfo -F filename cas_cache cas_disk 2>/dev/null)) ) - printf "%s\n" "${modules[@]}" | weak-modules --no-initramfs --remove-modules + . /etc/os-release + if [[ ! "$ID_LIKE" =~ suse|sles ]]; then + modules=( $(realpath $(modinfo -F filename cas_cache cas_disk 2>/dev/null)) ) + printf "%s\n" "${modules[@]}" | weak-modules --no-initramfs --remove-modules + fi depmod fi @@ -133,6 +133,9 @@ fi %changelog +* Fri Sep 11 2020 Rafal Stefanowski - 20.09-1 +- SLES related modifications +- Add some missing info about a package * Thu Jul 30 2020 Rafal Stefanowski - 20.09-1 - Improve adding and removing modules with weak-modules * Wed Jun 10 2020 Rafal Stefanowski - 20.06-1