Skip to content

Instantly share code, notes, and snippets.

@melyux
Created June 11, 2021 18:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save melyux/b1a34262991e915f022dcd2461740ef0 to your computer and use it in GitHub Desktop.
Save melyux/b1a34262991e915f022dcd2461740ef0 to your computer and use it in GitHub Desktop.
Raspberry Pi - /etc/dhcpcd.enter-hook to disable Wi-Fi when Ethernet is plugged in and gets an IP address, and enable Wi-Fi on unplug
if [ "$reason" = "NOCARRIER" ] && [ "$interface" = "eth0" ]; then
rfkill unblock wifi
elif [ "$reason" = "BOUND" ] && [ "$interface" = "eth0" ]; then
rfkill block wifi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment