generated from alice-meta-packages/alice-meta-template
12 lines
259 B
Plaintext
12 lines
259 B
Plaintext
|
#!/bin/sh
|
||
|
|
||
|
IP=$(hostname -I | awk '{print $1}')
|
||
|
HOSTNAME=$(getent hosts | grep $IP | awk '{print $2}')
|
||
|
|
||
|
if [ -n "$HOSTNAME" ]; then
|
||
|
hostnamectl set-hostname "$HOSTNAME"
|
||
|
echo "Hostname set to $HOSTNAME"
|
||
|
else
|
||
|
echo "Hostname not found for IP $IP"
|
||
|
fi
|