Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

portstartupitem: add startupitem options so that ports can specify the user and group to run a launchd service as #202

Merged
merged 1 commit into from
Oct 2, 2020

Conversation

herbygillot
Copy link
Member

This PR makes the following options available to Portfiles:

startupitem.user
startupitem.group

With these, ports can now specify the user and group that launchd will run the port's daemon process under. These will create <UserName> and <GroupName> entries, respectively, in the launchd plist file. Per @ryandesign's comment, these options have been available in launchd since 10.4.

This was tested manually. I wanted to check this in with proper tests, but was not having much success as I don't have enough of an understanding of the MacPorts internals.

@ryandesign
Copy link
Contributor

Thanks, this should be useful. I tried it and the launchd plist it created looked correct.

Please limit the first line of the commit message to 50 characters. In base we don't enforce a component name prefix, so you have those extra characters available to you. If you need more than 50, leave a blank line and continue with paragraphs of up-to-72-character lines. Please add See: https://trac.macports.org/ticket/13807 to the end of the commit message.

Ports can now use these to tell launchd which user and group to run the
daemon process as.

See: https://trac.macports.org/ticket/13807
@herbygillot
Copy link
Member Author

herbygillot commented Aug 18, 2020

OK, commit message fixed.

Also:

https://trac.macports.org/ticket/13807

13 years ago! 😱😱😱😱

@herbygillot
Copy link
Member Author

herbygillot commented Aug 23, 2020

I changed the commit message as requested. Is this OK to merge?

@raimue
Copy link
Member

raimue commented Aug 24, 2020

I agree this should indeed be possible to specify. How does this interact with startupitems using daemondo? It will attempt to write a pid file to ${prefix}/var/run, which is owned by root. It cannot be written anymore when launchd already drops privileges. This is especially important for script startupitems (those with .start/.stop commands) as this is needed to kill/reload the daemon process.

Copy link
Sponsor Member

@neverpanic neverpanic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess startupitems that use user and group will likely be unable to use daemondo. Since that's a choice the Portfile author has, and the default is not to set user or group, merging this will add new functionality but not break existing functionality. I'll thus merge this now – we can always improve user/group together with daemondo later.

@neverpanic neverpanic merged commit b493d53 into macports:master Oct 2, 2020
@herbygillot
Copy link
Member Author

Thanks @neverpanic

@mascguy
Copy link
Member

mascguy commented Aug 14, 2023

Why was this approved and merged, without any updates to either the guide or manpage for portfile?

The lack of any documentation updates completely undermine the usefulness of new features, as they might as well not exist. And we shouldn't need to search the release notes, to see whether something exists.

Going forward, perhaps new feature additions - or at least, those that introduce new keywords - shouldn't be merged without both?

@mascguy
Copy link
Member

mascguy commented Aug 14, 2023

I guess startupitems that use user and group will likely be unable to use daemondo. Since that's a choice the Portfile author has, and the default is not to set user or group, merging this will add new functionality but not break existing functionality. I'll thus merge this now – we can always improve user/group together with daemondo later.

Is this still accurate, as of the current MacPorts release? If so, what are the specific issues/limitations...?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants