Merge pull request #1134 from rafalste/permissions_cleanup

Packages and permissions improvements
This commit is contained in:
Robert Baldyga 2022-03-28 21:34:56 +02:00 committed by GitHub
commit eae8bf92e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 54 additions and 107 deletions

View File

@ -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

View File

@ -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"

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 <rafal.stefanowski@intel.com> - 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 <michal.mielewczyk@intel.com> - 21.06-1
- Update dependencies
* Mon Feb 8 2021 Rafal Stefanowski <rafal.stefanowski@intel.com> - 21.03-1

View File

@ -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:

View File

@ -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

View File

@ -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