diff --git a/Makefile b/Makefile index f584666..6d8c2e4 100644 --- a/Makefile +++ b/Makefile @@ -30,10 +30,10 @@ archives: @tools/pckgen $(PWD) tar zip rpm: - @tools/pckgen $(PWD) rpm --debug + @tools/pckgen $(PWD) rpm srpm: - @tools/pckgen $(PWD) srpm --debug + @tools/pckgen $(PWD) srpm deb: @tools/pckgen $(PWD) deb diff --git a/casadm/Makefile b/casadm/Makefile index 5c7ff58..d48a18f 100644 --- a/casadm/Makefile +++ b/casadm/Makefile @@ -1,5 +1,5 @@ # -# Copyright(c) 2012-2021 Intel Corporation +# Copyright(c) 2012-2022 Intel Corporation # SPDX-License-Identifier: BSD-3-Clause # @@ -132,11 +132,8 @@ install: install_files install_files: @echo "Installing casadm" - @mkdir -p $(DESTDIR)$(BINARY_PATH) - @install -m 755 $(TARGET) $(DESTDIR)$(BINARY_PATH)/$(TARGET) - @mkdir -p $(DESTDIR)/usr/share/man/man8 - @install -m 644 $(TARGET).8 $(DESTDIR)/usr/share/man/man8/$(TARGET).8 - @mkdir -p $(DESTDIR)/usr/share/man/man5 + @install -m 755 -D $(TARGET) $(DESTDIR)$(BINARY_PATH)/$(TARGET) + @install -m 644 -D $(TARGET).8 $(DESTDIR)/usr/share/man/man8/$(TARGET).8 uninstall: @echo "Uninstalling casadm" diff --git a/modules/Makefile b/modules/Makefile index ff57cfa..e3d42d8 100644 --- a/modules/Makefile +++ b/modules/Makefile @@ -1,5 +1,5 @@ # -# Copyright(c) 2012-2021 Intel Corporation +# Copyright(c) 2012-2022 Intel Corporation # SPDX-License-Identifier: BSD-3-Clause # # If $(M) is defined, we've been invoked from the @@ -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 @@ -58,9 +58,8 @@ install: install_files install_files: @echo "Installing Open-CAS modules" - @install -m 755 -d $(DESTDIR)$(MODULES_DIR) - @install -m 744 cas_disk/$(DISK_MODULE).ko $(DESTDIR)$(MODULES_DIR)/$(DISK_MODULE).ko - @install -m 744 cas_cache/$(CACHE_MODULE).ko $(DESTDIR)$(MODULES_DIR)/$(CACHE_MODULE).ko + @install -m 644 -D cas_disk/$(DISK_MODULE).ko $(DESTDIR)$(MODULES_DIR)/$(DISK_MODULE).ko + @install -m 644 -D cas_cache/$(CACHE_MODULE).ko $(DESTDIR)$(MODULES_DIR)/$(CACHE_MODULE).ko uninstall: @echo "Uninstalling Open-CAS modules" @@ -69,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/test/functional/tests/lazy_writes/recovery/recovery_tests_methods.py b/test/functional/tests/lazy_writes/recovery/recovery_tests_methods.py index 174b2f2..09522fa 100644 --- a/test/functional/tests/lazy_writes/recovery/recovery_tests_methods.py +++ b/test/functional/tests/lazy_writes/recovery/recovery_tests_methods.py @@ -1,3 +1,8 @@ +# +# Copyright(c) 2020-2022 Intel Corporation +# SPDX-License-Identifier: BSD-3-Clause +# + from datetime import timedelta from core.test_run import TestRun 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/deb/debian/rules b/tools/pckgen.d/deb/debian/rules index 67b969c..005e82c 100755 --- a/tools/pckgen.d/deb/debian/rules +++ b/tools/pckgen.d/deb/debian/rules @@ -1,4 +1,8 @@ #!/usr/bin/make -f +# +# Copyright(c) 2020-2022 Intel Corporation +# SPDX-License-Identifier: BSD-3-Clause +# # output every command that modifies files on the build system #export DH_VERBOSE = 1 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 diff --git a/utils/Makefile b/utils/Makefile index 724e669..9def0c2 100644 --- a/utils/Makefile +++ b/utils/Makefile @@ -1,5 +1,5 @@ # -# Copyright(c) 2012-2021 Intel Corporation +# Copyright(c) 2012-2022 Intel Corporation # SPDX-License-Identifier: BSD-3-Clause # @@ -34,39 +34,28 @@ else install_files: @echo "Installing Open-CAS utils" - @install -m 755 -d $(DESTDIR)/etc/opencas - @install -m 644 $(UTILS_DIR)/opencas.conf $(DESTDIR)/etc/opencas/opencas.conf - @install -m 444 $(UTILS_DIR)/ioclass-config.csv $(DESTDIR)/etc/opencas/ioclass-config.csv - @install -m 755 -d $(DESTDIR)/var/lib/opencas - @install -m 644 $(METADATA_DIR)/cas_version $(DESTDIR)/var/lib/opencas/cas_version - @mkdir -p $(DESTDIR)/usr/share/man/man5 - @install -m 644 $(UTILS_DIR)/opencas.conf.5 $(DESTDIR)/usr/share/man/man5/opencas.conf.5 + @install -m 644 -D $(UTILS_DIR)/opencas.conf $(DESTDIR)/etc/opencas/opencas.conf + @install -m 644 -D $(UTILS_DIR)/ioclass-config.csv $(DESTDIR)/etc/opencas/ioclass-config.csv + @install -m 644 -D $(METADATA_DIR)/cas_version $(DESTDIR)/var/lib/opencas/cas_version + @install -m 644 -D $(UTILS_DIR)/opencas.conf.5 $(DESTDIR)/usr/share/man/man5/opencas.conf.5 - @install -m 755 -d $(DESTDIR)$(CASCTL_DIR) - @install -m 644 opencas.py $(DESTDIR)$(CASCTL_DIR)/opencas.py - @install -m 755 casctl $(DESTDIR)$(CASCTL_DIR)/casctl - @install -m 755 open-cas-loader $(DESTDIR)$(CASCTL_DIR)/open-cas-loader + @install -m 644 -D opencas.py $(DESTDIR)$(CASCTL_DIR)/opencas.py + @install -m 755 -D casctl $(DESTDIR)$(CASCTL_DIR)/casctl + @install -m 755 -D open-cas-loader $(DESTDIR)$(CASCTL_DIR)/open-cas-loader - @mkdir -p $(DESTDIR)/etc/dracut.conf.d/ - @install -m 644 etc/dracut.conf.d/opencas.conf $(DESTDIR)/etc/dracut.conf.d/opencas.conf + @install -m 644 -D etc/dracut.conf.d/opencas.conf $(DESTDIR)/etc/dracut.conf.d/opencas.conf - @mkdir -p $(DESTDIR)/sbin + @install -m 755 -d $(DESTDIR)/sbin @ln -fs $(CASCTL_DIR)/casctl $(DESTDIR)/sbin/casctl - @mkdir -p $(DESTDIR)$(UDEVRULES_DIR) - @install -m 644 60-persistent-storage-cas-load.rules $(DESTDIR)$(UDEVRULES_DIR)/60-persistent-storage-cas-load.rules - @install -m 644 60-persistent-storage-cas.rules $(DESTDIR)$(UDEVRULES_DIR)/60-persistent-storage-cas.rules + @install -m 644 -D 60-persistent-storage-cas-load.rules $(DESTDIR)$(UDEVRULES_DIR)/60-persistent-storage-cas-load.rules + @install -m 644 -D 60-persistent-storage-cas.rules $(DESTDIR)$(UDEVRULES_DIR)/60-persistent-storage-cas.rules - @install -m 755 -d $(DESTDIR)/usr/share/doc/opencas + @install -m 644 -D casctl.8 $(DESTDIR)/usr/share/man/man8/casctl.8 - @mkdir -p $(DESTDIR)/usr/share/man/man8 - @install -m 644 casctl.8 $(DESTDIR)/usr/share/man/man8/casctl.8 - - @mkdir -p $(DESTDIR)$(SYSTEMD_DIR) - @install -m 644 open-cas-shutdown.service $(DESTDIR)$(SYSTEMD_DIR)/open-cas-shutdown.service - @install -m 644 open-cas.service $(DESTDIR)$(SYSTEMD_DIR)/open-cas.service - @install -m 755 -d $(DESTDIR)$(SYSTEMD_DIR)/../system-shutdown - @install -m 755 open-cas.shutdown $(DESTDIR)$(SYSTEMD_DIR)/../system-shutdown/open-cas.shutdown + @install -m 644 -D open-cas-shutdown.service $(DESTDIR)$(SYSTEMD_DIR)/open-cas-shutdown.service + @install -m 644 -D open-cas.service $(DESTDIR)$(SYSTEMD_DIR)/open-cas.service + @install -m 755 -D open-cas.shutdown $(DESTDIR)$(SYSTEMD_DIR)/../system-shutdown/open-cas.shutdown endif uninstall: diff --git a/utils/open-cas-shutdown b/utils/open-cas-shutdown deleted file mode 100644 index 2c3ee17..0000000 --- a/utils/open-cas-shutdown +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash -# -# Copyright(c) 2012-2021 Intel Corporation -# SPDX-License-Identifier: BSD-3-Clause -# -# -# open-cas-shutdown Stops Open CAS -# -# chkconfig: 235 05 95 -# description: Open Cache Acceleration Software Shutdown Trigger -# -# processname: open-cas-shutdown - -### BEGIN INIT INFO -# Provides: open-cas-shutdown -# Required-Start: $local_fs -# Required-Stop: $local_fs -# Default-Start: 2 3 5 -# Default-Stop: 0 1 6 -# Short-Description: Open Cache Acceleration Software Shutdown Trigger -# Description: Open Cache Acceleration Software Shutdown Trigger -### END INIT INFO - -# Execution flow - -runfile=/var/lock/subsys/open-cas-shutdown - -function umount_cache_volumes() -{ - BLOCK_DEV_PREFIX=/dev/cas - INSTANCES=`ls ${BLOCK_DEV_PREFIX}* | egrep [1-9][0-9]*-[1-9][0-9]*` - for inst in $INSTANCES ; do - # Umount any mounted Open CAS devices first - if [[ `cat /etc/mtab | grep $inst | wc -l` -gt 0 ]] ; then - umount $inst &> /dev/null - fi - done -} - -case "$1" in - start|restart|reload) - mkdir -p `dirname $runfile` - touch $runfile - exit 0 - ;; - status) - exit 0 - ;; - stop) - umount_cache_volumes - /sbin/cas stop - rm -f $runfile - exit $? - ;; - *) - exit 1 -esac diff --git a/utils/open-cas-shutdown.service b/utils/open-cas-shutdown.service index 075cdde..a82d5d8 100644 --- a/utils/open-cas-shutdown.service +++ b/utils/open-cas-shutdown.service @@ -1,3 +1,8 @@ +# +# Copyright(c) 2019-2022 Intel Corporation +# SPDX-License-Identifier: BSD-3-Clause +# + [Unit] Description=Open Cache Acceleration Software Shutdown Trigger After=umount.target