提交 10404671 编写于 作者: E Eric Blake

build: follow directory install conventions

Commit 4d9e51f6 fixed a 'make uninstall' failure, but failed
to follow other conventions already present in src/Makefile.am.
In particular, we prefer MKDIR_P over mkdir -p, and should
have a matching rmdir during uninstall for every directory
created during install (the idea being that uninstall in a
DESTDIR should be clean, while installation in the final
system should not fail with non-empty directories left behind).

* tools/Makefile.am (install-sysconfig, install-initscript)
(install-systemd): Use MKDIR_P.
(uninstall-sysconfig, uninstall-initscript, uninstall-systemd):
Also remove directories.
* daemon/Makefile.am (install-data-local, install-data-polkit)
(install-logrotate, install-sysconfig, install-sysctl)
(install-init-redhat, install-init-upstart, install-init-systemd)
(install-data-sasl): Use MKDIR_P.
(uninstall-data-polkit, uninstall-sysconfig, uninstall-sysctl)
(uninstall-init-redhat, uninstall-init-upstart)
(uninstall-init-systemd): Also remove directory.
(uninstall-logrotate): New rule.
(uninstall-local): Add uninstall-logrotate.
上级 5547d2b8
...@@ -173,23 +173,24 @@ endif ...@@ -173,23 +173,24 @@ endif
install-data-local: install-init-redhat install-init-systemd install-init-upstart \ install-data-local: install-init-redhat install-init-systemd install-init-upstart \
install-data-sasl install-data-polkit \ install-data-sasl install-data-polkit \
install-logrotate install-sysctl install-logrotate install-sysctl
mkdir -p $(DESTDIR)$(localstatedir)/log/libvirt $(MKDIR_P) $(DESTDIR)$(localstatedir)/log/libvirt \
mkdir -p $(DESTDIR)$(localstatedir)/run/libvirt $(DESTDIR)$(localstatedir)/run/libvirt \
mkdir -p $(DESTDIR)$(localstatedir)/lib/libvirt $(DESTDIR)$(localstatedir)/lib/libvirt
uninstall-local:: uninstall-init-redhat uninstall-init-systemd uninstall-init-upstart \ uninstall-local:: uninstall-init-redhat uninstall-init-systemd uninstall-init-upstart \
uninstall-data-sasl uninstall-data-polkit \ uninstall-data-sasl uninstall-data-polkit \
uninstall-sysctl uninstall-logrotate uninstall-sysctl
rmdir $(DESTDIR)$(localstatedir)/log/libvirt || : rmdir $(DESTDIR)$(localstatedir)/log/libvirt || :
rmdir $(DESTDIR)$(localstatedir)/run/libvirt || : rmdir $(DESTDIR)$(localstatedir)/run/libvirt || :
rmdir $(DESTDIR)$(localstatedir)/lib/libvirt || : rmdir $(DESTDIR)$(localstatedir)/lib/libvirt || :
if HAVE_POLKIT if HAVE_POLKIT
install-data-polkit:: install-data-polkit::
mkdir -p $(DESTDIR)$(policydir) $(MKDIR_P) $(DESTDIR)$(policydir)
$(INSTALL_DATA) $(srcdir)/$(policyfile) $(DESTDIR)$(policydir)/org.libvirt.unix.policy $(INSTALL_DATA) $(srcdir)/$(policyfile) $(DESTDIR)$(policydir)/org.libvirt.unix.policy
uninstall-data-polkit:: uninstall-data-polkit::
rm -f $(DESTDIR)$(policydir)/org.libvirt.unix.policy rm -f $(DESTDIR)$(policydir)/org.libvirt.unix.policy
rmdir $(DESTDIR)$(policydir) || :
else else
install-data-polkit:: install-data-polkit::
uninstall-data-polkit:: uninstall-data-polkit::
...@@ -228,41 +229,54 @@ libvirtd.uml.logrotate: libvirtd.uml.logrotate.in ...@@ -228,41 +229,54 @@ libvirtd.uml.logrotate: libvirtd.uml.logrotate.in
mv $@-t $@ mv $@-t $@
install-logrotate: $(LOGROTATE_CONFS) install-logrotate: $(LOGROTATE_CONFS)
mkdir -p $(DESTDIR)$(localstatedir)/log/libvirt/qemu/ $(MKDIR_P) $(DESTDIR)$(localstatedir)/log/libvirt/qemu/ \
mkdir -p $(DESTDIR)$(localstatedir)/log/libvirt/lxc/ $(DESTDIR)$(localstatedir)/log/libvirt/lxc/ \
mkdir -p $(DESTDIR)$(localstatedir)/log/libvirt/uml/ $(DESTDIR)$(localstatedir)/log/libvirt/uml/ \
mkdir -p $(DESTDIR)$(sysconfdir)/logrotate.d/ $(DESTDIR)$(sysconfdir)/logrotate.d/
$(INSTALL_DATA) libvirtd.logrotate $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd $(INSTALL_DATA) libvirtd.logrotate $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd
$(INSTALL_DATA) libvirtd.qemu.logrotate $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.qemu $(INSTALL_DATA) libvirtd.qemu.logrotate $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.qemu
$(INSTALL_DATA) libvirtd.lxc.logrotate $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.lxc $(INSTALL_DATA) libvirtd.lxc.logrotate $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.lxc
$(INSTALL_DATA) libvirtd.uml.logrotate $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.uml $(INSTALL_DATA) libvirtd.uml.logrotate $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.uml
uninstall-logrotate:
rm -f $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd \
$(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.qemu \
$(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.lxc \
$(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.uml
rmdir $(DESTDIR)$(localstatedir)/log/libvirt/qemu || :
rmdir $(DESTDIR)$(localstatedir)/log/libvirt/lxc || :
rmdir $(DESTDIR)$(localstatedir)/log/libvirt/uml || :
rmdir $(DESTDIR)$(sysconfdir)/logrotate.d || :
install-sysconfig: install-sysconfig:
mkdir -p $(DESTDIR)$(sysconfdir)/sysconfig $(MKDIR_P) $(DESTDIR)$(sysconfdir)/sysconfig
$(INSTALL_DATA) $(srcdir)/libvirtd.sysconf \ $(INSTALL_DATA) $(srcdir)/libvirtd.sysconf \
$(DESTDIR)$(sysconfdir)/sysconfig/libvirtd $(DESTDIR)$(sysconfdir)/sysconfig/libvirtd
uninstall-sysconfig: uninstall-sysconfig:
rm -f $(DESTDIR)$(sysconfdir)/sysconfig/libvirtd rm -f $(DESTDIR)$(sysconfdir)/sysconfig/libvirtd
rmdir $(DESTDIR)$(sysconfdir)/sysconfig || :
install-sysctl: install-sysctl:
mkdir -p $(DESTDIR)$(sysconfdir)/sysctl.d $(MKDIR_P) $(DESTDIR)$(sysconfdir)/sysctl.d
$(INSTALL_DATA) $(srcdir)/libvirtd.sysctl \ $(INSTALL_DATA) $(srcdir)/libvirtd.sysctl \
$(DESTDIR)$(sysconfdir)/sysctl.d/libvirtd $(DESTDIR)$(sysconfdir)/sysctl.d/libvirtd
uninstall-sysctl: uninstall-sysctl:
rm -f $(DESTDIR)$(sysconfdir)/sysctl.d/libvirtd rm -f $(DESTDIR)$(sysconfdir)/sysctl.d/libvirtd
rmdir $(DESTDIR)$(sysconfdir)/sysctl.d || :
if LIBVIRT_INIT_SCRIPT_RED_HAT if LIBVIRT_INIT_SCRIPT_RED_HAT
BUILT_SOURCES += libvirtd.init BUILT_SOURCES += libvirtd.init
install-init-redhat: install-sysconfig libvirtd.init install-init-redhat: install-sysconfig libvirtd.init
mkdir -p $(DESTDIR)$(sysconfdir)/rc.d/init.d $(MKDIR_P) $(DESTDIR)$(sysconfdir)/rc.d/init.d
$(INSTALL_SCRIPT) libvirtd.init \ $(INSTALL_SCRIPT) libvirtd.init \
$(DESTDIR)$(sysconfdir)/rc.d/init.d/libvirtd $(DESTDIR)$(sysconfdir)/rc.d/init.d/libvirtd
uninstall-init-redhat: uninstall-sysconfig uninstall-init-redhat: uninstall-sysconfig
rm -f $(DESTDIR)$(sysconfdir)/rc.d/init.d/libvirtd rm -f $(DESTDIR)$(sysconfdir)/rc.d/init.d/libvirtd
rmdir $(DESTDIR)$(sysconfdir)/rc.d/init.d || :
else else
install-init-redhat: install-init-redhat:
uninstall-init-redhat: uninstall-init-redhat:
...@@ -272,12 +286,13 @@ endif # LIBVIRT_INIT_SCRIPT_RED_HAT ...@@ -272,12 +286,13 @@ endif # LIBVIRT_INIT_SCRIPT_RED_HAT
if LIBVIRT_INIT_SCRIPT_UPSTART if LIBVIRT_INIT_SCRIPT_UPSTART
install-init-upstart: install-sysconfig install-init-upstart: install-sysconfig
mkdir -p $(DESTDIR)$(sysconfdir)/event.d $(MKDIR_P) $(DESTDIR)$(sysconfdir)/event.d
$(INSTALL_SCRIPT) libvirtd.upstart \ $(INSTALL_SCRIPT) libvirtd.upstart \
$(DESTDIR)$(sysconfdir)/event.d/libvirtd $(DESTDIR)$(sysconfdir)/event.d/libvirtd
uninstall-init-upstart: uninstall-sysconfig uninstall-init-upstart: uninstall-sysconfig
rm -f $(DESTDIR)$(sysconfdir)/event.d/libvirtd rm -f $(DESTDIR)$(sysconfdir)/event.d/libvirtd
rmdir $(DESTDIR)$(sysconfdir)/event.d || :
else else
install-init-upstart: install-init-upstart:
uninstall-init-upstart: uninstall-init-upstart:
...@@ -291,12 +306,13 @@ SYSTEMD_UNIT_DIR = /lib/systemd/system ...@@ -291,12 +306,13 @@ SYSTEMD_UNIT_DIR = /lib/systemd/system
BUILT_SOURCES += libvirtd.service BUILT_SOURCES += libvirtd.service
install-init-systemd: install-sysconfig libvirtd.service install-init-systemd: install-sysconfig libvirtd.service
mkdir -p $(DESTDIR)$(SYSTEMD_UNIT_DIR) $(MKDIR_P) $(DESTDIR)$(SYSTEMD_UNIT_DIR)
$(INSTALL_SCRIPT) libvirtd.service \ $(INSTALL_SCRIPT) libvirtd.service \
$(DESTDIR)$(SYSTEMD_UNIT_DIR)/libvirtd.service $(DESTDIR)$(SYSTEMD_UNIT_DIR)/libvirtd.service
uninstall-init-systemd: uninstall-sysconfig uninstall-init-systemd: uninstall-sysconfig
rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/libvirtd.service rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/libvirtd.service
rmdir $(DESTDIR)$(SYSTEMD_UNIT_DIR) || :
else else
install-init-systemd: install-init-systemd:
uninstall-init-systemd: uninstall-init-systemd:
...@@ -346,7 +362,7 @@ $(srcdir)/libvirtd.8.in: libvirtd.pod.in ...@@ -346,7 +362,7 @@ $(srcdir)/libvirtd.8.in: libvirtd.pod.in
# the WITH_LIBVIRTD conditional # the WITH_LIBVIRTD conditional
if HAVE_SASL if HAVE_SASL
install-data-sasl: install-data-sasl:
mkdir -p $(DESTDIR)$(sysconfdir)/sasl2/ $(MKDIR_P) $(DESTDIR)$(sysconfdir)/sasl2/
$(INSTALL_DATA) $(srcdir)/libvirtd.sasl $(DESTDIR)$(sysconfdir)/sasl2/libvirt.conf $(INSTALL_DATA) $(srcdir)/libvirtd.sasl $(DESTDIR)$(sysconfdir)/sasl2/libvirt.conf
uninstall-data-sasl: uninstall-data-sasl:
......
...@@ -153,23 +153,24 @@ install-data-local: install-init install-systemd ...@@ -153,23 +153,24 @@ install-data-local: install-init install-systemd
uninstall-local: uninstall-init uninstall-systemd uninstall-local: uninstall-init uninstall-systemd
install-sysconfig: install-sysconfig:
mkdir -p $(DESTDIR)$(sysconfdir)/sysconfig $(MKDIR_P) $(DESTDIR)$(sysconfdir)/sysconfig
$(INSTALL_DATA) $(srcdir)/libvirt-guests.sysconf \ $(INSTALL_DATA) $(srcdir)/libvirt-guests.sysconf \
$(DESTDIR)$(sysconfdir)/sysconfig/libvirt-guests $(DESTDIR)$(sysconfdir)/sysconfig/libvirt-guests
uninstall-sysconfig: uninstall-sysconfig:
rm -f $(DESTDIR)$(sysconfdir)/sysconfig/libvirt-guests rm -f $(DESTDIR)$(sysconfdir)/sysconfig/libvirt-guests
rmdir $(DESTDIR)$(sysconfdir)/sysconfig ||:
EXTRA_DIST += libvirt-guests.init.sh EXTRA_DIST += libvirt-guests.init.sh
install-initscript: libvirt-guests.init install-initscript: libvirt-guests.init
mkdir -p $(DESTDIR)$(sysconfdir)/rc.d/init.d $(MKDIR_P) $(DESTDIR)$(sysconfdir)/rc.d/init.d
$(INSTALL_SCRIPT) libvirt-guests.init \ $(INSTALL_SCRIPT) libvirt-guests.init \
$(DESTDIR)$(sysconfdir)/rc.d/init.d/libvirt-guests $(DESTDIR)$(sysconfdir)/rc.d/init.d/libvirt-guests
uninstall-initscript: uninstall-initscript:
rm -f $(DESTDIR)$(sysconfdir)/rc.d/init.d/libvirt-guests rm -f $(DESTDIR)$(sysconfdir)/rc.d/init.d/libvirt-guests
rmdir $(DESTDIR)$(sysconfdir)/rc.d/init.d ||:
if LIBVIRT_INIT_SCRIPT_RED_HAT if LIBVIRT_INIT_SCRIPT_RED_HAT
...@@ -201,12 +202,13 @@ SYSTEMD_UNIT_DIR = /lib/systemd/system ...@@ -201,12 +202,13 @@ SYSTEMD_UNIT_DIR = /lib/systemd/system
if LIBVIRT_INIT_SCRIPT_SYSTEMD if LIBVIRT_INIT_SCRIPT_SYSTEMD
install-systemd: libvirt-guests.service install-initscript install-sysconfig install-systemd: libvirt-guests.service install-initscript install-sysconfig
mkdir -p $(DESTDIR)$(SYSTEMD_UNIT_DIR) $(MKDIR_P) $(DESTDIR)$(SYSTEMD_UNIT_DIR)
$(INSTALL_SCRIPT) libvirt-guests.service \ $(INSTALL_SCRIPT) libvirt-guests.service \
$(DESTDIR)$(SYSTEMD_UNIT_DIR)/libvirt-guests.service $(DESTDIR)$(SYSTEMD_UNIT_DIR)/libvirt-guests.service
uninstall-systemd: uninstall-initscript uninstall-sysconfig uninstall-systemd: uninstall-initscript uninstall-sysconfig
rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/libvirt-guests.service rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/libvirt-guests.service
rmdir $(DESTDIR)$(SYSTEMD_UNIT_DIR) ||:
BUILT_SOURCES += libvirt-guests.service BUILT_SOURCES += libvirt-guests.service
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册