File root4abuild.spec of Package root4abuild

#
# spec file for package 
#
# Copyright (c) 2014 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:           root4abuild
Version:        1.0
Release:        1.0
License:        BSD-3-Clause
Group:          Development/Tools/Building
Summary:        Sudo permissions for user abuild
Url:            http://permalink.gmane.org/gmane.linux.suse.opensuse.buildservice/20981
Requires:       sudo
BuildRequires:  sudo
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch


%description
This packet is for RPM-builds only. Don't install this on a production system.
In a build process user abuild can get root rights via sudo.

%prep

%build
cat > README  <<EOF
README package %name

This packet is for RPM-builds only. Don't install this on a production system.
In a build process user abuild can get root rights via sudo.
EOF

%install
install -m 644 -D README %{buildroot}%{_docdir}/%{name}/README

%post
echo 'Defaults:abuild !requiretty' >> /etc/sudoers
echo 'abuild ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers

%preun
sed -i '/Defaults:abuild !requiretty/d' /etc/sudoers
sed -i '/abuild ALL=(ALL) NOPASSWD: ALL/d' /etc/sudoers

%files
%defattr(-,root,root,-)
%doc %{_docdir}/%{name}

%changelog
openSUSE Build Service is sponsored by