* 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
22 lines
435 B
Text
Executable file
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
|
|
|