install.fairie/home/.chezmoiscripts/universal/run_onchange_after_14-warp.tmpl
Brian Zalewski 645061d191 Update 8 files
- /home/.chezmoiscripts/universal/run_onchange_after_24-vpn-darwin.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_14-warp.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_80-bash-completions.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_14-install-aqua-packages.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_40-chrome.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_40-firefox.tmpl
- /home/dot_config/aqua/aqua.yaml
- /software.yml
2023-03-27 06:57:26 +00:00

45 lines
2.2 KiB
Cheetah

{{- if (ne .host.distro.family "windows") -}}
#!/usr/bin/env bash
{{ includeTemplate "universal/profile" }}
{{ includeTemplate "universal/logg" }}
### Configure CloudFlare WARP (if not WSL and warp-cli is installed)
if [[ ! "$(test -d /proc && grep Microsoft /proc/version > /dev/null)" ]] && command -v warp-cli > /dev/null; then
### Register CloudFlare WARP
if warp-cli --accept-tos status | grep 'Registration missing' > /dev/null; then
logg info 'Registering CloudFlare WARP'
warp-cli --accept-tos register
else
logg info 'Already registered with CloudFlare WARP'
fi
### Connect CloudFlare WARP
if warp-cli --accept-tos status | grep 'Disconnected' > /dev/null; then
logg info 'Connecting to CloudFlare WARP'
warp-cli --accept-tos connect
else
logg info 'Already connected to CloudFlare WARP'
fi
### Enable Always-On mode
logg info 'Enabling always-on mode'
warp-cli --accept-tos enable-always-on
### Enable Family Mode
# logg info 'Enabling family-mode'
# warp-cli --accept-tos set-families-mode full
### Enable WARP+DNS mode
# logg info 'Enabling WARP+DNS mode'
# warp-cli set-mode warp+doh
# TODO
{{ if and (or (and (stat (joinPath .host.home ".config" "age" "chezmoi.txt")) (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "CLOUDFLARE_TEAMS_CLIENT_ID"))) (env "CLOUDFLARE_TEAMS_CLIENT_ID")) (or (and (stat (joinPath .host.home ".config" "age" "chezmoi.txt")) (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "CLOUDFLARE_TEAMS_CLIENT_SECRET"))) (env "CLOUDFLARE_TEAMS_CLIENT_SECRET")) -}}
### Enroll with CloudFlare Teams
logg info 'Enrolling with CloudFlare Teams'
warp-cli teams-enroll '{{ if (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "CLOUDFLARE_TEAMS_CLIENT_ID")) }}{{ includeTemplate "secrets/CLOUDFLARE_TEAMS_CLIENT_ID" | decrypt }}{{ else }}{{ env "CLOUDFLARE_TEAMS_CLIENT_ID" }}{{ end }}' '{{ if (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "CLOUDFLARE_TEAMS_CLIENT_SECRET")) }}{{ includeTemplate "secrets/CLOUDFLARE_TEAMS_CLIENT_SECRET" | decrypt }}{{ else }}{{ env "CLOUDFLARE_TEAMS_CLIENT_SECRET" }}{{ end }}'
{{- end }}
fi
{{ end -}}