From cb8d1cffaef97e6011e04b951ebbcbbffee05f46 Mon Sep 17 00:00:00 2001 From: Rafal Stefanowski Date: Mon, 21 Mar 2022 15:37:16 +0100 Subject: [PATCH] Fix files/dirs permissions - change modes to proper values - replace 'mkdir' with 'install' - remove unused files and dirs Signed-off-by: Rafal Stefanowski --- Makefile | 4 +-- casadm/Makefile | 9 +++---- modules/Makefile | 7 +++-- utils/Makefile | 43 ++++++++++++------------------- utils/open-cas-shutdown | 57 ----------------------------------------- 5 files changed, 24 insertions(+), 96 deletions(-) delete mode 100644 utils/open-cas-shutdown 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..2986831 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 @@ -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" 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