pve-template-vm/initialize-host-id

8 lines
201 B
Bash

#!/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