#!/bin/bash # # Purpose : Install the NetworkManager dispatcher script that stops using a # Tailscale exit node while you sign in to a captive portal # (system/captive-portal). Run by install.sh and on every update # (updates.d/19-captive-portal.sh), so changes reach existing # machines. set -e COREDESKTOP="${COREDESKTOP:-$HOME/.local/share/coredesktop}" source "$COREDESKTOP/utils.sh" # For the tests ROOT="${CAPTIVE_PORTAL_ROOT:-}" SCRIPT="$ROOT/etc/NetworkManager/dispatcher.d/90-coredesktop-captive-portal" # NetworkManager runs only dispatcher scripts that root owns and only root can # change if ! cmp -s "$COREDESKTOP/system/captive-portal" "$SCRIPT"; then echo "Installing the captive portal helper for Tailscale exit nodes..." sudo install -D -m 755 "$COREDESKTOP/system/captive-portal" "$SCRIPT" fi # NetworkManager starts its dispatcher by its D-Bus name, which enabling it adds enable_services NetworkManager-dispatcher.service > /dev/null