How to package with HaikuPorts

I’m currently polishing the MariaDB package port and I have a few general questions on the way to improve it :

  • I’ve noticed that in case of NGinx package, the user/group “nginx” were created : I wasn’t aware that Haiku could create additional users : does it mean that for MariaDB, it could be useful to have a dedicated user/group like “mysql:mysql” ?

For the moment I’ve used the default user “user” which has the root provilege

  • In case of uninstalling the package, I would like to let the user decide if the mariadb databases (currently in /boot/home/config/var/mariadb/data/) should be cleaned up or not

I guess I have to use the “$preUninstallDir” and write a ksh to do that ?
For the moment no package in Haiku Ports is using this feature, that’s why I’m asking

  • In case of installation, I will investigate if the current mariadb scripts can be enhanced to allow to enter a username/password for the “root” mariadb user

I will use “$postInstallDir” for that. I know that command like “filedialog” gives the possibility to select a file . Is there any equivalent command to ask for a string or a password from a user ?

1 Like

Additional point : if there’s no way to ask for a username / password like for filedialog would it make sense to integrate a tool like shanty in Haiku directly ?

Good catch on the example for nginx, I guess that process indeed could be useful to create a user/group mysql:mysql (not to interfere with existing users and a check to make sure the user doesn’t exist).

On the uninstall part, so far there is no feature in pkgman/haikuporter that I know of to uninstall user related/installed directories/files.

We got HaikuUtils that handles users, but I don’t think you can create groups with that.

Probably best to just skip this, users can change the password of the mariadb user as usual with passwd later on if necessary.

I found a nice page with explanations on the matter, in case, a txt file could be added with some basic explanations?

https://wiki.archlinux.org/title/MariaDB

Yes good idea, I was thinking about this option too