Update hostname via reverse DNS lookup
Should help differentiate systems
This commit is contained in:
parent
56e354f124
commit
34925a72c0
2 changed files with 16 additions and 0 deletions
15
.linux_items/include/airootfs/etc/skel/.update_hostname
Executable file
15
.linux_items/include/airootfs/etc/skel/.update_hostname
Executable file
|
|
@ -0,0 +1,15 @@
|
|||
#!/bin/bash
|
||||
|
||||
IP="$(ip a show scope global \
|
||||
| grep inet \
|
||||
| head -1 \
|
||||
| sed -r 's#.*inet ([0-9]+.[0-9]+.[0-9]+.[0-9]+.)/.*#\1#')"
|
||||
HOSTNAME="$(dig +noall +answer +short -x "$IP" \
|
||||
| sed 's/\.$//')"
|
||||
|
||||
# Set hostname and renew DHCP lease
|
||||
sudo hostnamectl set-hostname "${HOSTNAME}"
|
||||
sudo dhclient -r
|
||||
sleep 1
|
||||
sudo dhclient
|
||||
|
||||
|
|
@ -12,6 +12,7 @@ conky -d
|
|||
nm-applet &
|
||||
cbatticon &
|
||||
volumeicon &
|
||||
$HOME/.update_hostname
|
||||
connect-to-network &
|
||||
(sleep 5s && killall dunst) &
|
||||
$HOME/.urxvt_default_res &
|
||||
|
|
|
|||
Loading…
Reference in a new issue