WizardKit/.linux_items/include/airootfs/etc/skel/.update_network
2Shirt 1e6f486865
Adjusted X startup sequence
* Moved most X startup logic to ~/.update_x
  * This is called by both i3 and openbox
* Network logic moved to .zlogin
  * This avoids a bug where apps can no longer connect to the $DISPLAY
2018-09-27 23:10:30 -06:00

22 lines
435 B
Text
Executable file

## .update_network ##
#!/bin/env bash
#
## Connect to network and update hostname
# Connect
connect-to-network
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" \
| grep -v ';' \
| head -1 \
| sed 's/\.$//')"
# Set hostname
if [[ "${HOSTNAME:+x}" ]]; then
sudo hostnamectl set-hostname "${HOSTNAME}"
fi