tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Using RC scripts unprivileged and on more platforms



			Hi tech-pkg@,

Currently dealing with the pain of starting services installed with pkgsrc (unprivileged) on macOS, I just had the following idea:
- ship an equivalent to rc.subr in pkgsrc (possibly a port for the target platform)
- modify RC scripts to source it instead of /etc/rc.subr (when relevant)

The two patches attached are my first attempt at implementing exactly that; while the first one deals with the infrastructure, the second updates RC scripts in bulk. Both are against 2021Q1, but the latter should be easy to adapt to current:

pkgsrc$ find */ -name '*.sh' -exec gsed -i -e s,/etc/rc.subr,@SYSCONFBASE@/rc.subr, {} \+
(revbumps not included)

Here I have chosen to ship and install rc.subr in pkg_install. It may not be the best or most elegant way, so I am open to suggestions.
I had to create a workaround in this case, because pkg_install does not install its own configuration files by default, since it ships its own INSTALL script.
(We should probably support this regardless of my proposal, in order to possibly install a sample pkg_install.conf for instance)

Anyhow, I understand that this proposal might introduce relatively intrusive changes, so while I tried to keep changes and complexity to a minimum, I would like to have explicit approval before committing it.

In my tests so far, it works as expected on NetBSD 9 (amd64), which I already find to be a significant improvement to pkgsrc’s capabilities: I am now able to start and stop nginx directly after changing its default port to 8080, through its RC script, in an unprivileged build.

I am going to test on macOS next thing.

Attachment: patch-sysconfbase.diff
Description: Binary data

Attachment: patch-sysconfbase_rcd.diff
Description: Binary data


Cheers,
--
khorben

Attachment: signature.asc
Description: Message signed with OpenPGP



Home | Main Index | Thread Index | Old Index