From 8a91bb78751f547bf2fde03d7d9d934c870a66df Mon Sep 17 00:00:00 2001 From: Brian Zalewski <59970525+ProfessorManhattan@users.noreply.github.com> Date: Wed, 14 Jun 2023 07:06:20 +0000 Subject: [PATCH] Latest --- .../run_onchange_after_28-privoxy.sh.tmpl | 2 +- .../run_onchange_after_39-vim-plugins.sh.tmpl | 2 +- .../run_onchange_after_40-chrome.sh.tmpl | 30 +++++++++++-------- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/home/.chezmoiscripts/universal/run_onchange_after_28-privoxy.sh.tmpl b/home/.chezmoiscripts/universal/run_onchange_after_28-privoxy.sh.tmpl index f127655d..fd76bc09 100644 --- a/home/.chezmoiscripts/universal/run_onchange_after_28-privoxy.sh.tmpl +++ b/home/.chezmoiscripts/universal/run_onchange_after_28-privoxy.sh.tmpl @@ -53,7 +53,7 @@ if command -v privoxy > /dev/null; then logg warn 'The '"$PRIVOXY_CONFIG_DIR"' directory is missing' fi else - logg warn '`privoxy` is missing from the PATH' + logg logg '`privoxy` is missing from the PATH - skipping configuration' fi {{ end -}} diff --git a/home/.chezmoiscripts/universal/run_onchange_after_39-vim-plugins.sh.tmpl b/home/.chezmoiscripts/universal/run_onchange_after_39-vim-plugins.sh.tmpl index 77aa838e..d2ffe2b2 100644 --- a/home/.chezmoiscripts/universal/run_onchange_after_39-vim-plugins.sh.tmpl +++ b/home/.chezmoiscripts/universal/run_onchange_after_39-vim-plugins.sh.tmpl @@ -8,6 +8,6 @@ ### Run the VIM plugin install routine if command -v vim > /dev/null; then - vim +PlugInstall +qall + vim +PlugInstall +qall 2>/dev/null fi {{ end -}} diff --git a/home/.chezmoiscripts/universal/run_onchange_after_40-chrome.sh.tmpl b/home/.chezmoiscripts/universal/run_onchange_after_40-chrome.sh.tmpl index 8197f300..4847fb64 100644 --- a/home/.chezmoiscripts/universal/run_onchange_after_40-chrome.sh.tmpl +++ b/home/.chezmoiscripts/universal/run_onchange_after_40-chrome.sh.tmpl @@ -30,20 +30,24 @@ ### Ensure Chrome policies directory is present 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 + if [ -d "$(dirname "$POLICY_DIR")" ]; then + ### 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 - ### 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" + ### 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 + else + logg info "Skipping extension injection into $POLICY_DIR - create these folders prior to running to create managed configs" fi done