I’m working on a suite of scripts that will enable me to hop Linux distros and get back to business as usual w/ minimal fuss. When I hop distros, I tend to back up my important stuff and blow everything else away so I can start with a clean slate. I have some scripts for updating my backups before the wipe and updating the system after the base install:
sudo apt update && sudo apt upgrade -y
Followed by other commands to install my favorite apps and configure my favorite desktop settings.
One thing that I haven’t nailed down yet is restoring my Firefox add-ons through the command line. Searching the web, I’m not even sure this is feasible. I found this post from 2011 in the AskUbuntu forum, but I figure the answer might have changed since then.
I just want to remove as much friction as possible from the distro hopping process. I know I can store /home on a separate partition, but I prefer nice, clean installs followed by scripting in my config changes.
Any tips or advice would be greatly appreciated.
I use something like this:
#!/bin/bash set -euo pipefail URLS=( 'https://addons.mozilla.org/en-US/firefox/addon/ublock-origin/' 'https://addons.mozilla.org/en-US/firefox/addon/privacy-badger17/' 'https://addons.mozilla.org/en-US/firefox/addon/passff/' 'https://addons.mozilla.org/en-US/firefox/addon/copy-plaintext/' 'https://addons.mozilla.org/en-US/firefox/addon/duckduckgo-for-firefox/' 'https://addons.mozilla.org/en-US/firefox/addon/user-agent-string-switcher/' 'https://addons.mozilla.org/en-US/firefox/addon/clearurls/' 'https://addons.mozilla.org/en-US/firefox/addon/temporary-containers/' 'https://addons.mozilla.org/en-US/firefox/addon/consent-o-matic/' ) DOWNLOAD_BASE_URL='https://addons.mozilla.org/firefox/downloads/latest' _="${FIREFOX:=firefox}" _="${DST:=/usr/lib/$FIREFOX/browser/extensions}" if [ $UID -eq 0 ]; then SUDO= else SUDO=sudo fi download_links=() for url in "${URLS[@]}"; do package_name="$(sed 's_/$__' <<< "$url" | awk -F/ '{print $NF}')" download_links+=("$DOWNLOAD_BASE_URL/$package_name/addon-$package_name.xpi") done workdir="$(mktemp --directory)" cd "$workdir" for url in "${download_links[@]}"; do curl -OL "$url" done for ext in *.xpi; do ext_id="$(unzip -p "$ext" 'manifest.json' | jq -r '(if .browser_specific_settings then .browser_specific_settings else .applications end).gecko.id')" target="$DST/$ext_id.xpi" echo "$ext -> $target" $SUDO install -Dm644 "$ext" "$target" done
That doesn’t handle the extension config though.