mirror of https://gitee.com/openkylin/libvirt.git
tools: Only install guests init script if --with-init=script=redhat
Most of this deals with moving the libvirt-guests.sh script which does all the work to /usr/libexec, so it can be shared by both systemd and traditional init. Previously systemd depended on the script being in /etc/init.d Required to fix https://bugzilla.redhat.com/show_bug.cgi?id=789747
This commit is contained in:
parent
a4e44e674e
commit
d13155c20c
|
@ -179,6 +179,7 @@
|
|||
/tools/*.[18]
|
||||
/tools/libvirt-guests.init
|
||||
/tools/libvirt-guests.service
|
||||
/tools/libvirt-guests.sh
|
||||
/tools/virsh
|
||||
/tools/virsh-*-edit.c
|
||||
/tools/virt-*-validate
|
||||
|
|
|
@ -1409,8 +1409,6 @@ rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/libvirtd.uml
|
|||
mv $RPM_BUILD_ROOT%{_datadir}/doc/libvirt-%{version} \
|
||||
$RPM_BUILD_ROOT%{_datadir}/doc/libvirt-docs-%{version}
|
||||
|
||||
sed -i -e "s|$RPM_BUILD_ROOT||g" $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/libvirt-guests
|
||||
|
||||
%if %{with_dtrace}
|
||||
%ifarch %{power64} s390x x86_64 ia64 alpha sparc64
|
||||
mv $RPM_BUILD_ROOT%{_datadir}/systemtap/tapset/libvirt_probes.stp \
|
||||
|
@ -1657,10 +1655,13 @@ fi
|
|||
|
||||
%dir %attr(0700, root, root) %{_sysconfdir}/libvirt/nwfilter/
|
||||
|
||||
%attr(0755, root, root) %{_libexecdir}/libvirt-guests.sh
|
||||
%if %{with_systemd}
|
||||
%{_unitdir}/libvirtd.service
|
||||
%{_unitdir}/libvirt-guests.service
|
||||
%else
|
||||
%{_sysconfdir}/rc.d/init.d/libvirtd
|
||||
%{_sysconfdir}/rc.d/init.d/libvirt-guests
|
||||
%endif
|
||||
%doc daemon/libvirtd.upstart
|
||||
%config(noreplace) %{_sysconfdir}/sysconfig/libvirtd
|
||||
|
@ -1925,7 +1926,6 @@ rm -f $RPM_BUILD_ROOT%{_sysconfdir}/sysctl.d/libvirtd
|
|||
|
||||
%{_datadir}/libvirt/cpu_map.xml
|
||||
|
||||
%{_sysconfdir}/rc.d/init.d/libvirt-guests
|
||||
%if %{with_systemd}
|
||||
%{_unitdir}/libvirt-guests.service
|
||||
%endif
|
||||
|
|
|
@ -197,7 +197,7 @@ src/xenapi/xenapi_utils.c
|
|||
src/xenxs/xen_sxpr.c
|
||||
src/xenxs/xen_xm.c
|
||||
tools/console.c
|
||||
tools/libvirt-guests.init.sh
|
||||
tools/libvirt-guests.sh.in
|
||||
tools/virsh.c
|
||||
tools/virsh-domain-monitor.c
|
||||
tools/virsh-domain.c
|
||||
|
|
|
@ -41,6 +41,7 @@ DISTCLEANFILES =
|
|||
|
||||
bin_SCRIPTS = virt-xml-validate virt-pki-validate
|
||||
bin_PROGRAMS = virsh virt-host-validate
|
||||
libexec_SCRIPTS = libvirt-guests.sh
|
||||
|
||||
if HAVE_SANLOCK
|
||||
sbin_SCRIPTS = virt-sanlock-cleanup
|
||||
|
@ -187,7 +188,7 @@ uninstall-sysconfig:
|
|||
rm -f $(DESTDIR)$(sysconfdir)/sysconfig/libvirt-guests
|
||||
rmdir $(DESTDIR)$(sysconfdir)/sysconfig ||:
|
||||
|
||||
EXTRA_DIST += libvirt-guests.init.sh
|
||||
EXTRA_DIST += libvirt-guests.sh.in libvirt-guests.init.in
|
||||
|
||||
install-initscript: libvirt-guests.init
|
||||
$(MKDIR_P) $(DESTDIR)$(sysconfdir)/rc.d/init.d
|
||||
|
@ -208,7 +209,7 @@ install-init:
|
|||
uninstall-init:
|
||||
endif # LIBVIRT_INIT_SCRIPT_RED_HAT
|
||||
|
||||
libvirt-guests.init: libvirt-guests.init.sh $(top_builddir)/config.status
|
||||
libvirt-guests.sh: libvirt-guests.sh.in $(top_builddir)/config.status
|
||||
$(AM_V_GEN)sed \
|
||||
-e 's!\@PACKAGE\@!$(PACKAGE)!g' \
|
||||
-e 's!\@bindir\@!$(bindir)!g' \
|
||||
|
@ -219,20 +220,26 @@ libvirt-guests.init: libvirt-guests.init.sh $(top_builddir)/config.status
|
|||
< $< > $@-t && \
|
||||
chmod a+x $@-t && \
|
||||
mv $@-t $@
|
||||
BUILT_SOURCES += libvirt-guests.sh
|
||||
|
||||
libvirt-guests.init: libvirt-guests.init.in libvirt-guests.sh
|
||||
$(AM_V_GEN)sed \
|
||||
-e 's!\@libexecdir\@!$(libexecdir)!g' \
|
||||
< $< > $@-t && \
|
||||
chmod a+x $@-t && \
|
||||
mv $@-t $@
|
||||
|
||||
|
||||
EXTRA_DIST += libvirt-guests.service.in
|
||||
|
||||
SYSTEMD_UNIT_DIR = /lib/systemd/system
|
||||
|
||||
if LIBVIRT_INIT_SCRIPT_SYSTEMD
|
||||
install-systemd: libvirt-guests.service install-initscript install-sysconfig
|
||||
install-systemd: libvirt-guests.service install-sysconfig libvirt-guests.sh
|
||||
$(MKDIR_P) $(DESTDIR)$(SYSTEMD_UNIT_DIR)
|
||||
$(INSTALL_DATA) libvirt-guests.service \
|
||||
$(DESTDIR)$(SYSTEMD_UNIT_DIR)/libvirt-guests.service
|
||||
|
||||
uninstall-systemd: uninstall-initscript uninstall-sysconfig
|
||||
uninstall-systemd: uninstall-sysconfig
|
||||
rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/libvirt-guests.service
|
||||
rmdir $(DESTDIR)$(SYSTEMD_UNIT_DIR) ||:
|
||||
|
||||
|
@ -251,6 +258,7 @@ libvirt-guests.service: libvirt-guests.service.in $(top_builddir)/config.status
|
|||
-e 's!\@localstatedir\@!$(localstatedir)!g' \
|
||||
-e 's!\@sbindir\@!$(sbindir)!g' \
|
||||
-e 's!\@sysconfdir\@!$(sysconfdir)!g' \
|
||||
-e 's!\@libexecdir\@!$(libexecdir)!g' \
|
||||
< $< > $@-t && \
|
||||
chmod a+x $@-t && \
|
||||
mv $@-t $@
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
#!/bin/sh
|
||||
|
||||
# the following is the LSB init header
|
||||
#
|
||||
### BEGIN INIT INFO
|
||||
# Provides: libvirt-guests
|
||||
# Required-Start: libvirtd
|
||||
# Required-Stop: libvirtd
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: suspend/resume libvirt guests on shutdown/boot
|
||||
# Description: This is a script for suspending active libvirt guests
|
||||
# on shutdown and resuming them on next boot
|
||||
# See http://libvirt.org
|
||||
### END INIT INFO
|
||||
|
||||
# the following is chkconfig init header
|
||||
#
|
||||
# libvirt-guests: suspend/resume libvirt guests on shutdown/boot
|
||||
#
|
||||
# chkconfig: 345 99 01
|
||||
# description: This is a script for suspending active libvirt guests \
|
||||
# on shutdown and resuming them on next boot \
|
||||
# See http://libvirt.org
|
||||
#
|
||||
|
||||
exec @libexecdir@/libvirt-guests.sh "$@"
|
|
@ -6,8 +6,8 @@ After=syslog.target network.target
|
|||
EnvironmentFile=-/etc/sysconfig/libvirt-guests
|
||||
# Hack just call traditional service until we factor
|
||||
# out the code
|
||||
ExecStart=/etc/init.d/libvirt-guests start
|
||||
ExecStop=/etc/init.d/libvirt-guests stop
|
||||
ExecStart=@libexecdir@/libvirt-guests.sh start
|
||||
ExecStop=@libexecdir@/libvirt-guests.sh stop
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
StandardOutput=journal+console
|
||||
|
|
|
@ -1,29 +1,5 @@
|
|||
#!/bin/sh
|
||||
|
||||
# the following is the LSB init header
|
||||
#
|
||||
### BEGIN INIT INFO
|
||||
# Provides: libvirt-guests
|
||||
# Required-Start: libvirtd
|
||||
# Required-Stop: libvirtd
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: suspend/resume libvirt guests on shutdown/boot
|
||||
# Description: This is a script for suspending active libvirt guests
|
||||
# on shutdown and resuming them on next boot
|
||||
# See http://libvirt.org
|
||||
### END INIT INFO
|
||||
|
||||
# the following is chkconfig init header
|
||||
#
|
||||
# libvirt-guests: suspend/resume libvirt guests on shutdown/boot
|
||||
#
|
||||
# chkconfig: 345 99 01
|
||||
# description: This is a script for suspending active libvirt guests \
|
||||
# on shutdown and resuming them on next boot \
|
||||
# See http://libvirt.org
|
||||
#
|
||||
|
||||
sysconfdir="@sysconfdir@"
|
||||
localstatedir="@localstatedir@"
|
||||
libvirtd="@sbindir@"/libvirtd
|
Loading…
Reference in New Issue