install.fairie/home/.chezmoiscripts/universal/run_onchange_after_24-vpn-darwin.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

32 lines
No EOL
1.3 KiB
Cheetah

{{- if (eq .host.distro.family "darwin") -}}
#!/usr/bin/env bash
{{ includeTemplate "universal/profile" }}
{{ includeTemplate "universal/logg" }}
# TODO - Populate Tunnelblick on macOS using the .ovpn profiles located in $HOME/.config/vpn
# along with the secrets for the protonVPN OpenVPN (check vpn-linux.tmpl)
### Backup previous network settings
if [ -f /Library/Preferences/com.apple.networkextension.plist ]; then
logg info 'Backing up /Library/Preferences/com.apple.networkextension.plist to /Library/Preferences/com.apple.networkextension.plist.old'
sudo cp -f /Library/Preferences/com.apple.networkextension.plist /Library/Preferences/com.apple.networkextension.plist.old
else
logg info 'The /Library/Preferences/com.apple.networkextension.plist file does not exist yet'
fi
### Ensure /etc/wireguard exists
if [ ! -d /etc/wireguard ]; then
logg info 'Creating `/etc/wireguard` since it does not exist yet'
sudo mkdir -p /etc/wireguard
sudo chmod 600 /etc/wireguard
fi
### Add the WireGuard configurations
find "${XDG_CONFIG_HOME:-$HOME/.config}/vpn" -mindepth 1 -maxdepth 1 -type f -name "*.conf" | while read WG_CONF; do
WG_FILE="$(basename "$WG_CONF")"
logg info 'Adding `'"$WG_FILE"'` to /etc/wireguard'
sudo cp -f "$WG_CONF" "/etc/wireguard/$WG_FILE"
done
{{ end -}}