]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resolve question marks in /etc/hostname to characters hashed from machine ID (#36647)
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 11 Mar 2025 19:50:33 +0000 (04:50 +0900)
committerGitHub <noreply@github.com>
Tue, 11 Mar 2025 19:50:33 +0000 (04:50 +0900)
So I have a bunch of particle os instances around, that I frequently
factory reset. and it's confusing, since they all have the same name.
Let's do something about this, and extend the hostname setup logic a bit
to deal better with "cattle" rather than "pet" deployments.
Specifically: if a hostname in /etc/hostname contains a bunch of
question marks we'll replace it with hex chars hashed from the machine
id.

This allows us to do something like this:

hostnamectl set-hostname --static 'funky-????-????-???'

and we'll end up with a hostname like `funky-baf4-b653-e230`

1  2 
TODO

diff --cc TODO
Simple merge