install.fairie/home/.chezmoiscripts/universal/run_onchange_after_40-chrome.tmpl

34 lines
1.4 KiB
Cheetah
Raw Normal View History

{{- if ne .host.distro.family "windows" -}}
#!/usr/bin/env bash
{{ includeTemplate "universal/profile" }}
{{ includeTemplate "universal/logg" }}
### Ensure Chrome policies directory is present
if [ ! -d /etc/opt/chrome/policies/managed ]; then
logg info 'Creating directory /etc/opt/chrome/policies/managed'
sudo mkdir -p /etc/opt/chrome/policies/managed
fi
### Add Chrome policy
if [ -f "$HOME/.config/chrome/policies.json" ]; then
logg info 'Copying policies.json to /etc/opt/chrome/policies/managed/policies.json'
sudo cp -f "$HOME/.config/chrome/policies.json" /etc/opt/chrome/policies/managed/policies.json
fi
### Add Chrome extension JSON
Update 29 files - /home/.chezmoiscripts/universal/run_onchange_after_40-chrome.tmpl - /home/dot_config/vpn/Mullvad OVPN Greece (TCP 53).ovpn - /home/dot_config/vpn/Mullvad OVPN Los Angeles (TCP 443).ovpn - /home/dot_config/vpn/Mullvad OVPN Luxembourg (TCP 443).ovpn - /home/dot_config/vpn/Mullvad OVPN Romania (TCP 80).ovpn - /home/dot_config/vpn/Mullvad Shadowsocks Serbia (TCP 443+1080).ovpn - /home/dot_config/vpn/Mullvad WG Belgium (UDP 4888).conf - /home/dot_config/vpn/Mullvad WG Belgium (UDP 4888).nmconnection - /home/dot_config/vpn/Mullvad WG Japan (UDP 4888).conf - /home/dot_config/vpn/Mullvad WG Japan (UDP 4888).nmconnection - /home/dot_config/vpn/Mullvad WG Moldova (UDP 53).conf - /home/dot_config/vpn/Mullvad WG Moldova (UDP 53).nmconnection - /home/dot_config/vpn/Mullvad WG Singapore (UDP 4888).conf - /home/dot_config/vpn/Mullvad WG Singapore (UDP 4888).nmconnection - /home/dot_config/vpn/Proton OVPN Argentina (TCP 443+7770+8443).ovpn - /home/dot_config/vpn/Proton OVPN Finland (via Sweden) (TCP 443+7770+8443).ovpn - /home/dot_config/vpn/Proton OVPN France (TCP 443+7770+8443).ovpn - /home/dot_config/vpn/Proton OVPN Russia (via Iceland) (TCP 443+7770+8443).ovpn - /home/dot_config/vpn/Proton OVPN USA (TCP 443+7770+8443).ovpn - /home/dot_config/vpn/Proton WG Cambodia (UDP 51820).conf - /home/dot_config/vpn/Proton WG Cambodia (UDP 51820).nmconnection - /home/dot_config/vpn/Proton WG Colombia (UDP 51820).conf - /home/dot_config/vpn/Proton WG Colombia (UDP 51820).nmconnection - /home/dot_config/vpn/Proton WG Cyprus (UDP 51820).conf - /home/dot_config/vpn/Proton WG Cyprus (UDP 51820).nmconnection - /home/dot_config/vpn/Proton WG Serbia (UDP 51820).conf - /home/dot_config/vpn/Proton WG Serbia (UDP 51820).nmconnection - /home/dot_config/vpn/Proton WG Slovakia (UDP 51820).conf - /home/dot_config/vpn/Proton WG Slovakia (UDP 51820).nmconnection
2023-01-26 00:43:06 -08:00
for EXTENSION_DIR in "/opt/google/chrome/extensions" "$HOME/Library/Application Support/Google/Chrome/External Extensions" "$HOME/Library/Application Support/Microsoft/Edge/External Extensions"; do
if [ -d "$EXTENSION_DIR" ]; then
logg info "Adding Chrome extensions to $EXTENSION_DIR"
for EXTENSION in {{ list (.chromeExtensions | toString | replace "[" "" | replace "]" "") | uniq | join " " }}; do
logg info "Adding Chrome extension ($EXTENSION)"
EXTENSION_ID="$(echo "$EXTENSION" | sed 's/^.*\/\([^\/]*\)$/\1/')"
cp -f "${XDG_CONFIG_HOME:-$HOME/.config}/chrome/extension.json" "$EXTENSION_DIR/${EXTENSION_ID}.json"
done
else
logg info "$EXTENSION_DIR does not exist"
fi
fi
{{ end -}}