File webyast-reboot-ws.spec of Package webyast-reboot-ws
#
# spec file for package webyast-reboot-ws
#
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: webyast-reboot-ws
Provides: WebYaST(org.opensuse.yast.system.system)
Provides: yast2-webservice-system = %{version}
Obsoletes: yast2-webservice-system < %{version}
PreReq: yast2-webservice
# requires HAL for reboot/shutdown actions
Requires: hal
License: GPLv2
Group: Productivity/Networking/Web/Utilities
Url: http://en.opensuse.org/Portal:WebYaST
AutoReqProv: on
Version: 0.2.0
Release: 1
Summary: WebYaST - reboot/shutdown service
Source: www.tar.bz2
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
BuildRequires: rubygem-webyast-rake-tasks >= 0.1.3
BuildRequires: rubygem-restility
BuildRequires: webyast-base-ws-testsuite
# the testsuite is run during build
BuildRequires: rubygem-mocha rubygem-test-unit
#
%define plugin_name system
%define plugin_dir %{webyast_ws_dir}/vendor/plugins/%{plugin_name}
#
%package testsuite
License: GPLv2
Group: Productivity/Networking/Web/Utilities
Requires: %{name} = %{version}
Requires: webyast-base-ws-testsuite
Summary: Testsuite for webyast-reboot-ws package
%description
WebYaST - Plugin providing REST based interface for system reboot/shutdown.
Authors:
--------
Ladislav Slezak <lslezak@novell.com>
%description testsuite
Testsuite for webyast-reboot-ws webservice package.
%prep
%setup -q -n www
%build
# build restdoc documentation
mkdir -p public/%{plugin_name}/restdoc
%webyast_ws_restdoc
# do not package restdoc sources
rm -rf restdoc
#do not package generated doc
rm -rf doc
%check
%webyast_ws_check
%install
#
# Install all web and frontend parts.
#
mkdir -p $RPM_BUILD_ROOT%{plugin_dir}
cp -a * $RPM_BUILD_ROOT%{plugin_dir}/
rm -f $RPM_BUILD_ROOT%{plugin_dir}/COPYING
%clean
rm -rf $RPM_BUILD_ROOT
%post
# granting all permissions for the web user
#FIXME don't silently fail
polkit-auth --user %{webyast_ws_user} --grant org.freedesktop.hal.power-management.shutdown >& /dev/null || true
polkit-auth --user %{webyast_ws_user} --grant org.freedesktop.hal.power-management.shutdown-multiple-sessions >& /dev/null || true
polkit-auth --user %{webyast_ws_user} --grant org.freedesktop.hal.power-management.reboot >& /dev/null || true
polkit-auth --user %{webyast_ws_user} --grant org.freedesktop.hal.power-management.reboot-multiple-sessions >& /dev/null || true
# granting all permissions for root
polkit-auth --user root --grant org.freedesktop.hal.power-management.shutdown >& /dev/null || true
polkit-auth --user root --grant org.freedesktop.hal.power-management.shutdown-multiple-sessions >& /dev/null || true
polkit-auth --user root --grant org.freedesktop.hal.power-management.reboot >& /dev/null || true
polkit-auth --user root --grant org.freedesktop.hal.power-management.reboot-multiple-sessions >& /dev/null || true
%postun
# don't remove the rights during package update ($1 > 0)
# see https://fedoraproject.org/wiki/Packaging/ScriptletSnippets#Syntax for details
if [ $1 -eq 0 ] ; then
# discard all configured permissions for the web user
polkit-auth --user %{webyast_ws_user} --revoke org.freedesktop.hal.power-management.shutdown >& /dev/null || :
polkit-auth --user %{webyast_ws_user} --revoke org.freedesktop.hal.power-management.shutdown-multiple-sessions >& /dev/null || :
polkit-auth --user %{webyast_ws_user} --revoke org.freedesktop.hal.power-management.reboot >& /dev/null || :
polkit-auth --user %{webyast_ws_user} --revoke org.freedesktop.hal.power-management.reboot-multiple-sessions >& /dev/null || :
fi
%files
%defattr(-,root,root)
%dir %{webyast_ws_dir}
%dir %{webyast_ws_dir}/vendor
%dir %{webyast_ws_dir}/vendor/plugins
%dir %{plugin_dir}
%{plugin_dir}/README
%{plugin_dir}/Rakefile
%{plugin_dir}/init.rb
%{plugin_dir}/install.rb
%{plugin_dir}/uninstall.rb
%{plugin_dir}/app
%{plugin_dir}/config
%{plugin_dir}/public
%doc COPYING
%files testsuite
%defattr(-,root,root)
%{plugin_dir}/test
%changelog