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

init.d/hostname: fix /etc/hostname processing #728

Closed
wants to merge 1 commit into from

Conversation

williamh
Copy link
Contributor

This is an alternative to #585 in which we keep the init script but use hostname -F to read the value from @SYSCONFDIR@/hostname. This allows for comments in the hostname file.

Also, we deprecate using /etc/conf.d/* to set the host name.

This is an alternative to #585 in which we keep the init script but use
`hostname -F` to read the value from @SYSCONFDIR@/hostname. This allows
for comments in the hostname file.

Also, we deprecate using /etc/conf.d/* to set the host name.
@dwfreed
Copy link
Contributor

dwfreed commented Jul 26, 2024

This is not portable to non-Linux. FreeBSD's hostname does not support an -F flag. This is why the initscript currently reads the file itself.

@floppym
Copy link
Contributor

floppym commented Jul 26, 2024

It looks like sys-apps/coreutils[hostname] does not support the -F option either.

@navi-desu
Copy link
Member

i think the point of #585 was to avoid the overhead of an init script for the simple action of setting the hostname

i think we either move it to c code, or leave the script as is (maybe adding an explicit default for when /etc/hostname is missing, as currently the script noops on that case)

design wise i like the init script more, as we don't put openrc itself in charge of setting the hostname, but performance wise, doing it on c code is way less overhead

either way i think deprecating /etc/conf.d/hostname is a good idea, no point to have both it and /etc/hostname, and systemd accepts passing in the hostname via a kernel cmdline flag, maybe we should do smth similar?

@williamh
Copy link
Contributor Author

I'll go back to #585 and take a look at improving it more then. It may not be a bad idea to set the hostname in c, also this might be better since hostname -F isn't portable.

@williamh williamh closed this Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants