From: Yu Watanabe Date: Tue, 11 Mar 2025 19:50:33 +0000 (+0900) Subject: resolve question marks in /etc/hostname to characters hashed from machine ID (#36647) X-Git-Tag: v258-rc1~1111 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ced634a62de036345b879144edf1c9f8498f0418;p=thirdparty%2Fsystemd.git resolve question marks in /etc/hostname to characters hashed from machine ID (#36647) 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` --- ced634a62de036345b879144edf1c9f8498f0418