dotfiles/packages/scripts/connect-to-mercury/connect-to-mercury
Christopher Mühl 786af32daf
Publish my config
This is the result of ~100 commits to my NixOS config. Since I haven't
always used `agenix-rekey`, this is another initial commit so that none
of the secrets in my git history are leaked
2025-07-30 23:36:39 +02:00

14 lines
371 B
Bash
Executable file

#!/usr/bin/env bash
hostname="mercury.local"
ip=$(dscacheutil -q host -a name ${hostname} | tail -n2 | head -n1 | cut -d' ' -f 2)
if [ -z "${ip}" ]; then
echo "Host ${hostname} seems to be down. Are you sure the VM is running?"
exit 1
fi
echo "${hostname}: ${ip}"
sudo route -n delete 172.17.0.0/16 &>/dev/null
sudo route -n add 172.17.0.0/16 "${ip}" &>/dev/null