Switch from consolehelper to PolicyKit (bz #502730)

This commit is contained in:
Terje Rsten 2012-05-08 21:42:25 +02:00
parent 873027d516
commit 20ce82d9af
5 changed files with 46 additions and 31 deletions

5
lshw-gui Normal file
View File

@ -0,0 +1,5 @@
#! /bin/bash
exec /usr/bin/pkexec /usr/sbin/gtk-lshw

View File

@ -1,3 +0,0 @@
USER=root
PROGRAM=/usr/sbin/lshw-gui
SESSION=true

View File

@ -1,4 +0,0 @@
#%PAM-1.0
auth include config-util
account include config-util
session include config-util

View File

@ -1,14 +1,14 @@
Summary: Hardware lister
Name: lshw
Version: B.02.16
Release: 2%{?dist}
Release: 3%{?dist}
License: GPLv2
Group: Applications/System
URL: http://ezix.org/project/wiki/HardwareLiSter
Source0: http://www.ezix.org/software/files/lshw-%{version}.tar.gz
Source1: lshw.desktop
Source2: lshw.consolehelper
Source3: lshw.pam
Source2: org.ezix.lshw.gui.policy
Source3: lshw-gui
BuildRequires: sqlite-devel
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires: hwdata
@ -22,22 +22,21 @@ PowerPC machines (PowerMac G4 is known to work).
Information can be output in plain text, XML or HTML.
%package gui
Summary: Graphical hardware lister
Group: Applications/System
Requires: usermode
Requires: hwdata
Requires: %{name} = %{version}-%{release}
%package gui
Summary: Graphical hardware lister
Group: Applications/System
Requires: polkit
Requires: %{name} = %{version}-%{release}
BuildRequires: gtk2-devel >= 2.4
BuildRequires: desktop-file-utils
%description gui
%description gui
Graphical frontend for the hardware lister (lshw) tool.
If desired, hardware information can be saved to file in
plain, XML or HTML format.
%prep
%setup -q -n %{name}-%{version}
%setup -q
%build
%{__make} %{?_smp_mflags} SBINDIR="%{_sbindir}" RPM_OPT_FLAGS="%{optflags}" SQLITE=1 gui
@ -69,27 +68,23 @@ pushd src
%{__ln_s} -f gtk-lshw %{buildroot}%{_sbindir}/lshw-gui
# don't package these copies, use the ones from hwdata instead
rm -f %{buildroot}%{_datadir}/%{name}/pci.ids
rm -f %{buildroot}%{_datadir}/%{name}/usb.ids
%{__rm} -f %{buildroot}%{_datadir}/%{name}/pci.ids
%{__rm} -f %{buildroot}%{_datadir}/%{name}/usb.ids
# don't package these copies, they're not actually used by the app,
# and even if they were, should use the hwdata versions
rm -f %{buildroot}%{_datadir}/%{name}/oui.txt
rm -f %{buildroot}%{_datadir}/%{name}/manuf.txt
%{__rm} -f %{buildroot}%{_datadir}/%{name}/oui.txt
%{__rm} -f %{buildroot}%{_datadir}/%{name}/manuf.txt
# desktop icon
%{__install} -D -m 0644 -p ./src/gui/artwork/logo.svg \
%{buildroot}%{_datadir}/pixmaps/%{name}-logo.svg
desktop-file-install --vendor fedora \
--dir %{buildroot}%{_datadir}/applications %{SOURCE1}
# consolehelper
%{__install} -d %{buildroot}%{_bindir}
%{__ln_s} -f consolehelper %{buildroot}%{_bindir}/%{name}-gui
# PolicyKit
%{__install} -D -m 0644 %{SOURCE2} \
%{buildroot}%{_sysconfdir}/security/console.apps/%{name}-gui
%{__install} -D -m 0644 %{SOURCE3} \
%{buildroot}%{_sysconfdir}/pam.d/%{name}-gui
%{buildroot}%{_datadir}/polkit-1/actions/org.ezix.lshw.gui.policy
%{__install} -D -m 0755 %{SOURCE3} %{buildroot}%{_bindir}/lshw-gui
%find_lang %{name}
@ -105,16 +100,18 @@ desktop-file-install --vendor fedora \
%files gui
%defattr(-, root, root, -)
%doc COPYING
%config(noreplace) %{_sysconfdir}/pam.d/%{name}-gui
%config(noreplace) %{_sysconfdir}/security/console.apps/%{name}-gui
%{_bindir}/%{name}-gui
%{_sbindir}/gtk-%{name}
%{_sbindir}/%{name}-gui
%{_datadir}/%{name}
%{_datadir}/pixmaps/%{name}-logo.svg
%{_datadir}/applications/fedora-%{name}.desktop
%{_datadir}/polkit-1/actions/org.ezix.lshw.gui.policy
%changelog
* Tue May 08 2012 Terje Rosten <terje.rosten@ntnu.no> - B.02.16-3
- Switch from consolehelper to PolicyKit (bz #502730)
* Tue Feb 28 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - B.02.16-2
- Rebuilt for c++ ABI breakage

20
org.ezix.lshw.gui.policy Normal file
View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
<policyconfig>
<vendor>lshw</vendor>
<vendor_url>http://ezix.org/project/wiki/HardwareLiSter</vendor_url>
<action id="org.ezix.lshw.gui.pkexec.run">
<description>Hardware Lister (lshw) - list hardware information</description>
<message>Authentication is required to run lshw-gui</message>
<icon_name>lshw-logo</icon_name>
<defaults>
<allow_any>no</allow_any>
<allow_inactive>no</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.exec.path">/usr/sbin/gtk-lshw</annotate>
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
</action>
</policyconfig>