File gksu.spec of Package gksu

#
# spec file for package gksu
#
# Copyright (c) 2015 SUSE LINUX 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:           gksu
Version:        2.0.2
Release:        0
Summary:        Graphical frontend to su
License:        GPL-2.0+
Group:          System/GUI/Other
Url:            http://nongnu.org/gksu
Source:         http://people.debian.org/~kov/gksu/%{name}-%{version}.tar.gz
Source1:        xsu.sh
# PATCH-FEATURE-OPENSUSE gksu-gsettings.patch sor.alexei@meowr.ru -- Port to GSettings from GConf.
Patch0:         %{name}-gsettings.patch

BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  gettext
BuildRequires:  intltool
BuildRequires:  libtool
BuildRequires:  pkg-config
BuildRequires:  update-alternatives
BuildRequires:  update-desktop-files
BuildRequires:  pkgconfig(gio-2.0)
BuildRequires:  pkgconfig(glib-2.0)
BuildRequires:  pkgconfig(gtk+-2.0)
BuildRequires:  pkgconfig(gtk-doc)
BuildRequires:  pkgconfig(libgksu2)
Requires:       bash
Requires(post): update-alternatives
Requires(postun): update-alternatives
Recommends:     sudo
Suggests:       xterm
Supplements:    (%{name} and xdg-utils)
Provides:       xsu = %{version}

%description
gksu is a Gtk+ frontend to /bin/su. It supports login shells and
preserving environment when acting as a su frontend. It is useful
to menu items or other graphical programs that need to ask a
user's password to run another program as another user.

%lang_package

%prep
%autosetup -p1

rm -f acinclude.m4
cp -f %{SOURCE1} xsu.exec
# Use icon from libgksu and remove "Root Terminal" menu entry.
sed -i '/icon/d;/desktop/d' Makefile.am
sed -i 's|/pixmaps/%{name}-icon.png|/icons/hicolor/48x48/apps/%{name}.png|g' %{name}/%{name}.c

%build
autoreconf -fi
%configure \
    --disable-static \
    --disable-nautilus-extension
%make_build

%install
%make_install
%if 0%{?suse_version} > 1500
%find_lang %{name} %{no_lang_C}
%endif

# Compatibility with SUSE xdg-su.
install -Dm 0755 xsu.exec %{buildroot}%{_libexecdir}/%{name}/xsu

# Create a dummy target for /etc/alternatives/xsu
mkdir -p %{buildroot}%{_sysconfdir}/alternatives/
touch %{buildroot}%{_sysconfdir}/alternatives/xsu
ln -s %{_sysconfdir}/alternatives/xsu %{buildroot}%{_bindir}/xsu

%post
%{_sbindir}/update-alternatives --install %{_bindir}/xsu xsu "%{_libexecdir}/%{name}/xsu" 10

%postun
if [ "$1" = 0 ] ; then
    %{_sbindir}/update-alternatives --remove xsu "%{_libexecdir}/%{name}/xsu"
fi

%files
%defattr(-,root,root)
%doc AUTHORS ChangeLog COPYING README
%ghost %{_sysconfdir}/alternatives/xsu
%{_bindir}/*su*
%{_libexecdir}/%{name}/
%{_mandir}/man1/%{name}*.1%{?ext_man}

%if 0%{?suse_version} > 1500
%files lang -f %{name}.lang
%endif

%changelog
openSUSE Build Service is sponsored by