cross-platform-actions / action

Cross-platform GitHub action
MIT License
128 stars 19 forks source link

How to install software (dependency) on OpenBSD? #75

Open alexander-naumov opened 9 months ago

alexander-naumov commented 9 months ago

Hello, I'm trying to use this action for OpenBSD build. I need to install dependency inside OpenBSD. As I can see, it runs as runner user. This user is not allowed to install packages.

pkg_add package_name doesn't work. We get an error pkg_add: pkg_add must be run as root. This is correct. Normally we execute pkg_add as a root user or via doas.

doas pkg_add package_name doesn't work. We get an error doas: doas is not enabled, /etc/doas.conf: No such file or directory

So, my question is: how to install software inside OpenBSD?

manxorist commented 9 months ago

sudo works for me (https://github.com/OpenMPT/openmpt/blob/91768c03cdca42dc0a293576c351008d39bd26df/.github/workflows/OpenBSD-7.4-Makefile.yml#L30)

jacob-carlborg commented 9 months ago

So, my question is: how to install software inside OpenBSD?

@alexander-naumov as mentioned, sudo is available. Perhaps not that visible, but it's documented in the openbsd-builder repository [1]. I'm not that familiar with OpenBSD, is doas what's expected to be used instead of sudo?

[1] https://github.com/cross-platform-actions/openbsd-builder#openbsd-builder

manxorist commented 9 months ago

As far as I understand it (not an OpenBSD user either), doas is OpenBSD's recommended replacement for sudo. Given that sudo's configuration syntax has always been very confusing for me (which is a really bad sign for a security-related tool), I can understand their motivation. I think a working doas configuration for OpenBSD would be desirable. I would also keep sudo as currently configured, to allow for consistent use of sudo across different systems.

alexander-naumov commented 9 months ago

Thank you guys! It works.

kobalicek commented 9 months ago

BTW I had some similar issues and to unify builds of my projects I have created build-actions script, that does a preparation by installing cmake and a C/C++ compiler. I didn't really intend to promote this as it's mostly for my use cases, but if you want to take a look and get some inspiration:

https://github.com/build-actions/build-actions

It's written in python, so it also has a prepare-environment.sh script, which installs python.

This works for me on Windows, Linux, Mac, and BSD VMs. If anyone wants to use this or extend that I'm interested in making it better.