SHA256
1
0
forked from pool/libvirt

- Fixup systemd support as per openSUSE systemd packaging

guidelines.

OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=185
This commit is contained in:
James Fehlig 2012-01-04 23:48:35 +00:00 committed by Git OBS Bridge
parent 2caea9a03a
commit ff2439ca46
3 changed files with 57 additions and 42 deletions

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Wed Jan 4 16:41:32 MST 2012 - jfehlig@suse.com
- Fixup systemd support as per openSUSE systemd packaging
guidelines.
-------------------------------------------------------------------
Tue Jan 3 09:20:43 MST 2012 - jfehlig@suse.com

View File

@ -152,6 +152,10 @@
# All supported version of openSUSE/SLE contain audit
%define with_audit 0%{!?_without_audit:1}
%if 0%{?suse_version} > 1140
%define with_systemd 0%{!?_without_systemd:1}
%endif
# Disable some drivers when building without libvirt daemon.
# The logic is the same as in configure.ac
%if ! %{with_libvirtd}
@ -311,7 +315,7 @@ BuildRequires: systemtap-sdt-devel
BuildRequires: sanlock-devel >= 1.8
%endif
%if %{with_systemd}
BuildRequires: systemd-units
BuildRequires: systemd
%endif
Name: libvirt
@ -385,10 +389,7 @@ Recommends: device-mapper
Requires: dmidecode
# For service management
%if %{with_systemd}
Requires(post): systemd-units
Requires(post): systemd-sysv
Requires(preun): systemd-units
Requires(postun): systemd-units
%{?systemd_requires}
%endif
Source0: %{name}-%{version}.tar.bz2
@ -725,7 +726,7 @@ export CFLAGS="$RPM_OPT_FLAGS"
make V=1 %{?jobs:-j%jobs} DOCS_DIR=%{_docdir}/%{name}-python EXAMPLE_DIR=%{_docdir}/%{name}-python/examples HTML_DIR=%{_docdir}/%{name}
%install
%makeinstall SYSTEMD_UNIT_DIR=%{buildroot}%{_unitdir} DOCS_DIR=%{_docdir}/%{name}-python EXAMPLE_DIR=%{_docdir}/%{name}-python/examples HTML_DIR=%{_docdir}/%{name}
%makeinstall SYSTEMD_UNIT_DIR=%{_unitdir} DOCS_DIR=%{_docdir}/%{name}-python EXAMPLE_DIR=%{_docdir}/%{name}-python/examples HTML_DIR=%{_docdir}/%{name}
cp -a AUTHORS ChangeLog COPYING NEWS README TODO $RPM_BUILD_ROOT%{_docdir}/%{name}/
cd docs ; cp -a *.html $RPM_BUILD_ROOT%{_docdir}/%{name} ; cp -a *.png $RPM_BUILD_ROOT%{_docdir}/%{name} ; cd ..
# remove currently unsupported locale(s)
@ -786,6 +787,9 @@ install -m 644 %{S:2} $RPM_BUILD_ROOT/%{_fwdefdir}/libvirtd-relocation-server
rm -rf $RPM_BUILD_ROOT
%pre
%if %{with_systemd}
%service_add_pre libvirtd.service
%endif
%{_bindir}/getent group libvirt >/dev/null || \
%{_sbindir}/groupadd -r libvirt 2>/dev/null
@ -802,37 +806,22 @@ then
> %{_sysconfdir}/libvirt/qemu/networks/default.xml
fi
%endif
%if 0%{?sles_version}
%if %{with_systemd}
if [ $1 -eq 1 ] ; then
# Initial installation
/bin/systemctl enable libvirtd.service >/dev/null 2>&1 || :
fi
%else # !systemd
%{fillup_and_insserv -y libvirtd}
%endif
%else # ! sles
%if %{with_systemd}
%service_add_post libvirtd.service libvirt-guests.service
%else
%if 0%{?sles_version}
%{fillup_and_insserv -y libvirtd}
%else # ! sles
%{fillup_only -n libvirtd}
%endif
%endif
%endif
%if %{with_systemd}
%else
%{fillup_only -n libvirt-guests}
%endif
%endif
%preun
%if %{with_libvirtd}
%if %{with_systemd}
if [ $1 -eq 0 ] ; then
# Package removal, not upgrade
/bin/systemctl --no-reload disable libvirtd.service > /dev/null 2>&1 || :
/bin/systemctl stop libvirtd.service > /dev/null 2>&1 || :
fi
%service_del_preun libvirtd.service libvirt-guests.service
%else
%stop_on_removal libvirtd
%endif
@ -842,21 +831,7 @@ fi
/sbin/ldconfig
%if %{with_libvirtd}
%if %{with_systemd}
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ] ; then
# Package upgrade, not uninstall
/bin/systemctl try-restart libvirtd.service >/dev/null 2>&1 || :
fi
%triggerun -- libvirt < 0.9.4
%{_bindir}/systemd-sysv-convert --save libvirtd >/dev/null 2>&1 ||:
# If the package is allowed to autostart:
/bin/systemctl --no-reload enable libvirtd.service >/dev/null 2>&1 ||:
# Run these because the SysV package being removed won't do them
/sbin/chkconfig --del libvirtd >/dev/null 2>&1 || :
/bin/systemctl try-restart libvirtd.service >/dev/null 2>&1 || :
%service_del_postun libvirtd.service libvirt-guests.service
%else
%restart_on_update libvirtd
%endif

View File

@ -275,3 +275,37 @@ Index: libvirt-0.9.8/daemon/Makefile.am
else
install-init-redhat:
uninstall-init-redhat:
Index: libvirt-0.9.8/daemon/libvirtd.sysconf
===================================================================
--- libvirt-0.9.8.orig/daemon/libvirtd.sysconf
+++ libvirt-0.9.8/daemon/libvirtd.sysconf
@@ -1,16 +1,25 @@
+## Path: System/Virtualization/libvirt
+
+## Type: string
+## Default: /etc/libvirt/libvirtd.conf
# Override the default config file
# NOTE: This setting is no longer honoured if using
# systemd. Set '--config /etc/libvirt/libvirtd.conf'
# in LIBVIRTD_ARGS instead.
-#LIBVIRTD_CONFIG=/etc/libvirt/libvirtd.conf
+LIBVIRTD_CONFIG=/etc/libvirt/libvirtd.conf
-# Listen for TCP/IP connections
-# NB. must setup TLS/SSL keys prior to using this
-#LIBVIRTD_ARGS="--listen"
+## Type: string
+## Default: --listen
+# Arguments to pass to libvirtd
+LIBVIRTD_ARGS="--listen"
+## Type: string
+## Default: none
# Override Kerberos service keytab for SASL/GSSAPI
#KRB5_KTNAME=/etc/libvirt/krb5.tab
+## Type: string
+## Default: none
# Override the QEMU/SDL default audio driver probing when
# starting virtual machines using SDL graphics
#