Update 4 files
- /home/dot_local/bin/executable_backup-app-settings - /home/dot_local/bin/executable_install-program - /home/dot_local/share/firefox/profile-switcher.json - /home/.chezmoiscripts/universal/run_onchange_after_40-firefox.tmpl
This commit is contained in:
parent
a70f707424
commit
9652158c35
4 changed files with 103 additions and 5 deletions
|
@ -6,6 +6,21 @@
|
||||||
|
|
||||||
# Firefox plugins: {{ list (.firefoxAddOns | toString | replace "[" "" | replace "]" "") | uniq | join " " }}
|
# Firefox plugins: {{ list (.firefoxAddOns | toString | replace "[" "" | replace "]" "") | uniq | join " " }}
|
||||||
|
|
||||||
|
### Installs the Firefox Profile Connector on Linux systems (Snap / Flatpak installs are not included in this function, but instead inline below)
|
||||||
|
function installFirefoxProfileConnector() {
|
||||||
|
logg info 'Installing the Firefox Profile Connector'
|
||||||
|
if command -v apt-get > /dev/null; then
|
||||||
|
sudo apt-get install -y https://github.com/null-dev/firefox-profile-switcher-connector/releases/latest/download/linux-x64.deb
|
||||||
|
elif command -v dnf > /dev/null; then
|
||||||
|
sudo dnf install -y https://github.com/null-dev/firefox-profile-switcher-connector/releases/latest/download/linux-x64.rpm
|
||||||
|
elif command -v yay > /dev/null; then
|
||||||
|
yay -Ss firefox-profile-switcher-connector
|
||||||
|
else
|
||||||
|
logg warn 'apt-get, dnf, and yay were all unavailable so the Firefox Profile Connector helper executable could not be installed'
|
||||||
|
fi
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
### Add Firefox enterprise profile
|
### Add Firefox enterprise profile
|
||||||
# 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' '/Applications/Firefox.app/Contents/Resources'; do
|
for FIREFOX_DIR in '/usr/lib/firefox' '/usr/lib/firefox-esr' '/Applications/Firefox.app/Contents/Resources'; do
|
||||||
|
@ -24,6 +39,28 @@ for SETTINGS_DIR in "$HOME/snap/firefox/common/.mozilla/firefox" "$HOME/.var/app
|
||||||
continue
|
continue
|
||||||
else
|
else
|
||||||
FIREFOX_EXE="$(which org.mozilla.firefox)"
|
FIREFOX_EXE="$(which org.mozilla.firefox)"
|
||||||
|
|
||||||
|
### Firefox Profile Switcher
|
||||||
|
BASE_DIR="$HOME/.var/app/org.mozilla.firefox"
|
||||||
|
BIN_INSTALL_DIR="$BASE_DIR/data/firefoxprofileswitcher-install"
|
||||||
|
MANIFEST_INSTALL_DIR="$BASE_DIR/.mozilla/native-messaging-hosts"
|
||||||
|
DOWNLOAD_URL="https://github.com/null-dev/firefox-profile-switcher-connector/releases/latest/download/linux-x64.deb"
|
||||||
|
|
||||||
|
### Ensure Firefox Profile Switcher is not already installed
|
||||||
|
if [ ! -f "$BIN_INSTALL_DIR/usr/bin/ff-pswitch-connector" ] || [ ! -f "$MANIFEST_INSTALL_DIR/ax.nd.profile_switcher_ff.json" ]; then
|
||||||
|
### Download profile switcher
|
||||||
|
mkdir -p "$BIN_INSTALL_DIR"
|
||||||
|
TMP_FILE="$(mktemp)"
|
||||||
|
logg info 'Downloading Firefox Profile Switch connector'
|
||||||
|
curl -sSL "$DOWNLOAD_URL" -o "$TMP_FILE"
|
||||||
|
ar p "$TMP_FILE" data.tar.xz | tar xfJ - --strip-components=2 -C "$BIN_INSTALL_DIR" usr/bin/ff-pswitch-connector
|
||||||
|
rm -f "$TMP_FILE"
|
||||||
|
|
||||||
|
### Create manifest
|
||||||
|
logg info 'Copying profile switcher configuration to manifest directory'
|
||||||
|
mkdir -p "$MANIFEST_INSTALL_DIR"
|
||||||
|
cat "${XDG_DATA_HOME:-$HOME/.local/share}/firefox/profile-switcher.json" | sed 's/PATH_PLACEHOLDER/'"$BIN_INSTALL_DIR"'/' > "$MANIFEST_INSTALL_DIR/ax.nd.profile_switcher_ff.json"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
elif [ "$SETTINGS_DIR" == "$HOME/.var/app/io.gitlab.librewolf-community/.librewolf" ]; then
|
elif [ "$SETTINGS_DIR" == "$HOME/.var/app/io.gitlab.librewolf-community/.librewolf" ]; then
|
||||||
if ! command -v io.gitlab.librewolf-community > /dev/null; then
|
if ! command -v io.gitlab.librewolf-community > /dev/null; then
|
||||||
|
@ -35,6 +72,18 @@ for SETTINGS_DIR in "$HOME/snap/firefox/common/.mozilla/firefox" "$HOME/.var/app
|
||||||
FIREFOX_EXE="/Applications/Firefox.app/Contents/MacOS/firefox"
|
FIREFOX_EXE="/Applications/Firefox.app/Contents/MacOS/firefox"
|
||||||
if [ ! -f "$FIREFOX_EXE" ]; then
|
if [ ! -f "$FIREFOX_EXE" ]; then
|
||||||
continue
|
continue
|
||||||
|
else
|
||||||
|
### Download Firefox Profile Switcher
|
||||||
|
if [ ! -d /usr/local/Cellar/firefox-profile-switcher-connector ]; then
|
||||||
|
logg info 'Ensuring Firefox Profile Switcher is installed'
|
||||||
|
brew install null-dev/firefox-profile-switcher/firefox-profile-switcher-connector
|
||||||
|
fi
|
||||||
|
|
||||||
|
### Ensure Firefox Profile Switcher configuration is symlinked
|
||||||
|
if [ ! -d "/Library/Application Support/Mozilla/NativeMessagingHosts/ax.nd.profile_switcher_ff.json" ]; then
|
||||||
|
logg info 'Ensuring Firefox Profile Switcher is configured'
|
||||||
|
sudo mkdir -p "/Library/Applcation Support/Mozilla/NativeMessagingHosts"
|
||||||
|
sudo ln -sf "$(brew ls -l firefox-profile-switcher-connector | grep -i ax.nd.profile_switcher_ff.json | head -n1)" "/Library/Application Support/Mozilla/NativeMessagingHosts/ax.nd.profile_switcher_ff.json"
|
||||||
fi
|
fi
|
||||||
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"
|
||||||
|
@ -45,13 +94,37 @@ for SETTINGS_DIR in "$HOME/snap/firefox/common/.mozilla/firefox" "$HOME/.var/app
|
||||||
FIREFOX_EXE="/snap/bin/firefox"
|
FIREFOX_EXE="/snap/bin/firefox"
|
||||||
if [ ! -f "$FIREFOX_EXE" ]; then
|
if [ ! -f "$FIREFOX_EXE" ]; then
|
||||||
continue
|
continue
|
||||||
|
else
|
||||||
|
### Firefox Profile Switcher
|
||||||
|
BASE_DIR="$HOME/snap/firefox/common"
|
||||||
|
BIN_INSTALL_DIR="$BASE_DIR/firefoxprofileswitcher-install"
|
||||||
|
MANIFEST_INSTALL_DIR="$BASE_DIR/.mozilla/native-messaging-hosts"
|
||||||
|
DOWNLOAD_URL="https://github.com/null-dev/firefox-profile-switcher-connector/releases/latest/download/linux-x64.deb"
|
||||||
|
|
||||||
|
### Ensure Firefox Profile Switcher is not already installed
|
||||||
|
if [ ! -f "$BIN_INSTALL_DIR/usr/bin/ff-pswitch-connector" ] || [ ! -f "$MANIFEST_INSTALL_DIR/ax.nd.profile_switcher_ff.json" ]; then
|
||||||
|
### Download profile switcher
|
||||||
|
mkdir -p "$BIN_INSTALL_DIR"
|
||||||
|
TMP_FILE="$(mktemp)"
|
||||||
|
logg info 'Downloading Firefox Profile Switch connector'
|
||||||
|
curl -sSL "$DOWNLOAD_URL" -o "$TMP_FILE"
|
||||||
|
ar p "$TMP_FILE" data.tar.xz | tar xfJ - --strip-components=2 -C "$BIN_INSTALL_DIR" usr/bin/ff-pswitch-connector
|
||||||
|
rm -f "$TMP_FILE"
|
||||||
|
|
||||||
|
### Create manifest
|
||||||
|
logg info 'Copying profile switcher configuration to manifest directory'
|
||||||
|
mkdir -p "$MANIFEST_INSTALL_DIR"
|
||||||
|
cat "${XDG_DATA_HOME:-$HOME/.local/share}/firefox/profile-switcher.json" | sed 's/PATH_PLACEHOLDER/'"$BIN_INSTALL_DIR"'/' > "$MANIFEST_INSTALL_DIR/ax.nd.profile_switcher_ff.json"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
elif [ "$SETTINGS_DIR" == "$HOME/.mozilla/firefox" ]; then
|
elif [ "$SETTINGS_DIR" == "$HOME/.mozilla/firefox" ]; then
|
||||||
if command -v firefox-esr > /dev/null; then
|
if command -v firefox-esr > /dev/null; then
|
||||||
FIREFOX_EXE="$(which firefox-esr)"
|
FIREFOX_EXE="$(which firefox-esr)"
|
||||||
|
installFirefoxProfileConnector
|
||||||
elif command -v firefox > /dev/null && [ "$(which firefox)" != *'snap'* ] && [ "$(which firefox)" != *'flatpak'* ] && [ ! -d /Applications ] && [ ! -d /System ]; then
|
elif command -v firefox > /dev/null && [ "$(which firefox)" != *'snap'* ] && [ "$(which firefox)" != *'flatpak'* ] && [ ! -d /Applications ] && [ ! -d /System ]; then
|
||||||
# Conditional check ensures Snap / Flatpak / macOS Firefox versions do not try to install to the wrong folder
|
# Conditional check ensures Snap / Flatpak / macOS Firefox versions do not try to install to the wrong folder
|
||||||
FIREFOX_EXE="$(which firefox)"
|
FIREFOX_EXE="$(which firefox)"
|
||||||
|
installFirefoxProfileConnector
|
||||||
else
|
else
|
||||||
logg warn 'Unable to register Firefox executable'
|
logg warn 'Unable to register Firefox executable'
|
||||||
logg info "Settings directory: $SETTINGS_DIR"
|
logg info "Settings directory: $SETTINGS_DIR"
|
||||||
|
@ -91,6 +164,20 @@ for SETTINGS_DIR in "$HOME/snap/firefox/common/.mozilla/firefox" "$HOME/.var/app
|
||||||
|
|
||||||
### Install Firefox addons (using list declared in .chezmoidata.yaml)
|
### Install Firefox addons (using list declared in .chezmoidata.yaml)
|
||||||
for FIREFOX_PLUGIN in {{ list (.firefoxAddOns | toString | replace "[" "" | replace "]" "") | uniq | join " " }}; do
|
for FIREFOX_PLUGIN in {{ list (.firefoxAddOns | toString | replace "[" "" | replace "]" "") | uniq | join " " }}; do
|
||||||
|
### Configure profile switcher
|
||||||
|
if [ "$FIREFOX_PLUGIN" == "" ]; then
|
||||||
|
if [ -d /Applications ] && [ -d /System ]; then
|
||||||
|
# macOS
|
||||||
|
brew install null-dev/firefox-profile-switcher/firefox-profile-switcher-connector
|
||||||
|
sudo mkdir -p "/Library/Application Support/Mozilla/NativeMessagingHosts"
|
||||||
|
LATEST_VERSION="$(ls -v /usr/local/Cellar/firefox-profile-switcher-connector | tail -n 1)"
|
||||||
|
sudo ln -sf "/usr/local/Cellar/firefox-profile-switcher-connector/$LATEST_VERSION/ax.nd.profile_switcher_ff.json" "/Library/Application Support/Mozilla/NativeMessagingHosts/ax.nd.profile_switcher_ff.json"
|
||||||
|
elif command -v apt-get > /dev/null; then
|
||||||
|
# Debian/Ubuntu
|
||||||
|
elif command -v dnf > /dev/null; then
|
||||||
|
# CentOS / Fedora
|
||||||
|
elif command -v pacman > /dev/null; then
|
||||||
|
fi
|
||||||
logg info 'Ensuring `'"$FIREFOX_PLUGIN"'` is installed'
|
logg info 'Ensuring `'"$FIREFOX_PLUGIN"'` is installed'
|
||||||
PLUGIN_HTML="$(mktemp)"
|
PLUGIN_HTML="$(mktemp)"
|
||||||
curl --silent "https://addons.mozilla.org/en-US/firefox/addon/$FIREFOX_PLUGIN/" > "$PLUGIN_HTML"
|
curl --silent "https://addons.mozilla.org/en-US/firefox/addon/$FIREFOX_PLUGIN/" > "$PLUGIN_HTML"
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
for DESKTOP_APP of BraveSoftware Ferdium "Google Assistant" Mailspring "Standard Notes" TeamViewer zoom.us
|
for DESKTOP_APP of BraveSoftware Ferdium "Google Assistant" Mailspring "Standard Notes" TeamViewer zoom.us; do
|
||||||
|
true
|
||||||
|
done
|
|
@ -754,9 +754,9 @@ async function beforeInstall(packageManager) {
|
||||||
runCommand('Running yum update', `sudo yum update -y`)
|
runCommand('Running yum update', `sudo yum update -y`)
|
||||||
}
|
}
|
||||||
} else if (packageManager === 'flatpak') {
|
} else if (packageManager === 'flatpak') {
|
||||||
// Issues with Flatpak not downloading updates on CentOS so reverting to ZX way of doing things so stdout can do its thing
|
// TODO - figure out why CentOS is failing to update
|
||||||
// runCommand('Running flatpak update', `timeout 600 sudo flatpak update -y`)
|
// and then switch command below for `sudo flatpak update -y`
|
||||||
await $`sudo flatpak update -y`
|
runCommand('Running flatpak update', `. /etc/os-release && if [ "$ID" != 'centos' ]; then sudo flatpak update -y; fi`)
|
||||||
} else if (packageManager === 'gem') {
|
} else if (packageManager === 'gem') {
|
||||||
} else if (packageManager === 'go') {
|
} else if (packageManager === 'go') {
|
||||||
} else if (packageManager === 'nix') {
|
} else if (packageManager === 'nix') {
|
||||||
|
|
9
home/dot_local/share/firefox/profile-switcher.json
Normal file
9
home/dot_local/share/firefox/profile-switcher.json
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"allowed_extensions": [
|
||||||
|
"profile-switcher-ff@nd.ax"
|
||||||
|
],
|
||||||
|
"description": "Profile Switcher for Firefox",
|
||||||
|
"name": "ax.nd.profile_switcher_ff",
|
||||||
|
"path": "PATH_PLACEHOLDER/ff-pswitch-connector",
|
||||||
|
"type": "stdio"
|
||||||
|
}
|
Loading…
Reference in a new issue