feat: save hostname to file if it doesn't already exist
Some checks failed
Nix Format Check / check-format (push) Failing after 37s

This commit is contained in:
Menno van Leeuwen 2025-03-11 11:58:39 +01:00
parent 5aada55fd3
commit 7fd533f056
Signed by: vleeuwenmenno
SSH Key Fingerprint: SHA256:OJFmjANpakwD3F2Rsws4GLtbdz1TJ5tkQF0RZmF0TRE

View File

@ -280,6 +280,11 @@ prepare_hostname() {
return
else
hostname=$(hostname)
# If hostname_file doesn't exist let's also put the hostname in there
if [ ! -f "$hostname_file" ]; then
echo "$hostname" > "$hostname_file" || die "Failed to save hostname"
fi
log_warning "No hostname provided. Defaulting to the currently set hostname on the system. ($hostname)"
return
fi