Fixed rclone and added logs to browser plugins
This commit is contained in:
parent
c453b4104f
commit
e0085aa487
3 changed files with 22 additions and 9 deletions
|
@ -30,6 +30,7 @@
|
||||||
|
|
||||||
function chromeSetUp() {
|
function chromeSetUp() {
|
||||||
### Ensure Chrome policies directory is present
|
### Ensure Chrome policies directory is present
|
||||||
|
logg info 'Processing policy directories for Chromium based browsers'
|
||||||
for POLICY_DIR in "/opt/google/chrome/policies" "/etc/chromium/policies" "/etc/brave/policies"; do
|
for POLICY_DIR in "/opt/google/chrome/policies" "/etc/chromium/policies" "/etc/brave/policies"; do
|
||||||
if [ -d "$(dirname "$POLICY_DIR")" ]; then
|
if [ -d "$(dirname "$POLICY_DIR")" ]; then
|
||||||
### Managed policies
|
### Managed policies
|
||||||
|
@ -53,6 +54,7 @@ function chromeSetUp() {
|
||||||
done
|
done
|
||||||
|
|
||||||
### Add Chrome extension JSON
|
### Add Chrome extension JSON
|
||||||
|
logg info 'Populating Chrome extension JSON'
|
||||||
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/External Extensions"; do
|
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/External Extensions"; do
|
||||||
### Ensure program-type is installed
|
### Ensure program-type is installed
|
||||||
if [ -d "$(dirname "$EXTENSION_DIR")" ]; then
|
if [ -d "$(dirname "$EXTENSION_DIR")" ]; then
|
||||||
|
|
|
@ -49,6 +49,7 @@
|
||||||
|
|
||||||
# Firefox plugins: {{ list (.firefoxAddOns | toString | replace "[" "" | replace "]" "") | uniq | join " " }}
|
# Firefox plugins: {{ list (.firefoxAddOns | toString | replace "[" "" | replace "]" "") | uniq | join " " }}
|
||||||
|
|
||||||
|
logg info 'Processing post-logic for Firefox-based browsers'
|
||||||
function firefoxSetup() {
|
function firefoxSetup() {
|
||||||
### Installs the Firefox Profile Connector on Linux systems (Snap / Flatpak installs are not included in this function, but instead inline below)
|
### Installs the Firefox Profile Connector on Linux systems (Snap / Flatpak installs are not included in this function, but instead inline below)
|
||||||
function installFirefoxProfileConnector() {
|
function installFirefoxProfileConnector() {
|
||||||
|
@ -69,7 +70,8 @@ function firefoxSetup() {
|
||||||
# TODO - figure out how to do this for other installations like Flatpak and macOS and Librewolf
|
# TODO - figure out how to do this for other installations like Flatpak and macOS and Librewolf
|
||||||
for FIREFOX_DIR in '/usr/lib/firefox' '/usr/lib/firefox-esr' '/etc/firefox' '/etc/firefox-esr' '/Applications/Firefox.app/Contents/Resources' '/Applications/LibreWolf.app/Contents/Resources/'; do
|
for FIREFOX_DIR in '/usr/lib/firefox' '/usr/lib/firefox-esr' '/etc/firefox' '/etc/firefox-esr' '/Applications/Firefox.app/Contents/Resources' '/Applications/LibreWolf.app/Contents/Resources/'; do
|
||||||
if [ -d "$FIREFOX_DIR" ] && [ -d "${XDG_DATA_HOME:-$HOME/.local/share}/firefox" ] && command -v rsync > /dev/null; then
|
if [ -d "$FIREFOX_DIR" ] && [ -d "${XDG_DATA_HOME:-$HOME/.local/share}/firefox" ] && command -v rsync > /dev/null; then
|
||||||
sudo rsync -artvu "${XDG_DATA_HOME:-$HOME/.local/share}/firefox/" "$FIREFOX_DIR"
|
logg info "Syncing enterprise profiles from ${XDG_DATA_HOME:-$HOME/.local/share}/firefox to $FIREFOX_DIR"
|
||||||
|
sudo rsync -artvu "${XDG_DATA_HOME:-$HOME/.local/share}/firefox/" "$FIREFOX_DIR" > /dev/null
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -133,6 +135,7 @@ function firefoxSetup() {
|
||||||
elif [ "$SETTINGS_DIR" == "$HOME/Library/Application Support/LibreWolf/Profiles" ]; then
|
elif [ "$SETTINGS_DIR" == "$HOME/Library/Application Support/LibreWolf/Profiles" ]; then
|
||||||
FIREFOX_EXE="/Applications/LibreWolf.app/Contents/MacOS/librewolf"
|
FIREFOX_EXE="/Applications/LibreWolf.app/Contents/MacOS/librewolf"
|
||||||
if [ ! -f "$FIREFOX_EXE" ] || [ ! -d /Applications ]; then
|
if [ ! -f "$FIREFOX_EXE" ] || [ ! -d /Applications ]; then
|
||||||
|
logg info "$FIREFOX_EXE is not a file"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
elif [ "$SETTINGS_DIR" == "$HOME/snap/firefox/common/.mozilla/firefox" ]; then
|
elif [ "$SETTINGS_DIR" == "$HOME/snap/firefox/common/.mozilla/firefox" ]; then
|
||||||
|
@ -182,21 +185,29 @@ function firefoxSetup() {
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
### Initiatize Firefox default profiles
|
### Initiatize Firefox default profiles
|
||||||
|
logg info "Processing executable located at $FIREFOX_EXE"
|
||||||
if command -v "$FIREFOX_EXE" > /dev/null; then
|
if command -v "$FIREFOX_EXE" > /dev/null; then
|
||||||
### Create default profile by launching Firefox headlessly
|
### Create default profile by launching Firefox headlessly
|
||||||
logg info "Firefox executable set to $FIREFOX_EXE"
|
logg info "Firefox executable set to $FIREFOX_EXE"
|
||||||
if [ ! -d "$SETTINGS_DIR" ]; then
|
if [ ! -d "$SETTINGS_DIR" ]; then
|
||||||
logg info 'Running Firefox headlessly to generate default profiles'
|
logg info 'Running Firefox (or its derivative) headlessly to generate default profiles'
|
||||||
timeout 8 "$FIREFOX_EXE" --headless
|
timeout 14 "$FIREFOX_EXE" --headless
|
||||||
logg info 'Finished running Firefox headlessly'
|
logg info 'Finished running Firefox headlessly'
|
||||||
elif [ -d /Applications ] && [ -d /System ] && [ ! -f "$SETTINGS_DIR/../installs.ini" ]; then
|
elif [ -d /Applications ] && [ -d /System ] && [ ! -f "$SETTINGS_DIR/../installs.ini" ]; then
|
||||||
logg info 'Running Firefox headlessly to generate default profiles because install.ini is not at the macOS default location.'
|
logg info 'Running Firefox (or its derivative) headlessly to generate default profiles because install.ini is not at the macOS default location.'
|
||||||
timeout 8 "$FIREFOX_EXE" --headless
|
timeout 14 "$FIREFOX_EXE" --headless
|
||||||
logg info 'Finished running Firefox headlessly (while fixing the missing macOS installs.ini issue)'
|
logg info 'Finished running Firefox headlessly (while fixing the missing macOS installs.ini issue)'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
### Ensure settings directory exists (since the application was brought up temporarily headlessly)
|
||||||
|
if [ ! -d "$SETTINGS_DIR" ]; then
|
||||||
|
logg warn "The settings directory located at $SETTINGS_DIR failed to be populated by running the browser headlessly"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
### Add the populated profiles.ini
|
### Add the populated profiles.ini
|
||||||
logg info "Copying "${XDG_DATA_HOME:-$HOME/.local/share}/firefox/profiles.ini" to profile directory"
|
logg info "Copying "${XDG_DATA_HOME:-$HOME/.local/share}/firefox/profiles.ini" to profile directory"
|
||||||
|
logg info "The settings directory is $SETTINGS_DIR"
|
||||||
if [ -d /Applications ] && [ -d /System ]; then
|
if [ -d /Applications ] && [ -d /System ]; then
|
||||||
# macOS
|
# macOS
|
||||||
logg info "Copying ~/.local/share/firefox/profiles.ini to $SETTINGS_DIR/../profiles.ini"
|
logg info "Copying ~/.local/share/firefox/profiles.ini to $SETTINGS_DIR/../profiles.ini"
|
||||||
|
|
|
@ -51,16 +51,16 @@
|
||||||
|
|
||||||
if command -v rclone > /dev/null; then
|
if command -v rclone > /dev/null; then
|
||||||
{{- if and (or (and (stat (joinPath .host.home ".config" "age" "chezmoi.txt")) (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "CLOUDFLARE_R2_ID"))) (env "CLOUDFLARE_R2_ID")) (or (and (stat (joinPath .host.home ".config" "age" "chezmoi.txt")) (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "CLOUDFLARE_R2_SECRET"))) (env "CLOUDFLARE_R2_SECRET")) (ne .user.cloudflare.r2 "") }}
|
{{- if and (or (and (stat (joinPath .host.home ".config" "age" "chezmoi.txt")) (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "CLOUDFLARE_R2_ID"))) (env "CLOUDFLARE_R2_ID")) (or (and (stat (joinPath .host.home ".config" "age" "chezmoi.txt")) (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "CLOUDFLARE_R2_SECRET"))) (env "CLOUDFLARE_R2_SECRET")) (ne .user.cloudflare.r2 "") }}
|
||||||
logg info 'Removing ~/.config/rclone/rclone.conf INSTALL DOCTOR managed block'
|
logg info 'Removing ~/.config/rclone/rclone.conf Install Doctor managed block'
|
||||||
CONFIG_FILE="${XDG_CONFIG_HOME:-$HOME/.config}/rclone/rclone.conf"
|
CONFIG_FILE="${XDG_CONFIG_HOME:-$HOME/.config}/rclone/rclone.conf"
|
||||||
if cat "$CONFIG_FILE" | grep '# INSTALL DOCTOR MANAGED S3 START'; then
|
if cat "$CONFIG_FILE" | grep '# INSTALL DOCTOR MANAGED S3 START' > /dev/null; then
|
||||||
# TODO: Remove old block
|
# TODO: Remove old block
|
||||||
START_LINE="$(echo `grep -n -m 1 "# INSTALL DOCTOR MANAGED S3 START" "$CONFIG_FILE" | cut -f1 -d ":"`)"
|
START_LINE="$(echo `grep -n -m 1 "# INSTALL DOCTOR MANAGED S3 START" "$CONFIG_FILE" | cut -f1 -d ":"`)"
|
||||||
END_LINE="$(echo `grep -n -m 1 "# INSTALL DOCTOR MANAGED S3 END" "$CONFIG_FILE" | cut -f1 -d ":"`)"
|
END_LINE="$(echo `grep -n -m 1 "# INSTALL DOCTOR MANAGED S3 END" "$CONFIG_FILE" | cut -f1 -d ":"`)"
|
||||||
if command -v gsed > /dev/null; then
|
if command -v gsed > /dev/null; then
|
||||||
gsed -i "$START_LINE,$END_LINEd" "$CONFIG_FILE"
|
gsed -i "$START_LINE,${END_LINE}d" "$CONFIG_FILE"
|
||||||
else
|
else
|
||||||
sed -i "$START_LINE,$END_LINEd" "$CONFIG_FILE"
|
sed -i "$START_LINE,${END_LINE}d" "$CONFIG_FILE"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
logg info 'Adding ~/.config/rclone/rclone.conf INSTALL DOCTOR managed block'
|
logg info 'Adding ~/.config/rclone/rclone.conf INSTALL DOCTOR managed block'
|
||||||
|
|
Loading…
Reference in a new issue