Update 5 files

- /home/dot_config/chrome/policies.json
- /home/.chezmoiscripts/universal/run_onchange_after_40-chrome.tmpl
- /home/dot_local/config/chrome-policy.sample
- /home/dot_config/chrome/recommended.json
- /home/dot_config/chrome/managed.json
This commit is contained in:
Brian Zalewski 2023-02-01 17:57:24 +00:00
parent 8449c99279
commit 37569aba19
5 changed files with 1163 additions and 16 deletions

View file

@ -5,25 +5,51 @@
{{ 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
for POLICY_DIR in "/opt/google/chrome/policies" "/etc/chromium/policies" "/etc/brave/policies"; do
### Managed policies
if [ ! -f "$POLICY_DIR/managed/policies.json" ]; then
logg info "Ensuring directory $POLICY_DIR/managed exists"
sudo mkdir -p "$POLICY_DIR/managed"
logg info "Copying ${XDG_CONFIG_HOME:-$HOME/.config}/chrome/managed.json to $POLICY_DIR/managed/policies.json"
sudo cp -f "${XDG_CONFIG_HOME:-$HOME/.config}/chrome/managed.json" "$POLICY_DIR/managed/policies.json"
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
### Recommended policies
if [ ! -f "$POLICY_DIR/recommended/policies.json" ]; then
logg info "Ensuring directory $POLICY_DIR/recommended exists"
sudo mkdir -p "$POLICY_DIR/recommended"
logg info "Copying ${XDG_CONFIG_HOME:-$HOME/.config}/chrome/recommended.json to $POLICY_DIR/recommended/policies.json"
sudo cp -f "${XDG_CONFIG_HOME:-$HOME/.config}/chrome/recommended.json" "$POLICY_DIR/recommended/policies.json"
fi
done
### Add Chrome extension JSON
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
for EXTENSION_DIR in "/opt/google/chrome/extensions" "/etc/chromium/extensions" "/etc/brave/extensions" "$HOME/Library/Application Support/Google/Chrome/External Extensions" "$HOME/Library/Application Support/Microsoft/Edge/External Extensions" "$HOME/Library/Application Support/BraveSoftware/Brave-Browser/Extensions" ; do
### Ensure program-type is installed
if [ -d "$(dirname "$EXTENSION_DIR")" ]; then
### Ensure extension directory exists
if [ "$EXTENSION_DIR" == '/opt/'* ] || [ "$EXTENSION_DIR" == '/etc/'* ]; then
if [ ! -d "$EXTENSION_DIR" ]; then
logg info "Creating directory $EXTENSION_DIR"
sudo mkdir -p "$EXTENSION_DIR"
fi
else
if [ ! -d "$EXTENSION_DIR" ]; then
logg info "Creating directory $EXTENSION_DIR"
mkdir -p "$EXTENSION_DIR"
fi
fi
### Add extension JSON
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/')"
if [ "$EXTENSION_DIR" == '/opt/'* ] || [ "$EXTENSION_DIR" == '/etc/'* ]; then
sudo cp -f "${XDG_CONFIG_HOME:-$HOME/.config}/chrome/extension.json" "$EXTENSION_DIR/${EXTENSION_ID}.json"
else
cp -f "${XDG_CONFIG_HOME:-$HOME/.config}/chrome/extension.json" "$EXTENSION_DIR/${EXTENSION_ID}.json"
fi
done
else
logg info "$EXTENSION_DIR does not exist"

View file

@ -0,0 +1,4 @@
{
"MetricsReportingEnabled": false
}

View file

@ -1,4 +0,0 @@
{
"PasswordManagerEnabled": false
}

View file

@ -0,0 +1,6 @@
{
"DefaultBrowserSettingEnabled": true,
"PasswordManagerEnabled": false,
"SafeBrowsingEnabled": true,
"TranslateEnabled": true
}

File diff suppressed because it is too large Load diff