Makefile: improve uninstall error handling

Introduce helper functions to handle uninstall errors gracefully.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
Robert Baldyga
2021-03-19 15:25:24 +01:00
parent e58dae02ac
commit 880cfadde9
4 changed files with 50 additions and 24 deletions

View File

@@ -3,6 +3,8 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
include ../tools/helpers.mk
CASCTL_DIR = /lib/opencas
UDEVRULES_DIR = /lib/udev/rules.d
METADATA_DIR:=$(PWD)/../.metadata
@@ -70,34 +72,34 @@ endif
uninstall:
@echo "Uninstalling Open-CAS utils"
@rm $(DESTDIR)/etc/opencas/opencas.conf
@rm $(DESTDIR)/etc/opencas/ioclass-config.csv
@rm -rf $(DESTDIR)/etc/opencas
@rm $(DESTDIR)/var/lib/opencas/cas_version
@rm -rf $(DESTDIR)/var/lib/opencas
@rm $(DESTDIR)/usr/share/man/man5/opencas.conf.5
$(call remove-file,$(DESTDIR)/etc/opencas/opencas.conf)
$(call remove-file,$(DESTDIR)/etc/opencas/ioclass-config.csv)
$(call remove-directory,$(DESTDIR)/etc/opencas)
$(call remove-file,$(DESTDIR)/var/lib/opencas/cas_version)
$(call remove-directory,$(DESTDIR)/var/lib/opencas)
$(call remove-file,$(DESTDIR)/usr/share/man/man5/opencas.conf.5)
@rm $(DESTDIR)$(CASCTL_DIR)/opencas.py
@rm $(DESTDIR)$(CASCTL_DIR)/casctl
@rm $(DESTDIR)$(CASCTL_DIR)/open-cas-loader
@rm -rf $(DESTDIR)$(CASCTL_DIR)
$(call remove-file,$(DESTDIR)$(CASCTL_DIR)/opencas.py)
$(call remove-file,$(DESTDIR)$(CASCTL_DIR)/casctl)
$(call remove-file,$(DESTDIR)$(CASCTL_DIR)/open-cas-loader)
$(call remove-directory,$(DESTDIR)$(CASCTL_DIR))
@rm $(DESTDIR)/etc/dracut.conf.d/opencas.conf
$(call remove-file,$(DESTDIR)/etc/dracut.conf.d/opencas.conf)
@rm $(DESTDIR)/sbin/casctl
$(call remove-file,$(DESTDIR)/sbin/casctl)
@rm $(DESTDIR)/usr/share/man/man8/casctl.8
$(call remove-file,$(DESTDIR)/usr/share/man/man8/casctl.8)
@rm $(DESTDIR)$(UDEVRULES_DIR)/60-persistent-storage-cas-load.rules
@rm $(DESTDIR)$(UDEVRULES_DIR)/60-persistent-storage-cas.rules
$(call remove-file,$(DESTDIR)$(UDEVRULES_DIR)/60-persistent-storage-cas-load.rules)
$(call remove-file,$(DESTDIR)$(UDEVRULES_DIR)/60-persistent-storage-cas.rules)
@$(UDEV) control --reload-rules
@$(SYSTEMCTL) -q disable open-cas-shutdown
@$(SYSTEMCTL) -q disable open-cas
@$(SYSTEMCTL) daemon-reload
@rm $(DESTDIR)$(SYSTEMD_DIR)/open-cas-shutdown.service
@rm $(DESTDIR)$(SYSTEMD_DIR)/open-cas.service
@rm $(DESTDIR)$(SYSTEMD_DIR)/../system-shutdown/open-cas.shutdown
$(call remove-file,$(DESTDIR)$(SYSTEMD_DIR)/open-cas-shutdown.service)
$(call remove-file,$(DESTDIR)$(SYSTEMD_DIR)/open-cas.service)
$(call remove-file,$(DESTDIR)$(SYSTEMD_DIR)/../system-shutdown/open-cas.shutdown)
.PHONY: install uninstall clean distclean