scstadmin, Ubuntu: Use update-rc.d instead of the LSB /usr/lib/lsb/remove_initd - the latter is not installed by default

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4609 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2012-11-08 14:25:37 +00:00
parent 37431aae60
commit 413a68a53e

View File

@@ -12,6 +12,8 @@ INITDIR := $(shell if [ -f /etc/slackware-version ]; then \
fi)
INSTALL_INITD_CMD := $(shell if type -p systemctl >/dev/null 2>&1; then \
echo systemctl enable; \
elif type -p update-rc.d >/dev/null 2>&1; then\
echo update-rc.d; \
elif [ -f /etc/gentoo-release ]; then \
echo rc-update add; \
elif [ -f /etc/slackware-version ]; then \
@@ -21,16 +23,25 @@ INSTALL_INITD_CMD := $(shell if type -p systemctl >/dev/null 2>&1; then \
fi)
INSTALL_INITD_ARGS := $(shell if type -p systemctl >/dev/null 2>&1; then\
echo ".service"; \
elif type -p update-rc.d >/dev/null 2>&1; then\
echo " defaults"; \
elif [ -f /etc/gentoo-release ]; then \
echo " default"; \
fi)
REMOVE_INITD_CMD := $(shell if [ -f /etc/gentoo-release ]; then \
REMOVE_INITD_CMD := $(shell if type -p systemctl >/dev/null 2>&1; then \
echo systemctl disable; \
elif type -p update-rc.d >/dev/null 2>&1; then\
echo update-rc.d -f; \
elif [ -f /etc/gentoo-release ]; then \
echo rc-update del; \
elif [ -f /etc/slackware-version ]; then \
echo none; \
else \
echo /usr/lib/lsb/remove_initd; \
fi)
REMOVE_INITD_ARGS := $(shell if type -p update-rc.d >/dev/null 2>&1; then\
echo " remove"; \
fi)
DEFAULTDIR := $(shell if [ -f /etc/gentoo-release ]; then \
echo /etc/conf.d; \
else \
@@ -67,10 +78,10 @@ install:
install -m 755 default/scst $(DESTDIR)$(DEFAULTDIR); \
fi
@if [ "$(REMOVE_INITD_CMD)" != "none" ]; then \
$(REMOVE_INITD_CMD) iscsi-scst >/dev/null 2>&1; \
rm -f $(DESTDIR)$(INITDIR)/iscsi-scst; \
$(REMOVE_INITD_CMD) qla2x00t >/dev/null 2>&1; \
rm -f $(DESTDIR)$(INITDIR)/qla2x00t; \
for s in iscsi-scst qla2x00t; do \
$(REMOVE_INITD_CMD) $$s $(REMOVE_INITD_ARGS) >/dev/null 2>&1; \
rm -f $(DESTDIR)$(INITDIR)/$$s; \
done; \
fi
@if [ "$(INSTALL_INITD_CMD)" != "none" ]; then \
echo; \
@@ -89,9 +100,9 @@ uninstall:
if [ -e $(DESTDIR)$(INITDIR)/scst -a "$(REMOVE_INITD_CMD)" != "none" ];\
then \
if [ -z "$(DESTDIR)" ]; then \
$(REMOVE_INITD_CMD) scst; \
$(REMOVE_INITD_CMD) scst $(REMOVE_INITD_ARGS); \
else \
chroot $(DESTDIR) $(REMOVE_INITD_CMD) scst; \
chroot $(DESTDIR) $(REMOVE_INITD_CMD) scst $(REMOVE_INITD_ARGS); \
fi; \
rm -f $(DESTDIR)$(INITDIR)/scst; \
fi