diff --git a/home/.chezmoitemplates/secrets/TAILSCALE_AUTH_KEY b/home/.chezmoitemplates/secrets/TAILSCALE_AUTH_KEY index 0ebb58e9..e18fd7fc 100644 --- a/home/.chezmoitemplates/secrets/TAILSCALE_AUTH_KEY +++ b/home/.chezmoitemplates/secrets/TAILSCALE_AUTH_KEY @@ -1,8 +1,8 @@ -----BEGIN AGE ENCRYPTED FILE----- -YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSB4eUNoMlc0VXNQS21zaURI -aFVtVGpsOGRWQTI0ZFc5ZmpEVUNZRSs5VTMwCmswKzcwOExpbVNZTHpXTE9hK1RW -N0dkRVRjZXNIYzhXT2tGcmZVMm1XbkkKLS0tIDFCeWJZR1hPN3BISi8wVUo1TmFa -QmVMNnhDUEtGbHNLL0kvcDRpN2FYK2sKjKuAZ9XM2UmZOj9ieANMi6i40MeHCWQV -aT+tQqnolBmenn0J+VVMSalhnc8/GsIx0kyUV2yM6WvfMWwnlzMUlLk4ULFJy2nl -vkooM7iZIf8DNXjAZ17uEJs= +YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBsaGJ1ZG9VWVduVDA4VFA1 +empCeDNERmtWeGhVWTQ5QlpSRXpybjZ2MUFNCkV3UzhXQ3BmRjdwc09LaU5XclNq +VnMyUjdBUXYrWERYVmdPSG4wZWk3TWMKLS0tIE0xQXVBWExnSkl0bndtTjg0cC93 +TjVadlVqU3U3aEFCcTB2WFN6UnZxSHcKQszLGd6LHfPXSqkIiF4BzCERqF34QOXJ +1vPj7h70g1ay2kjSZ73bw38eLtvne2nzUzEPu0J+XLq30S7j5Tcj9DC3JaetPnnx +25BHfHuTSD++Cj6aq/HA0fsQR9AcWw== -----END AGE ENCRYPTED FILE----- \ No newline at end of file diff --git a/home/dot_local/bin/post-installx/executable_post-tailscale.sh b/home/dot_local/bin/post-installx/executable_post-tailscale.sh index 4cd8b348..1ea9ef32 100644 --- a/home/dot_local/bin/post-installx/executable_post-tailscale.sh +++ b/home/dot_local/bin/post-installx/executable_post-tailscale.sh @@ -15,15 +15,34 @@ if [ -d /Applications ] && [ -d System ]; then else logg info 'tailscaled does not appear to be installed' fi + + ### Open Tailscale.app + if [ -d /Applications/Tailscale.app ]; then + logg info 'Opening Tailscale.app menu bar widget' && open -a Tailscale + else + logg info '/Applications/Tailscale.app is missing from the system' + fi fi ### Connect to Tailscale network -if command -v tailscale > /dev/null && [ "$TAILSCALE_AUTH_KEY" != "" ]; then - logg info 'Connecting to Tailscale with user-defined authentication key' - timeout 14 tailscale up --authkey="$TAILSCALE_AUTH_KEY" --accept-routes || EXIT_CODE=$? - if [ -n "$EXIT_CODE" ]; then - logg warn 'tailscale up timed out' +if [ -n "$TAILSCALE_AUTH_KEY" ] && [ "$TAILSCALE_AUTH_KEY" != "" ]; then + if [ -f /Applications/Tailscale.app/Contents/MacOS/Tailscale ]; then + logg info 'Connecting to Tailscale with user-defined authentication key (TAILSCALE_AUTH_KEY)' + timeout 30 /Applications/Tailscale.app/Contents/MacOS/Tailscale up --authkey="$TAILSCALE_AUTH_KEY" --accept-routes || EXIT_CODE=$? + if [ -n "$EXIT_CODE" ]; then + logg warn '/Applications/Tailscale.app/Contents/MacOS/Tailscale timed out' + fi + elif command -v tailscale > /dev/null && [ "$TAILSCALE_AUTH_KEY" != "" ]; then + logg info 'Connecting to Tailscale with user-defined authentication key (TAILSCALE_AUTH_KEY)' + timeout 30 tailscale up --authkey="$TAILSCALE_AUTH_KEY" --accept-routes || EXIT_CODE=$? + if [ -n "$EXIT_CODE" ]; then + logg warn 'tailscale up timed out' + else + logg success 'Connected to Tailscale network' + fi else - logg success 'Connected to Tailscale network' + logg info 'tailscale does not appear to be installed' fi -fi \ No newline at end of file +else + logg info 'TAILSCALE_AUTH_KEY is not defined so not logging into Tailscale network' +fi