Install a one-shot service to initialize hostid

This commit is contained in:
Stefan Bethke 2026-03-31 19:55:02 +02:00
commit 7ebf94cc23
3 changed files with 28 additions and 2 deletions

8
initialize-host-id Normal file
View file

@ -0,0 +1,8 @@
#!/bin/sh
#
# Initialize /etc/hostid if it doesn't exist or is empty
#
if [ ! -f /etc/hostid -o "$(cat /etc/hostid 2>/dev/null)" = "" ]; then
hexdump -n 4 -e '"%02x"' /dev/urandom >/etc/hostid
fi