aerospike / aerospike-client-c

Aerospike C Client
Other
98 stars 103 forks source link

RPM .spec file: error due to useradd not being able to create user directory #84

Closed andreblum closed 6 years ago

andreblum commented 6 years ago

If the /opt directory does not exist before installing the RPM, the installation will fail:

Adding group aerospike Adding user aerospike useradd: cannot create directory /opt/aerospike error: %pre(aerospike-client-c-4.1.3-1.el7.x86_64) scriptlet failed, exit status 12 Error in PREIN scriptlet in rpm package aerospike-client-c-4.1.3-1.el7.x86_64 Installing : alsa-lib-1.0.28-2.el7.x86_64 58/103 error: aerospike-client-c-4.1.3-1.el7.x86_64: install failed

The issue is that useradd does not use the -p flag for its mkdir. You could argue that it should, but it doesn't. Perhaps create the directory with mkdir -p /opt/aerospike early on on the .spec?

(Besides this issue, I question the necessity of creating a user and group for a client library)

BrianNichols commented 6 years ago

In the next C client release, "mkdir -p /opt" will be added just before useradd in the rpm installation scripts. It's best to let useradd create the aerospike part of the directory because useradd controls that directory's permissions via /etc/login.defs.

The client library and the server both need lua code to process aggregation queries. This code is currently stored in files via client and server installations. The shared files need to be installed somewhere under some user, so the aerospike user is created. This is not an issue for the server since the aerospike user is required for other reasons, but it's slightly awkward for the client.

It would be possible to load lua code from C strings instead of files, but this change would have to be made for both server and client because the logic is shared. We will look into this as a longer term project.

BrianNichols commented 6 years ago

C client 4.3.16 loads system lua code from C strings and no longer creates the aerospike user/group nor installs lua files.

https://www.aerospike.com/download/client/c/4.3.16/