Mailinglist Archive: opensuse-buildservice (166 mails)

< Previous Next >
Re: [opensuse-buildservice] run commands from spec file as root
I use a package root4abuild created via attached spec-file.
Use this package as a build-requirement for your package
and you can gain root-rights for abuild via sudo during
the build-process.

Might be a little bit ugly but works for me.



Am 13.05.2014 23:45, schrieb Ruediger Meier:

is it possible to run a command from %build section as root?
I thought it's possoble somehow but can't find it.


# 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

Name: root4abuild
Version: 1.0
Release: 1.0
License: drivers
Summary: During build user abuild can get root-rights via sudo
Requires: sudo
BuildRequires: sudo
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
BuildRequires: -post-build-checks

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

echo 'abuild ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers

sed -i "/abuild ALL=(ALL) NOPASSWD: ALL/d" /etc/sudoers


* Tue Jan 16 2014 some one <someone@xxxxxxxxxxxx>
- Initial

< Previous Next >
Follow Ups