2023-01-25 21:02:34 -08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
### Install the Tailscale system daemon
|
|
|
|
if [ -d /Applications ] && [ -d System ]; then
|
|
|
|
# macOS
|
|
|
|
if command -v tailscaled > /dev/null; then
|
|
|
|
logg info 'Ensuring `tailscaled` system daemon is installed'
|
|
|
|
sudo tailscaled install-system-daemon
|
|
|
|
logg info '`tailscaled` system daemon is now installed and will load on boot'
|
|
|
|
else
|
|
|
|
logg info '`tailscaled` does not appear to be installed'
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
### Connect to Tailscale network
|
2023-01-29 23:47:45 -08:00
|
|
|
if command -v tailscale > /dev/null && [ "{{ env "TAILSCALE_AUTH_KEY" }}" != "" ]; then
|
2023-01-25 21:02:34 -08:00
|
|
|
logg info 'Connecting to Tailscale with user-defined authentication key'
|
2023-01-29 23:47:45 -08:00
|
|
|
tailscale up --authkey={{ env "TAILSCALE_AUTH_KEY" }} && logg success 'Connected to Tailscale network'
|
2023-01-25 21:02:34 -08:00
|
|
|
fi
|