[virt-tools-list] [PATCH virt-viewer] spec: add spice-xpi-client-remote-viewer alternative

Marc-André Lureau marcandre.lureau at gmail.com
Tue Jan 31 22:31:53 UTC 2012


---
 data/Makefile.am                    |    1 +
 data/spice-xpi-client-remote-viewer |    6 ++++++
 virt-viewer.spec.in                 |   16 ++++++++++++++++
 3 files changed, 23 insertions(+), 0 deletions(-)
 create mode 100755 data/spice-xpi-client-remote-viewer

diff --git a/data/Makefile.am b/data/Makefile.am
index bd6386f..c0e701e 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -1,6 +1,7 @@
 NULL=
 
 EXTRA_DIST =					\
+	spice-xpi-client-remote-viewer		\
 	virt-viewer.nsis.in			\
 	$(NULL)
 
diff --git a/data/spice-xpi-client-remote-viewer b/data/spice-xpi-client-remote-viewer
new file mode 100755
index 0000000..3109c66
--- /dev/null
+++ b/data/spice-xpi-client-remote-viewer
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+logger -t spice "starting remote-viewer --spice-controller $@..."
+env | logger -t spice
+exec remote-viewer --spice-controller "$@" 2>&1 | logger -t spice
+logger -t spice "remote-viewer execution failed"
diff --git a/virt-viewer.spec.in b/virt-viewer.spec.in
index f29e564..54c3ad6 100644
--- a/virt-viewer.spec.in
+++ b/virt-viewer.spec.in
@@ -29,6 +29,8 @@ URL: http://virt-manager.org/
 Source0: http://virt-manager.org/download/sources/%{name}/%{name}-%{version}.tar.gz
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 Requires: openssh-clients
+Requires(post):   %{_sbindir}/update-alternatives
+Requires(postun): %{_sbindir}/update-alternatives
 
 %if %{with_gtk3}
 BuildRequires: gtk3-devel >= 3.0.0
@@ -109,6 +111,9 @@ browsers.
 %install
 rm -rf $RPM_BUILD_ROOT
 %__make install  DESTDIR=$RPM_BUILD_ROOT
+mkdir -p %{buildroot}%{_libexecdir}
+touch %{buildroot}%{_libexecdir}/spice-xpi-client
+install -m 0755 data/spice-xpi-client-remote-viewer %{buildroot}%{_libexecdir}/
 %if %{_with_plugin}
 rm -f %{buildroot}%{_libdir}/mozilla/plugins/%{name}-plugin.a
 rm -f %{buildroot}%{_libdir}/mozilla/plugins/%{name}-plugin.la
@@ -118,6 +123,15 @@ rm -f %{buildroot}%{_libdir}/mozilla/plugins/%{name}-plugin.la
 %clean
 rm -rf $RPM_BUILD_ROOT
 
+%post
+%{_sbindir}/update-alternatives --install %{_libexecdir}/spice-xpi-client \
+  spice-xpi-client %{_libexecdir}/spice-xpi-client-remote-viewer 20
+
+%postun
+if [ $1 -eq 0 ] ; then
+  %{_sbindir}/update-alternatives --remove spice-xpi-client %{_libexecdir}/spice-xpi-client-remote-viewer
+fi
+
 %files -f %{name}.lang
 %defattr(-,root,root,-)
 %doc README COPYING AUTHORS ChangeLog NEWS
@@ -128,6 +142,8 @@ rm -rf $RPM_BUILD_ROOT
 %{_datadir}/%{name}/ui/virt-viewer.xml
 %{_datadir}/%{name}/ui/virt-viewer-auth.xml
 %{_datadir}/%{name}/ui/virt-viewer-about.xml
+%ghost %{_libexecdir}/spice-xpi-client
+%{_libexecdir}/spice-xpi-client-remote-viewer
 %{_mandir}/man1/%{name}*
 
 %if %{_with_plugin}
-- 
1.7.7.6




More information about the virt-tools-list mailing list