/usr/sbin/groupadd: No such file or directory

Hi,
I’m trying to create a system user during the installation of a package, and added the line(s)

getent group tryton > /dev/null || /usr/sbin/groupadd -r tryton

in the spec file.
As a result, the rpm-check gives

/.build_patchrpmcheck_scr: line 1: /usr/sbin/groupadd: No such file or directory
41s] preinstall script of trytond-2.8.1-17.1.noarch.rpm failed

…this is strange, as

docb@T520:~> dir /usr/sbin/group*
-rwxr-xr-x 1 root root 54656 5. Feb 15:58 /usr/sbin/groupadd
-rwxr-xr-x 1 root root 50344 5. Feb 15:58 /usr/sbin/groupdel
-rwxr-xr-x 1 root root 61120 5. Feb 15:58 /usr/sbin/groupmod

…so it should exist. Any idea what the problem is?

groupadd is part of the package “shadow”.
Maybe that is not installed on OBS when it tries to install your package? Try to Require it explicitely.

In your case the correct thing would be to add a line like this to your spec file (if you call groupadd in %pre):

Requires(pre): /usr/sbin/groupadd

or if it is called in the %post scriptlet:

Requires(post): /usr/sbin/groupadd

and so on…

See: PackagerDocs/Dependencies - rpm - Trac

While your trial to improve readability of your post is appreciated, please use CODE tags around computer text rather then QUOTE tags. It is the # button in the tool bar of the post editor.

That fixed it, thanks!