This commit is contained in:
Brian Zalewski 2023-07-12 04:32:13 +00:00
parent 8a5480fdf8
commit a3004df675
18 changed files with 593 additions and 561 deletions

View file

@ -980,7 +980,6 @@ softwareGroups:
Virtualization-Desktop: &Virtualization-Desktop Virtualization-Desktop: &Virtualization-Desktop
- docker-desktop - docker-desktop
- gnome-boxes - gnome-boxes
- orbstack
- parallels - parallels
- quickgui - quickgui
- utm - utm
@ -1412,6 +1411,8 @@ softwareGroups:
note: Deprecated in favor of using ASDF. note: Deprecated in favor of using ASDF.
- pkg: nuclear - pkg: nuclear
note: Music app - UI is horrendous note: Music app - UI is horrendous
- pkg: orbstack
note: Faster / better alternative to Docker Desktop on macOS. Deprecated because it does not support Docker Extensions and is only for macOS.
- pkg: pip - pkg: pip
note: The `pip` installation is handled by the `install-software` program bundled with Install Doctor. note: The `pip` installation is handled by the `install-software` program bundled with Install Doctor.
- pkg: pipx - pkg: pipx

View file

@ -66,7 +66,7 @@
type = "file" type = "file"
url = "https://gitlab.com/megabyte-labs/gas-station/-/raw/master/environments/prod/group_vars/all/helm.yml" url = "https://gitlab.com/megabyte-labs/gas-station/-/raw/master/environments/prod/group_vars/all/helm.yml"
refreshPeriod = "{{ $refreshPeriod }}" refreshPeriod = "{{ $refreshPeriod }}"
[".local/bash_it"] [".local/share/bash_it"]
type = "git-repo" type = "git-repo"
url = "https://github.com/Bash-it/bash-it.git" url = "https://github.com/Bash-it/bash-it.git"
refreshPeriod = "{{ $refreshPeriod }}" refreshPeriod = "{{ $refreshPeriod }}"

View file

@ -24,34 +24,39 @@
{{ includeTemplate "universal/profile" }} {{ includeTemplate "universal/profile" }}
{{ includeTemplate "universal/logg" }} {{ includeTemplate "universal/logg" }}
### Clone the repositories function gitomaticSetup() {
logg info 'Cloning the repositories' ### Clone the repositories
{{ range .user.gitomatic }} logg info 'Cloning the repositories'
if [ ! -d "{{ .path }}" ]; then {{ range .user.gitomatic }}
git clone "{{ .git }}" "{{ .path }}" logg info 'Checking for presence of {{ .path }}'
fi if [ ! -d "{{ .path }}" ]; then
{{ end -}} logg info 'Cloning {{ .git }} to {{ .path }}'
git clone "{{ .git }}" "{{ .path }}"
### Create Systemd service to run gitomatic
if command -v gitomatic > /dev/null; then
if [ -d /Applications ] && [ -d /System ]; then
### macOS
logg info 'Copying `gitomatic` plist file to /Library/LaunchDaemons'
sudo cp -f "{{ .chezmoi.homeDir }}/.config/gitomatic/gitomatic.plist" /Library/LaunchDaemons/gitomatic.plist
logg info 'Running `sudo launchctl load com.gitomatic`'
sudo launchctl load com.gitomatic
logg info 'Running `sudo launchctl start com.gitomatic`'
sudo launchctl start com.gitomatic
else
### Linux
logg info 'Copying `gitomatic` systemd unit file to /etc/systemd/system/'
sudo cp -f "{{ .chezmoi.homeDir }}/.config/gitomatic/gitomatic.service" /etc/systemd/system/gitomatic.service
logg info 'Reloading systemd daemon'
sudo systemctl daemon-reload
logg info 'Enabling and starting `gitomatic` service'
sudo systemctl enable --now gitomatic
fi fi
else {{ end -}}
logg info 'Git-o-matic is not installed or it is not available in PATH'
fi ### Create Systemd service to run gitomatic
if command -v gitomatic > /dev/null; then
if [ -d /Applications ] && [ -d /System ]; then
### macOS
logg info 'Copying `gitomatic` plist file to /Library/LaunchDaemons'
sudo cp -f "{{ .chezmoi.homeDir }}/.config/gitomatic/gitomatic.plist" /Library/LaunchDaemons/gitomatic.plist
logg info 'Running `sudo launchctl load gitomatic`'
sudo launchctl load gitomatic
logg info 'Running `sudo launchctl start gitomatic`'
sudo launchctl start gitomatic
else
### Linux
logg info 'Copying `gitomatic` systemd unit file to /etc/systemd/system/'
sudo cp -f "{{ .chezmoi.homeDir }}/.config/gitomatic/gitomatic.service" /etc/systemd/system/gitomatic.service
logg info 'Reloading systemd daemon'
sudo systemctl daemon-reload
logg info 'Enabling and starting `gitomatic` service'
sudo systemctl enable --now gitomatic
fi
else
logg info 'Git-o-matic is not installed or it is not available in PATH'
fi
}
gitomaticSetup
{{ end -}} {{ end -}}

View file

@ -6,8 +6,11 @@
# This script pre-installs the VIM plugins defined in [`.chezmoidata.yaml`](https://github.com/megabyte-labs/install.doctor/tree/master/home/.chezmoidata.yaml) # This script pre-installs the VIM plugins defined in [`.chezmoidata.yaml`](https://github.com/megabyte-labs/install.doctor/tree/master/home/.chezmoidata.yaml)
# so that VIM does not have to do anything on its first launch. # so that VIM does not have to do anything on its first launch.
### Run the VIM plugin install routine function vimSetup() {
if command -v vim > /dev/null; then ### Run the VIM plugin install routine
vim +PlugInstall +qall 2>/dev/null if command -v vim > /dev/null; then
fi vim +PlugInstall +qall 2>/dev/null && logg success 'Successfully ran `vim +PlugInstall +qall`' || logg error 'Failed to run `vim +PlugInstall +qll`'
fi
}
vimSetup
{{ end -}} {{ end -}}

View file

@ -28,63 +28,66 @@
{{ includeTemplate "universal/profile" }} {{ includeTemplate "universal/profile" }}
{{ includeTemplate "universal/logg" }} {{ includeTemplate "universal/logg" }}
### Ensure Chrome policies directory is present function chromeSetUp() {
for POLICY_DIR in "/opt/google/chrome/policies" "/etc/chromium/policies" "/etc/brave/policies"; do ### Ensure Chrome policies directory is present
if [ -d "$(dirname "$POLICY_DIR")" ]; then for POLICY_DIR in "/opt/google/chrome/policies" "/etc/chromium/policies" "/etc/brave/policies"; do
### Managed policies if [ -d "$(dirname "$POLICY_DIR")" ]; then
if [ ! -f "$POLICY_DIR/managed/policies.json" ]; then ### Managed policies
logg info "Ensuring directory $POLICY_DIR/managed exists" if [ ! -f "$POLICY_DIR/managed/policies.json" ]; then
sudo mkdir -p "$POLICY_DIR/managed" logg info "Ensuring directory $POLICY_DIR/managed exists"
logg info "Copying ${XDG_CONFIG_HOME:-$HOME/.config}/chrome/managed.json to $POLICY_DIR/managed/policies.json" sudo mkdir -p "$POLICY_DIR/managed"
sudo cp -f "${XDG_CONFIG_HOME:-$HOME/.config}/chrome/managed.json" "$POLICY_DIR/managed/policies.json" logg info "Copying ${XDG_CONFIG_HOME:-$HOME/.config}/chrome/managed.json to $POLICY_DIR/managed/policies.json"
fi sudo cp -f "${XDG_CONFIG_HOME:-$HOME/.config}/chrome/managed.json" "$POLICY_DIR/managed/policies.json"
fi
### Recommended policies ### Recommended policies
if [ ! -f "$POLICY_DIR/recommended/policies.json" ]; then if [ ! -f "$POLICY_DIR/recommended/policies.json" ]; then
logg info "Ensuring directory $POLICY_DIR/recommended exists" logg info "Ensuring directory $POLICY_DIR/recommended exists"
sudo mkdir -p "$POLICY_DIR/recommended" sudo mkdir -p "$POLICY_DIR/recommended"
logg info "Copying ${XDG_CONFIG_HOME:-$HOME/.config}/chrome/recommended.json to $POLICY_DIR/recommended/policies.json" 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" 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
### Add 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
### 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 fi
else else
if [ ! -d "$EXTENSION_DIR" ]; then logg info "Skipping extension injection into $POLICY_DIR - create these folders prior to running to create managed configs"
logg info "Creating directory $EXTENSION_DIR"
mkdir -p "$EXTENSION_DIR"
fi
fi fi
done
### Add extension JSON ### Add Chrome extension JSON
logg info "Adding Chrome extensions to $EXTENSION_DIR" 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 in {{ list (.chromeExtensions | toString | replace "[" "" | replace "]" "") | uniq | join " " }}; do ### Ensure program-type is installed
logg info "Adding Chrome extension manifest ($EXTENSION)" if [ -d "$(dirname "$EXTENSION_DIR")" ]; then
if ! echo "$EXTENSION" | grep 'https://chrome.google.com/webstore/detail/' > /dev/null; then ### Ensure extension directory exists
EXTENSION="https://chrome.google.com/webstore/detail/$EXTENSION"
fi
EXTENSION_ID="$(echo "$EXTENSION" | sed 's/^.*\/\([^\/]*\)$/\1/')"
if [[ "$EXTENSION_DIR" == '/opt/'* ]] || [[ "$EXTENSION_DIR" == '/etc/'* ]]; then if [[ "$EXTENSION_DIR" == '/opt/'* ]] || [[ "$EXTENSION_DIR" == '/etc/'* ]]; then
sudo cp -f "${XDG_CONFIG_HOME:-$HOME/.config}/chrome/extension.json" "$EXTENSION_DIR/${EXTENSION_ID}.json" if [ ! -d "$EXTENSION_DIR" ]; then
logg info "Creating directory $EXTENSION_DIR"
sudo mkdir -p "$EXTENSION_DIR"
fi
else else
cp -f "${XDG_CONFIG_HOME:-$HOME/.config}/chrome/extension.json" "$EXTENSION_DIR/${EXTENSION_ID}.json" if [ ! -d "$EXTENSION_DIR" ]; then
logg info "Creating directory $EXTENSION_DIR"
mkdir -p "$EXTENSION_DIR"
fi
fi fi
done
else ### Add extension JSON
logg info "$EXTENSION_DIR does not exist" logg info "Adding Chrome extensions to $EXTENSION_DIR"
fi for EXTENSION in {{ list (.chromeExtensions | toString | replace "[" "" | replace "]" "") | uniq | join " " }}; do
done logg info "Adding Chrome extension manifest ($EXTENSION)"
if ! echo "$EXTENSION" | grep 'https://chrome.google.com/webstore/detail/' > /dev/null; then
EXTENSION="https://chrome.google.com/webstore/detail/$EXTENSION"
fi
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"
fi
done
}
chromeSetUp
{{ end -}} {{ end -}}

View file

@ -49,278 +49,280 @@
# 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 firefoxSetup() {
function installFirefoxProfileConnector() { ### Installs the Firefox Profile Connector on Linux systems (Snap / Flatpak installs are not included in this function, but instead inline below)
logg info 'Installing the Firefox Profile Connector' function installFirefoxProfileConnector() {
if command -v apt-get > /dev/null; then logg info 'Installing the Firefox Profile Connector'
sudo apt-get install -y https://github.com/null-dev/firefox-profile-switcher-connector/releases/latest/download/linux-x64.deb if command -v apt-get > /dev/null; then
elif command -v dnf > /dev/null; then sudo apt-get install -y https://github.com/null-dev/firefox-profile-switcher-connector/releases/latest/download/linux-x64.deb
sudo dnf install -y https://github.com/null-dev/firefox-profile-switcher-connector/releases/latest/download/linux-x64.rpm elif command -v dnf > /dev/null; then
elif command -v yay > /dev/null; then sudo dnf install -y https://github.com/null-dev/firefox-profile-switcher-connector/releases/latest/download/linux-x64.rpm
yay -Ss firefox-profile-switcher-connector elif command -v yay > /dev/null; then
else yay -Ss firefox-profile-switcher-connector
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
# 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
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"
fi
done
### Loop through various Firefox profile locations
for SETTINGS_DIR in "$HOME/snap/firefox/common/.mozilla/firefox" "$HOME/.var/app/org.mozilla.firefox/.mozilla/firefox" "$HOME/.var/app/io.gitlab.librewolf-community/.librewolf" "$HOME/Library/Application Support/Firefox/Profiles" "$HOME/Library/Application Support/LibreWolf/Profiles" "$HOME/.mozilla/firefox"; do
### Determine executable to use
logg info "Processing Firefox profile location $SETTINGS_DIR"
unset FIREFOX_EXE
if [ "$SETTINGS_DIR" == "$HOME/.var/app/org.mozilla.firefox/.mozilla/firefox" ]; then
if ! command -v org.mozilla.firefox > /dev/null || [ ! -d "$HOME/.var/app/org.mozilla.firefox" ]; then
continue
else else
FIREFOX_EXE="$(which org.mozilla.firefox)" logg warn 'apt-get, dnf, and yay were all unavailable so the Firefox Profile Connector helper executable could not be installed'
### 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
if ! command -v io.gitlab.librewolf-community > /dev/null || [ ! -d "$HOME/.var/app/io.gitlab.librewolf-community" ]; then
continue
else
FIREFOX_EXE="$(which io.gitlab.librewolf-community)"
fi
elif [ "$SETTINGS_DIR" == "$HOME/Library/Application Support/Firefox/Profiles" ]; then
FIREFOX_EXE="/Applications/Firefox.app/Contents/MacOS/firefox"
if [ ! -f "$FIREFOX_EXE" ] || [ ! -d /Applications ]; then
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
FIREFOX_EXE="/Applications/LibreWolf.app/Contents/MacOS/librewolf"
if [ ! -f "$FIREFOX_EXE" ] || [ ! -d /Applications ]; then
continue
fi
elif [ "$SETTINGS_DIR" == "$HOME/snap/firefox/common/.mozilla/firefox" ]; then
FIREFOX_EXE="/snap/bin/firefox"
if [ ! -f "$FIREFOX_EXE" ] || [ ! -d "$HOME/snap/firefox" ]; then
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 ### Add Firefox enterprise profile
if [ ! -f "$BIN_INSTALL_DIR/usr/bin/ff-pswitch-connector" ] || [ ! -f "$MANIFEST_INSTALL_DIR/ax.nd.profile_switcher_ff.json" ]; then # TODO - figure out how to do this for other installations like Flatpak and macOS and Librewolf
### Download profile switcher 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
mkdir -p "$BIN_INSTALL_DIR" if [ -d "$FIREFOX_DIR" ] && [ -d "${XDG_DATA_HOME:-$HOME/.local/share}/firefox" ] && command -v rsync > /dev/null; then
TMP_FILE="$(mktemp)" sudo rsync -artvu "${XDG_DATA_HOME:-$HOME/.local/share}/firefox/" "$FIREFOX_DIR"
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 done
if command -v firefox-esr > /dev/null; then
FIREFOX_EXE="$(which firefox-esr)" ### Loop through various Firefox profile locations
installFirefoxProfileConnector for SETTINGS_DIR in "$HOME/snap/firefox/common/.mozilla/firefox" "$HOME/.var/app/org.mozilla.firefox/.mozilla/firefox" "$HOME/.var/app/io.gitlab.librewolf-community/.librewolf" "$HOME/Library/Application Support/Firefox/Profiles" "$HOME/Library/Application Support/LibreWolf/Profiles" "$HOME/.mozilla/firefox"; do
elif command -v firefox > /dev/null && [ "$(which firefox)" != *'snap'* ] && [ "$(which firefox)" != *'flatpak'* ] && [ ! -d /Applications ] && [ ! -d /System ]; then ### Determine executable to use
# Conditional check ensures Snap / Flatpak / macOS Firefox versions do not try to install to the wrong folder logg info "Processing Firefox profile location $SETTINGS_DIR"
FIREFOX_EXE="$(which firefox)" unset FIREFOX_EXE
installFirefoxProfileConnector if [ "$SETTINGS_DIR" == "$HOME/.var/app/org.mozilla.firefox/.mozilla/firefox" ]; then
else if ! command -v org.mozilla.firefox > /dev/null || [ ! -d "$HOME/.var/app/org.mozilla.firefox" ]; then
if [ -d /Applications ] && [ -d /System ]; then
# Continue on macOS without logging because profiles are not stored here on macOS
continue continue
else else
logg warn 'Unable to register Firefox executable' FIREFOX_EXE="$(which org.mozilla.firefox)"
logg info "Settings directory: $SETTINGS_DIR"
### 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
elif [ "$SETTINGS_DIR" == "$HOME/.var/app/io.gitlab.librewolf-community/.librewolf" ]; then
if ! command -v io.gitlab.librewolf-community > /dev/null || [ ! -d "$HOME/.var/app/io.gitlab.librewolf-community" ]; then
continue
else
FIREFOX_EXE="$(which io.gitlab.librewolf-community)"
fi
elif [ "$SETTINGS_DIR" == "$HOME/Library/Application Support/Firefox/Profiles" ]; then
FIREFOX_EXE="/Applications/Firefox.app/Contents/MacOS/firefox"
if [ ! -f "$FIREFOX_EXE" ] || [ ! -d /Applications ]; then
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
FIREFOX_EXE="/Applications/LibreWolf.app/Contents/MacOS/librewolf"
if [ ! -f "$FIREFOX_EXE" ] || [ ! -d /Applications ]; then
continue continue
fi fi
fi elif [ "$SETTINGS_DIR" == "$HOME/snap/firefox/common/.mozilla/firefox" ]; then
fi FIREFOX_EXE="/snap/bin/firefox"
### Initiatize Firefox default profiles if [ ! -f "$FIREFOX_EXE" ] || [ ! -d "$HOME/snap/firefox" ]; then
if command -v "$FIREFOX_EXE" > /dev/null; then continue
### Create default profile by launching Firefox headlessly else
logg info "Firefox executable set to $FIREFOX_EXE" ### Firefox Profile Switcher
if [ ! -d "$SETTINGS_DIR" ]; then BASE_DIR="$HOME/snap/firefox/common"
logg info 'Running Firefox headlessly to generate default profiles' BIN_INSTALL_DIR="$BASE_DIR/firefoxprofileswitcher-install"
timeout 8 "$FIREFOX_EXE" --headless MANIFEST_INSTALL_DIR="$BASE_DIR/.mozilla/native-messaging-hosts"
logg info 'Finished running Firefox headlessly' DOWNLOAD_URL="https://github.com/null-dev/firefox-profile-switcher-connector/releases/latest/download/linux-x64.deb"
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.'
timeout 8 "$FIREFOX_EXE" --headless
logg info 'Finished running Firefox headlessly (while fixing the missing macOS installs.ini issue)'
fi
### Add the populated profiles.ini ### Ensure Firefox Profile Switcher is not already installed
logg info "Copying "${XDG_DATA_HOME:-$HOME/.local/share}/firefox/profiles.ini" to profile directory" if [ ! -f "$BIN_INSTALL_DIR/usr/bin/ff-pswitch-connector" ] || [ ! -f "$MANIFEST_INSTALL_DIR/ax.nd.profile_switcher_ff.json" ]; then
if [ -d /Applications ] && [ -d /System ]; then ### Download profile switcher
# macOS mkdir -p "$BIN_INSTALL_DIR"
logg info "Copying ~/.local/share/firefox/profiles.ini to $SETTINGS_DIR/../profiles.ini" TMP_FILE="$(mktemp)"
cp -f "${XDG_DATA_HOME:-$HOME/.local/share}/firefox/profiles.ini" "$SETTINGS_DIR/../profiles.ini" logg info 'Downloading Firefox Profile Switch connector'
SETTINGS_INI="$SETTINGS_DIR/../installs.ini" curl -sSL "$DOWNLOAD_URL" -o "$TMP_FILE"
else ar p "$TMP_FILE" data.tar.xz | tar xfJ - --strip-components=2 -C "$BIN_INSTALL_DIR" usr/bin/ff-pswitch-connector
# Linux rm -f "$TMP_FILE"
logg info "Copying ~/.local/share/firefox/profiles.ini to $SETTINGS_DIR/profiles.ini"
cp -f "${XDG_DATA_HOME:-$HOME/.local/share}/firefox/profiles.ini" "$SETTINGS_DIR/profiles.ini"
SETTINGS_INI="$SETTINGS_DIR/installs.ini"
fi
### Default profile (created by launching Firefox headlessly) ### Create manifest
# DEFAULT_RELEASE_PROFILE="$(find "$SETTINGS_DIR" -mindepth 1 -maxdepth 1 -name "*.default-*")" logg info 'Copying profile switcher configuration to manifest directory'
if [ -f "$SETTINGS_INI" ]; then mkdir -p "$MANIFEST_INSTALL_DIR"
DEFAULT_PROFILE_PROFILE="$SETTINGS_DIR/$(cat "$SETTINGS_INI" | grep 'Default=' | sed 's/.*Profiles\///')" 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"
logg info 'Removing previous installs.ini file' fi
rm -f "$SETTINGS_INI"
# DEFAULT_PROFILE="$(find "$SETTINGS_DIR" -mindepth 1 -maxdepth 1 -name "*.default" -not -name "profile.default")"
if [ -n "$DEFAULT_RELEASE_PROFILE" ]; then
logg info "Syncing $DEFAULT_RELEASE_PROFILE to $SETTINGS_DIR/profile.default"
rsync -a "$DEFAULT_RELEASE_PROFILE/" "$SETTINGS_DIR/profile.default"
fi fi
else elif [ "$SETTINGS_DIR" == "$HOME/.mozilla/firefox" ]; then
logg error "The $SETTINGS_INI file is missing" if command -v firefox-esr > /dev/null; then
fi FIREFOX_EXE="$(which firefox-esr)"
installFirefoxProfileConnector
### Miscellaneous default profiles elif command -v firefox > /dev/null && [ "$(which firefox)" != *'snap'* ] && [ "$(which firefox)" != *'flatpak'* ] && [ ! -d /Applications ] && [ ! -d /System ]; then
for NEW_PROFILE in "automation" "development" "miscellaneous"; do # Conditional check ensures Snap / Flatpak / macOS Firefox versions do not try to install to the wrong folder
if [ ! -d "$SETTINGS_DIR/profile.${NEW_PROFILE}" ] && [ -d "$SETTINGS_DIR/profile.default" ]; then FIREFOX_EXE="$(which firefox)"
logg info "Cloning $NEW_PROFILE from profile.default" installFirefoxProfileConnector
rsync -a "$SETTINGS_DIR/profile.default/" "$SETTINGS_DIR/profile.${NEW_PROFILE}" else
rsync -a "${XDG_DATA_HOME:-$HOME/.local/share}/firefox/" "$SETTINGS_DIR/profile.${NEW_PROFILE}" if [ -d /Applications ] && [ -d /System ]; then
cp -f "${XDG_CONFIG_HOME:-$HOME/.config}/firefox/user.js" "$SETTINGS_DIR/profile.${NEW_PROFILE}" # Continue on macOS without logging because profiles are not stored here on macOS
continue
else
logg warn 'Unable to register Firefox executable'
logg info "Settings directory: $SETTINGS_DIR"
continue
fi
fi fi
done
### Public git profile
if [ -d "$SETTINGS_DIR/profile.git" ]; then
logg info 'Resetting the Firefox git profile'
cd "$SETTINGS_DIR/profile.git"
git reset --hard HEAD
git clean -fxd
logg info 'Pulling latest updates to the Firefox git profile'
git pull origin master
else
logg info 'Cloning the public Firefox git profile'
cd "$SETTINGS_DIR" && git clone {{ .firefoxPublicProfile }} profile.git
fi fi
### Initiatize Firefox default profiles
if command -v "$FIREFOX_EXE" > /dev/null; then
### Create default profile by launching Firefox headlessly
logg info "Firefox executable set to $FIREFOX_EXE"
if [ ! -d "$SETTINGS_DIR" ]; then
logg info 'Running Firefox headlessly to generate default profiles'
timeout 8 "$FIREFOX_EXE" --headless
logg info 'Finished running Firefox headlessly'
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.'
timeout 8 "$FIREFOX_EXE" --headless
logg info 'Finished running Firefox headlessly (while fixing the missing macOS installs.ini issue)'
fi
### Copy user.js to profile.git profile ### Add the populated profiles.ini
cp -f "${XDG_CONFIG_HOME:-$HOME/.config}/firefox/user.js" "$SETTINGS_DIR/profile.git" logg info "Copying "${XDG_DATA_HOME:-$HOME/.local/share}/firefox/profiles.ini" to profile directory"
if [ -d /Applications ] && [ -d /System ]; then
# macOS
logg info "Copying ~/.local/share/firefox/profiles.ini to $SETTINGS_DIR/../profiles.ini"
cp -f "${XDG_DATA_HOME:-$HOME/.local/share}/firefox/profiles.ini" "$SETTINGS_DIR/../profiles.ini"
SETTINGS_INI="$SETTINGS_DIR/../installs.ini"
else
# Linux
logg info "Copying ~/.local/share/firefox/profiles.ini to $SETTINGS_DIR/profiles.ini"
cp -f "${XDG_DATA_HOME:-$HOME/.local/share}/firefox/profiles.ini" "$SETTINGS_DIR/profiles.ini"
SETTINGS_INI="$SETTINGS_DIR/installs.ini"
fi
### Git profile w/ plugins installed (installation happens below) ### Default profile (created by launching Firefox headlessly)
if [ ! -d "$SETTINGS_DIR/profile.plugins" ]; then # DEFAULT_RELEASE_PROFILE="$(find "$SETTINGS_DIR" -mindepth 1 -maxdepth 1 -name "*.default-*")"
logg info "Syncing $SETTINGS_DIR/profile.git to $SETTINGS_DIR/profile.plugins" if [ -f "$SETTINGS_INI" ]; then
rsync -a "$SETTINGS_DIR/profile.git/" "$SETTINGS_DIR/profile.plugins" DEFAULT_PROFILE_PROFILE="$SETTINGS_DIR/$(cat "$SETTINGS_INI" | grep 'Default=' | sed 's/.*Profiles\///')"
rsync -a "${XDG_DATA_HOME:-$HOME/.local/share}/firefox/" "$SETTINGS_DIR/profile.plugins" logg info 'Removing previous installs.ini file'
cp -f "${XDG_CONFIG_HOME:-$HOME/.config}/firefox/user.js" "$SETTINGS_DIR/profile.plugins" rm -f "$SETTINGS_INI"
fi # DEFAULT_PROFILE="$(find "$SETTINGS_DIR" -mindepth 1 -maxdepth 1 -name "*.default" -not -name "profile.default")"
if [ -n "$DEFAULT_RELEASE_PROFILE" ]; then
logg info "Syncing $DEFAULT_RELEASE_PROFILE to $SETTINGS_DIR/profile.default"
rsync -a "$DEFAULT_RELEASE_PROFILE/" "$SETTINGS_DIR/profile.default"
fi
else
logg error "The $SETTINGS_INI file is missing"
fi
{{- if stat (joinPath .host.home ".config" "age" "chezmoi.txt") }} ### Miscellaneous default profiles
### Private hosted profile for NEW_PROFILE in "automation" "development" "miscellaneous"; do
# Deprecated in favor of using the Restic profile tasks saved in `~/.config/task/Taskfile.yml` if [ ! -d "$SETTINGS_DIR/profile.${NEW_PROFILE}" ] && [ -d "$SETTINGS_DIR/profile.default" ]; then
# if [ ! -d "$SETTINGS_DIR/profile.private" ]; then logg info "Cloning $NEW_PROFILE from profile.default"
# logg info 'Downloading the encrypted Firefox private profile' rsync -a "$SETTINGS_DIR/profile.default/" "$SETTINGS_DIR/profile.${NEW_PROFILE}"
# cd "$SETTINGS_DIR" rsync -a "${XDG_DATA_HOME:-$HOME/.local/share}/firefox/" "$SETTINGS_DIR/profile.${NEW_PROFILE}"
# curl -sSL '{ { .firefoxPrivateProfile } }' -o profile.private.tar.gz.age cp -f "${XDG_CONFIG_HOME:-$HOME/.config}/firefox/user.js" "$SETTINGS_DIR/profile.${NEW_PROFILE}"
# logg info 'Decrypting the Firefox private profile' fi
# chezmoi decrypt profile.private.tar.gz.age > profile.private.tar.gz || EXIT_DECRYPT_CODE=$? done
# if [ -z "$EXIT_DECRYPT_CODE" ]; then
# rm -f profile.private.tar.gz.age ### Public git profile
# logg info 'Decompressing the Firefox private profile' if [ -d "$SETTINGS_DIR/profile.git" ]; then
# tar -xzf profile.private.tar.gz logg info 'Resetting the Firefox git profile'
# logg success 'The Firefox private profile was successfully installed' cd "$SETTINGS_DIR/profile.git"
# cp -f "${XDG_CONFIG_HOME:-$HOME/.config}/firefox/user.js" "$SETTINGS_DIR/profile.private" git reset --hard HEAD
# logg info 'Copied ~/.config/firefox/user.js to profile.private profile' git clean -fxd
# else logg info 'Pulling latest updates to the Firefox git profile'
# logg error 'Failed to decrypt the private Firefox profile' git pull origin master
# fi else
# fi logg info 'Cloning the public Firefox git profile'
{{- end }} cd "$SETTINGS_DIR" && git clone {{ .firefoxPublicProfile }} profile.git
fi
### Install Firefox addons (using list declared in .chezmoidata.yaml)
for SETTINGS_PROFILE in "profile.plugins" "profile.private"; do ### Copy user.js to profile.git profile
if [ -d "$SETTINGS_DIR/$SETTINGS_PROFILE" ]; then cp -f "${XDG_CONFIG_HOME:-$HOME/.config}/firefox/user.js" "$SETTINGS_DIR/profile.git"
for FIREFOX_PLUGIN in {{ list (.firefoxAddOns | toString | replace "[" "" | replace "]" "") | uniq | join " " }}; do
logg info "Processing the $FIREFOX_PLUGIN Firefox add-on" ### Git profile w/ plugins installed (installation happens below)
PLUGIN_HTML="$(mktemp)" if [ ! -d "$SETTINGS_DIR/profile.plugins" ]; then
curl --silent "https://addons.mozilla.org/en-US/firefox/addon/$FIREFOX_PLUGIN/" > "$PLUGIN_HTML" logg info "Syncing $SETTINGS_DIR/profile.git to $SETTINGS_DIR/profile.plugins"
PLUGIN_TMP="$(mktemp)" rsync -a "$SETTINGS_DIR/profile.git/" "$SETTINGS_DIR/profile.plugins"
cat "$PLUGIN_HTML" | htmlq '#redux-store-state' | sed 's/^<scri.*application\/json">//' | sed 's/<\/script>$//' > "$PLUGIN_TMP" rsync -a "${XDG_DATA_HOME:-$HOME/.local/share}/firefox/" "$SETTINGS_DIR/profile.plugins"
PLUGIN_ID="$(jq '.addons.bySlug["'"$FIREFOX_PLUGIN"'"]' "$PLUGIN_TMP")" cp -f "${XDG_CONFIG_HOME:-$HOME/.config}/firefox/user.js" "$SETTINGS_DIR/profile.plugins"
if [ "$PLUGIN_ID" != 'null' ]; then fi
PLUGIN_FILE_ID="$(jq -r '.addons.byID["'"$PLUGIN_ID"'"].guid' "$PLUGIN_TMP")"
if [ "$PLUGIN_FILE_ID" != 'null' ]; then {{- if stat (joinPath .host.home ".config" "age" "chezmoi.txt") }}
PLUGIN_URL="$(cat "$PLUGIN_HTML" | htmlq '.InstallButtonWrapper-download-link' --attribute href)" ### Private hosted profile
PLUGIN_FILENAME="${PLUGIN_FILE_ID}.xpi" # Deprecated in favor of using the Restic profile tasks saved in `~/.config/task/Taskfile.yml`
PLUGIN_FOLDER="$(echo "$PLUGIN_FILENAME" | sed 's/.xpi$//')" # if [ ! -d "$SETTINGS_DIR/profile.private" ]; then
if [ ! -d "$SETTINGS_DIR/$SETTINGS_PROFILE/extensions/$PLUGIN_FOLDER" ]; then # logg info 'Downloading the encrypted Firefox private profile'
logg info 'Downloading add-on XPI file for '"$PLUGIN_FILENAME"' ('"$FIREFOX_PLUGIN"')' # cd "$SETTINGS_DIR"
if [ ! -d "$SETTINGS_DIR/$SETTINGS_PROFILE/extensions" ]; then # curl -sSL '{ { .firefoxPrivateProfile } }' -o profile.private.tar.gz.age
mkdir -p "$SETTINGS_DIR/$SETTINGS_PROFILE/extensions" # logg info 'Decrypting the Firefox private profile'
# chezmoi decrypt profile.private.tar.gz.age > profile.private.tar.gz || EXIT_DECRYPT_CODE=$?
# if [ -z "$EXIT_DECRYPT_CODE" ]; then
# rm -f profile.private.tar.gz.age
# logg info 'Decompressing the Firefox private profile'
# tar -xzf profile.private.tar.gz
# logg success 'The Firefox private profile was successfully installed'
# cp -f "${XDG_CONFIG_HOME:-$HOME/.config}/firefox/user.js" "$SETTINGS_DIR/profile.private"
# logg info 'Copied ~/.config/firefox/user.js to profile.private profile'
# else
# logg error 'Failed to decrypt the private Firefox profile'
# fi
# fi
{{- end }}
### Install Firefox addons (using list declared in .chezmoidata.yaml)
for SETTINGS_PROFILE in "profile.plugins" "profile.private"; do
if [ -d "$SETTINGS_DIR/$SETTINGS_PROFILE" ]; then
for FIREFOX_PLUGIN in {{ list (.firefoxAddOns | toString | replace "[" "" | replace "]" "") | uniq | join " " }}; do
logg info "Processing the $FIREFOX_PLUGIN Firefox add-on"
PLUGIN_HTML="$(mktemp)"
curl --silent "https://addons.mozilla.org/en-US/firefox/addon/$FIREFOX_PLUGIN/" > "$PLUGIN_HTML"
PLUGIN_TMP="$(mktemp)"
cat "$PLUGIN_HTML" | htmlq '#redux-store-state' | sed 's/^<scri.*application\/json">//' | sed 's/<\/script>$//' > "$PLUGIN_TMP"
PLUGIN_ID="$(jq '.addons.bySlug["'"$FIREFOX_PLUGIN"'"]' "$PLUGIN_TMP")"
if [ "$PLUGIN_ID" != 'null' ]; then
PLUGIN_FILE_ID="$(jq -r '.addons.byID["'"$PLUGIN_ID"'"].guid' "$PLUGIN_TMP")"
if [ "$PLUGIN_FILE_ID" != 'null' ]; then
PLUGIN_URL="$(cat "$PLUGIN_HTML" | htmlq '.InstallButtonWrapper-download-link' --attribute href)"
PLUGIN_FILENAME="${PLUGIN_FILE_ID}.xpi"
PLUGIN_FOLDER="$(echo "$PLUGIN_FILENAME" | sed 's/.xpi$//')"
if [ ! -d "$SETTINGS_DIR/$SETTINGS_PROFILE/extensions/$PLUGIN_FOLDER" ]; then
logg info 'Downloading add-on XPI file for '"$PLUGIN_FILENAME"' ('"$FIREFOX_PLUGIN"')'
if [ ! -d "$SETTINGS_DIR/$SETTINGS_PROFILE/extensions" ]; then
mkdir -p "$SETTINGS_DIR/$SETTINGS_PROFILE/extensions"
fi
curl -sSL "$PLUGIN_URL" -o "$SETTINGS_DIR/$SETTINGS_PROFILE/extensions/$PLUGIN_FILENAME"
# Unzipping like this causes Firefox to complain about unsigned plugins
# TODO - figure out how to headlessly enable the extensions in such a way that is compatible with Flatpak / Snap
# using the /usr/lib/firefox/distribution/policies.json works but this is not compatible with Flatpak / Snap out of the box
# it seems since they do not have access to the file system by default. Also, using the policies.json approach forces
# all Firefox profiles to use the same extensions. Ideally, we should find a way to enable the extensions scoped
# to the user profile.
# logg info 'Unzipping '"$PLUGIN_FILENAME"' ('"$FIREFOX_PLUGIN"')'
# unzip "$SETTINGS_DIR/$SETTINGS_PROFILE/extensions/$PLUGIN_FILENAME" -d "$SETTINGS_DIR/$SETTINGS_PROFILE/extensions/$PLUGIN_FOLDER"
logg success 'Installed `'"$FIREFOX_PLUGIN"'`'
fi fi
curl -sSL "$PLUGIN_URL" -o "$SETTINGS_DIR/$SETTINGS_PROFILE/extensions/$PLUGIN_FILENAME" else
# Unzipping like this causes Firefox to complain about unsigned plugins logg warn 'A null Firefox add-on filename was detected for `'"$FIREFOX_PLUGIN"'`'
# TODO - figure out how to headlessly enable the extensions in such a way that is compatible with Flatpak / Snap
# using the /usr/lib/firefox/distribution/policies.json works but this is not compatible with Flatpak / Snap out of the box
# it seems since they do not have access to the file system by default. Also, using the policies.json approach forces
# all Firefox profiles to use the same extensions. Ideally, we should find a way to enable the extensions scoped
# to the user profile.
# logg info 'Unzipping '"$PLUGIN_FILENAME"' ('"$FIREFOX_PLUGIN"')'
# unzip "$SETTINGS_DIR/$SETTINGS_PROFILE/extensions/$PLUGIN_FILENAME" -d "$SETTINGS_DIR/$SETTINGS_PROFILE/extensions/$PLUGIN_FOLDER"
logg success 'Installed `'"$FIREFOX_PLUGIN"'`'
fi fi
else else
logg warn 'A null Firefox add-on filename was detected for `'"$FIREFOX_PLUGIN"'`' logg warn 'A null Firefox add-on ID was detected for `'"$FIREFOX_PLUGIN"'`'
fi fi
else done
logg warn 'A null Firefox add-on ID was detected for `'"$FIREFOX_PLUGIN"'`' fi
fi done
done fi
fi done
done }
fi firefoxSetup
done
{{ end -}} {{ end -}}

View file

@ -1,44 +0,0 @@
{{- if ne .host.distro.family "windows" -}}
#!/usr/bin/env bash
# @file Vagrant VMWare Utility
# @brief Installs the `vagrant-vmware-utility` if both Vagrant and VMWare are installed
# @description
# This script first checks if `vagrant`, `vmware`, and `vagrant-vmware-utility` are available in the `PATH`. If they are present, then the script
# configures the [`vagrant-vmware-utility`](https://developer.hashicorp.com/vagrant/docs/providers/vmware/vagrant-vmware-utility) by generating the required security certificates and enabling the service.
# This system package enables the capability of controlling both VMWare Workstation and VMWare Fusion with Vagrant.
#
# Since this script runs only when `vagrant`, `vmware`, and `vagrant-vmware-utility` are in the `PATH`, this means that it will run
# when you use an installation template that includes all three pieces of software in the software list defined in
# `home/.chezmoidata.yaml`.
#
# ## Links
#
# * [Vagrant VMWare Utility on GitHub](https://github.com/hashicorp/vagrant-vmware-desktop)
# * [`home/.chezmoidata.yaml`](https://github.com/megabyte-labs/install.doctor/blob/master/home/.chezmoidata.yaml)
{{ includeTemplate "universal/profile" }}
{{ includeTemplate "universal/logg" }}
# @description Only run logic if both Vagrant and VMWare are installed
if command -v vagrant > /dev/null && command -v vmware-id > /dev/null; then
# @description Vagrant VMWare Utility configuration
if command -v vagrant-vmware-utility > /dev/null; then
if [ -f /usr/local/bin/certificates/vagrant-utility.key ]; then
logg info 'Assuming Vagrant VMWare Utility certificates have been properly generated since /usr/local/bin/certificates/vagrant-utility.key is present'
else
logg info 'Generating Vagrant VMWare Utility certificates'
sudo vagrant-vmware-utility certificate generate
logg success 'Generated Vagrant VMWare Utility certificates via `vagrant-vmware-utility certificate generate`'
fi
logg info 'Ensuring the Vagrant VMWare Utility service is enabled'
sudo vagrant-vmware-utility service install || EXIT_CODE=$?
if [ -n "$EXIT_CODE" ]; then
logg info 'The Vagrant VMWare Utility command `vagrant-vmware-utility service install` failed. It is probably already setup.'
fi
fi
else
logg info 'Vagrant is not installed so the Vagrant plugins will not be installed'
logg info 'Vagrant or VMWare is not installed so the Vagrant VMWare utility will not be configured'
fi
{{ end -}}

View file

@ -1,76 +0,0 @@
{{- if eq .host.distro.family "linux" -}}
{{- $softwareGroup := nospace (cat "_" .host.softwareGroup) -}}
{{- $softwareList := list (index .softwareGroups $softwareGroup | toString | replace "[" "" | replace "]" "") | uniq | join " " -}}
{{- if (contains " vmware" $softwareList) -}}
#!/usr/bin/env bash
# @file Linux VMWare Workstation Install
# @brief Installs VMWare Workstation Pro on Linux devices, applies a "publicly-retrieved" license key (see disclaimer), and automatically accepts the terms and conditions
# @description
# This script ensures the user included `vmware` in their software installation list. It then checks for presence of the `vmware` utility. If it is not present, then the script:
#
# 1. Downloads the [VMWare Workstation Pro](https://www.vmware.com/content/vmware/vmware-published-sites/us/products/workstation-pro.html.html) Linux installer
# 2. Installs VMWare Workstation Pro
# 3. Passes options to the installation script that automatically apply a publicly retrived license key and accept the Terms & Conditions
#
# **DISCLAIMER:** If you plan on using VMWare Workstation for anything but evaluation purposes, then we highly suggest purchasing a copy
# of VMWare Workstation. The "publicly-retrived" license keys are scattered throughout GitHub and we are not exactly
# sure why they work. You can pass in your own key by utilizing the `VMWARE_WORKSTATION_LICENSE_KEY` environment variable. More details on
# using environment variables or repository-housed encrypted secrets can be found in our [Secrets documentation](https://install.doctor/docs/customization/secrets).
#
# ## VMWare on macOS
#
# This script only installs VMWare Workstation on Linux. The macOS-variant titled VMWare Fusion can be installed using a Homebrew
# cask so a "work-around" script does not have to be used.
#
# ## VMWare vs. Parallels vs. VirtualBox vs. KVM vs. Hyper-V
#
# There are a handful of VM virtualization providers you can choose from. VMWare is a nice compromise between OS compatibility and performance.
# Parallels, on the hand, might be better for macOS since it is designed specifically for macOS. Finally, VirtualBox is a truly free,
# open-source option that does not come with the same optimizations that VMWare and Parallels provide.
#
# Other virtualization options include KVM (Linux / macOS) and Hyper-V (Windows). These options are better used for headless
# systems.
#
# ## Links
#
# * [VMWare Workstation homepage](https://www.vmware.com/content/vmware/vmware-published-sites/us/products/workstation-pro.html.html)
{{- $secretKey := "" -}}
{{- if (stat (joinPath (.chezmoi.sourceDir ".chezmoitemplates" "secrets" "VMWARE_WORKSTATION_LICENSE_KEY"))) -}}
{{- $secretKey = (default "4C21U-2KK9Q-M8130-4V2QH-CF810" (includeTemplate "secrets/VMWARE_WORKSTATION_LICENSE_KEY" | decrypt | trim)) -}}
{{- else -}}
{{- $secretKey = (default "4C21U-2KK9Q-M8130-4V2QH-CF810" (env "VMWARE_WORKSTATION_LICENSE_KEY")) -}}
{{- end }}
# Source: https://gist.github.com/PurpleVibe32/30a802c3c8ec902e1487024cdea26251
# key: {{ $secretKey }}
{{ includeTemplate "universal/profile-before" }}
{{ includeTemplate "universal/logg-before" }}
### Install VMware Workstation
if ! command -v vmware > /dev/null; then
### Download VMWare Workstation
logg info 'VMware Workstation is not installed'
VMWARE_WORKSTATION_URL=https://www.vmware.com/go/getworkstation-linux
VMWARE_WORKSTATION_DIR=/tmp/workstation-downloads
mkdir -p $VMWARE_WORKSTATION_DIR
logg info 'Downloading VMware Workstation Installer'
curl -sSLA "Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20220101 Firefox/102.0" "$VMWARE_WORKSTATION_URL" -o "$VMWARE_WORKSTATION_DIR/tryworkstation-linux-64.sh"
### Register product key / license
VMWARE_WORKSTATION_LICENSE_KEY='{{- $secretKey -}}'
if [ -n "$VMWARE_WORKSTATION_LICENSE_KEY" ]; then
logg info 'Registering VMware Workstation Pro license with serial number'
sudo "$VMWARE_WORKSTATION_DIR/tryworkstation-linux-64.sh" --eulas-agreed --console --required --set-setting vmware-workstation serialNumber "$VMWARE_WORKSTATION_LICENSE_KEY"
else
logg info 'Agreeing to VMWare Workstation Pro license (without serial number)'
sudo "$VMWARE_WORKSTATION_DIR/tryworkstation-linux-64.sh" --eulas-agreed --console --required
fi
logg success 'VMware Workstation installed successfully'
else
logg info 'VMware Workstation is already installed'
fi
{{ end -}}
{{ end -}}

View file

@ -1,90 +1,202 @@
{{- if eq .host.distro.family "linux" -}}
#!/usr/bin/env bash #!/usr/bin/env bash
# @file Linux VMWare Workstation Install
# @brief Installs VMWare Workstation Pro on Linux devices, applies a "publicly-retrieved" license key (see disclaimer), and automatically accepts the terms and conditions
# @description
# This script ensures the user included `vmware` in their software installation list. It then checks for presence of the `vmware` utility. If it is not present, then the script:
#
# 1. Downloads the [VMWare Workstation Pro](https://www.vmware.com/content/vmware/vmware-published-sites/us/products/workstation-pro.html.html) Linux installer
# 2. Installs VMWare Workstation Pro
# 3. Passes options to the installation script that automatically apply a publicly retrived license key and accept the Terms & Conditions
#
# **DISCLAIMER:** If you plan on using VMWare Workstation for anything but evaluation purposes, then we highly suggest purchasing a copy
# of VMWare Workstation. The "publicly-retrived" license keys are scattered throughout GitHub and we are not exactly
# sure why they work. You can pass in your own key by utilizing the `VMWARE_WORKSTATION_LICENSE_KEY` environment variable. More details on
# using environment variables or repository-housed encrypted secrets can be found in our [Secrets documentation](https://install.doctor/docs/customization/secrets).
#
# ## VMWare on macOS
#
# This script only installs VMWare Workstation on Linux. The macOS-variant titled VMWare Fusion can be installed using a Homebrew
# cask so a "work-around" script does not have to be used.
#
# ## VMWare vs. Parallels vs. VirtualBox vs. KVM vs. Hyper-V
#
# There are a handful of VM virtualization providers you can choose from. VMWare is a nice compromise between OS compatibility and performance.
# Parallels, on the hand, might be better for macOS since it is designed specifically for macOS. Finally, VirtualBox is a truly free,
# open-source option that does not come with the same optimizations that VMWare and Parallels provide.
#
# Other virtualization options include KVM (Linux / macOS) and Hyper-V (Windows). These options are better used for headless
# systems.
#
# ## Links
#
# * [VMWare Workstation homepage](https://www.vmware.com/content/vmware/vmware-published-sites/us/products/workstation-pro.html.html)
# @file Vagrant VMWare Utility
# @brief Installs the `vagrant-vmware-utility` if both Vagrant and VMWare are installed
# @description
# This script first checks if `vagrant`, `vmware`, and `vagrant-vmware-utility` are available in the `PATH`. If they are present, then the script
# configures the [`vagrant-vmware-utility`](https://developer.hashicorp.com/vagrant/docs/providers/vmware/vagrant-vmware-utility) by generating the required security certificates and enabling the service.
# This system package enables the capability of controlling both VMWare Workstation and VMWare Fusion with Vagrant.
#
# Since this script runs only when `vagrant`, `vmware`, and `vagrant-vmware-utility` are in the `PATH`, this means that it will run
# when you use an installation template that includes all three pieces of software in the software list defined in
# `home/.chezmoidata.yaml`.
#
# ## Links
#
# * [Vagrant VMWare Utility on GitHub](https://github.com/hashicorp/vagrant-vmware-desktop)
# * [`home/.chezmoidata.yaml`](https://github.com/megabyte-labs/install.doctor/blob/master/home/.chezmoidata.yaml)
# @file VMWare Configuration # @file VMWare Configuration
# @brief Patches VMWare to leverage kernel optimizations, support macOS, and work harmoniously with Secure Boot. It also enables optional services such as the USB service. # @brief Patches VMWare to leverage kernel optimizations, support macOS, and work harmoniously with Secure Boot. It also enables optional services such as the USB service.
# @description # @description
# This script performs various VMWare optimizations that allow VMWare to work optimally with all features enabled. # This script performs various VMWare optimizations that allow VMWare to work optimally with all features enabled.
{{- $softwareGroup := nospace (cat "_" .host.softwareGroup) -}}
{{- $softwareList := list (index .softwareGroups $softwareGroup | toString | replace "[" "" | replace "]" "") | uniq | join " " -}}
{{- $secretKey := "" -}}
{{- if (stat (joinPath (.chezmoi.sourceDir ".chezmoitemplates" "secrets" "VMWARE_WORKSTATION_LICENSE_KEY"))) -}}
{{- $secretKey = (default "4C21U-2KK9Q-M8130-4V2QH-CF810" (includeTemplate "secrets/VMWARE_WORKSTATION_LICENSE_KEY" | decrypt | trim)) -}}
{{- else -}}
{{- $secretKey = (default "4C21U-2KK9Q-M8130-4V2QH-CF810" (env "VMWARE_WORKSTATION_LICENSE_KEY")) -}}
{{- end }}
# Source: https://gist.github.com/PurpleVibe32/30a802c3c8ec902e1487024cdea26251
# key: {{ $secretKey }}
{{ includeTemplate "universal/profile" }} {{ includeTemplate "universal/profile" }}
{{ includeTemplate "universal/logg" }} {{ includeTemplate "universal/logg" }}
### Run logic if VMware is installed function vmwareSetup() {
if command -v vmware > /dev/null; then ### Run on Linux only
### Build kernel modules if they are not present if [ -f /etc/os-release ]; then
if [ ! -f "/lib/modules/$(uname -r)/misc/vmmon.ko" ] || [ ! -f "/lib/modules/$(uname -r)/misc/vmnet.ko" ]; then ### Run if vmware is to be installed
### Build VMWare host modules {{- if (contains " vmware" $softwareList) -}}
logg info 'Building VMware host modules' ### Install VMware Workstation
if sudo vmware-modconfig --console --install-all; then if ! command -v vmware > /dev/null; then
logg success 'Built VMWare host modules successfully with `sudo vmware-modconfig --console --install-all`' ### Download VMWare Workstation
else logg info 'VMware Workstation is not installed'
logg info 'Acquiring VMware version from CLI' VMWARE_WORKSTATION_URL=https://www.vmware.com/go/getworkstation-linux
VMW_VERSION="$(vmware --version | cut -f 3 -d' ')" VMWARE_WORKSTATION_DIR=/tmp/workstation-downloads
mkdir -p /tmp/vmw_patch mkdir -p $VMWARE_WORKSTATION_DIR
cd /tmp/vmw_patch logg info 'Downloading VMware Workstation Installer'
logg info 'Downloading VMware host module patches' curl -sSLA "Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20220101 Firefox/102.0" "$VMWARE_WORKSTATION_URL" -o "$VMWARE_WORKSTATION_DIR/tryworkstation-linux-64.sh"
curl -sSL "https://github.com/mkubecek/vmware-host-modules/archive/workstation-$VMW_VERSION.tar.gz" -o /tmp/vmw_patch/workstation.tar.gz
tar -xzf /tmp/vmw_patch/workstation.tar.gz
cd vmware*
logg info 'Running `sudo make` and `sudo make install`'
sudo make
sudo make install
logg success 'Successfully configured VMware host module patches'
fi
### Sign VMware host modules if Secure Boot is enabled ### Register product key / license
if [ -f /sys/firmware/efi ]; then VMWARE_WORKSTATION_LICENSE_KEY='{{- $secretKey -}}'
logg info 'Signing host modules' if [ -n "$VMWARE_WORKSTATION_LICENSE_KEY" ]; then
mkdir -p /tmp/vmware logg info 'Registering VMware Workstation Pro license with serial number'
cd /tmp/vmware sudo "$VMWARE_WORKSTATION_DIR/tryworkstation-linux-64.sh" --eulas-agreed --console --required --set-setting vmware-workstation serialNumber "$VMWARE_WORKSTATION_LICENSE_KEY"
openssl req -new -x509 -newkey rsa:2048 -keyout MOK.priv -outform DER -out MOK.der -nodes -days 36500 -subj "/CN=VMware/"
"/usr/src/linux-headers-$(uname -r)/scripts/sign-file" sha256 ./MOK.priv ./MOK.der "$(modinfo -n vmmon)"
"/usr/src/linux-headers-$(uname -r)/scripts/sign-file" sha256 ./MOK.priv ./MOK.der "$(modinfo -n vmnet)"
echo '' | mokutil --import MOK.der
logg success 'Successfully signed VMware host modules. Reboot the host before powering on VMs'
fi
### Patch VMware with Unlocker
if [ ! -f /usr/lib/vmware/isoimages/darwin.iso ]; then
logg info 'Acquiring VMware Unlocker latest release version'
UNLOCKER_URL="$(curl -sSL 'https://api.github.com/repos/DrDonk/unlocker/releases/latest' | jq -r '.assets[0].browser_download_url')"
mkdir -p /tmp/vmware-unlocker
cd /tmp/vmware-unlocker
logg info 'Downloading unlocker.zip'
curl -sSL "$UNLOCKER_URL" -o unlocker.zip
unzip unlocker.zip
cd linux
logg info 'Running the unlocker'
echo "y" | sudo ./unlock
logg success 'Successfully unlocked VMware for macOS compatibility'
else
logg info '/usr/lib/vmware/isoimages/darwin.iso is already present on the system so VMware macOS unlocking will not be performed'
fi
if [[ ! "$(test -d /proc && grep Microsoft /proc/version > /dev/null)" ]]; then
### Start / enable VMWare service
logg info 'Ensuring `vmware.service` is enabled and running'
sudo systemctl enable vmware.service
sudo systemctl restart vmware.service
### Start / enable VMWare Workstation Server service
logg info 'Ensuring `vmware-workstation-server.service` is enabled and running'
sudo systemctl enable vmware-workstation-server.service
sudo systemctl restart vmware-workstation-server.service
### Start / enable VMWare USB Arbitrator service
if command -v vmware-usbarbitrator.service > /dev/null; then
logg info 'Ensuring `vmware-usbarbitrator.service` is enabled and running'
sudo systemctl enable vmware-usbarbitrator.service
sudo systemctl restart vmware-usbarbitrator.service
else else
logg warn '`vmware-usbarbitrator` does not exist in the PATH' logg info 'Agreeing to VMWare Workstation Pro license (without serial number)'
sudo "$VMWARE_WORKSTATION_DIR/tryworkstation-linux-64.sh" --eulas-agreed --console --required
fi fi
logg success 'VMware Workstation installed successfully'
else
logg info 'VMware Workstation is already installed'
fi fi
else {{ end -}}
logg info 'VMware host modules are present'
fi
else
logg warn 'VMware Workstation is not installed so the VMware Unlocker will not be installed'
fi
{{ end -}} ### Run logic if VMware is installed
if command -v vmware > /dev/null; then
### Build kernel modules if they are not present
if [ ! -f "/lib/modules/$(uname -r)/misc/vmmon.ko" ] || [ ! -f "/lib/modules/$(uname -r)/misc/vmnet.ko" ]; then
### Build VMWare host modules
logg info 'Building VMware host modules'
if sudo vmware-modconfig --console --install-all; then
logg success 'Built VMWare host modules successfully with `sudo vmware-modconfig --console --install-all`'
else
logg info 'Acquiring VMware version from CLI'
VMW_VERSION="$(vmware --version | cut -f 3 -d' ')"
mkdir -p /tmp/vmw_patch
cd /tmp/vmw_patch
logg info 'Downloading VMware host module patches'
curl -sSL "https://github.com/mkubecek/vmware-host-modules/archive/workstation-$VMW_VERSION.tar.gz" -o /tmp/vmw_patch/workstation.tar.gz
tar -xzf /tmp/vmw_patch/workstation.tar.gz
cd vmware*
logg info 'Running `sudo make` and `sudo make install`'
sudo make
sudo make install
logg success 'Successfully configured VMware host module patches'
fi
### Sign VMware host modules if Secure Boot is enabled
if [ -f /sys/firmware/efi ]; then
logg info 'Signing host modules'
mkdir -p /tmp/vmware
cd /tmp/vmware
openssl req -new -x509 -newkey rsa:2048 -keyout MOK.priv -outform DER -out MOK.der -nodes -days 36500 -subj "/CN=VMware/"
"/usr/src/linux-headers-$(uname -r)/scripts/sign-file" sha256 ./MOK.priv ./MOK.der "$(modinfo -n vmmon)"
"/usr/src/linux-headers-$(uname -r)/scripts/sign-file" sha256 ./MOK.priv ./MOK.der "$(modinfo -n vmnet)"
echo '' | mokutil --import MOK.der
logg success 'Successfully signed VMware host modules. Reboot the host before powering on VMs'
fi
### Patch VMware with Unlocker
if [ ! -f /usr/lib/vmware/isoimages/darwin.iso ]; then
logg info 'Acquiring VMware Unlocker latest release version'
UNLOCKER_URL="$(curl -sSL 'https://api.github.com/repos/DrDonk/unlocker/releases/latest' | jq -r '.assets[0].browser_download_url')"
mkdir -p /tmp/vmware-unlocker
cd /tmp/vmware-unlocker
logg info 'Downloading unlocker.zip'
curl -sSL "$UNLOCKER_URL" -o unlocker.zip
unzip unlocker.zip
cd linux
logg info 'Running the unlocker'
echo "y" | sudo ./unlock
logg success 'Successfully unlocked VMware for macOS compatibility'
else
logg info '/usr/lib/vmware/isoimages/darwin.iso is already present on the system so VMware macOS unlocking will not be performed'
fi
if [[ ! "$(test -d /proc && grep Microsoft /proc/version > /dev/null)" ]]; then
### Start / enable VMWare service
logg info 'Ensuring `vmware.service` is enabled and running'
sudo systemctl enable vmware.service
sudo systemctl restart vmware.service
### Start / enable VMWare Workstation Server service
logg info 'Ensuring `vmware-workstation-server.service` is enabled and running'
sudo systemctl enable vmware-workstation-server.service
sudo systemctl restart vmware-workstation-server.service
### Start / enable VMWare USB Arbitrator service
if command -v vmware-usbarbitrator.service > /dev/null; then
logg info 'Ensuring `vmware-usbarbitrator.service` is enabled and running'
sudo systemctl enable vmware-usbarbitrator.service
sudo systemctl restart vmware-usbarbitrator.service
else
logg warn '`vmware-usbarbitrator` does not exist in the PATH'
fi
fi
else
logg info 'VMware host modules are present'
fi
else
logg warn 'VMware Workstation is not installed so the VMware Unlocker will not be installed'
fi
fi
# @description Only run logic if both Vagrant and VMWare are installed
if command -v vagrant > /dev/null && command -v vmware-id > /dev/null; then
# @description Vagrant VMWare Utility configuration
if command -v vagrant-vmware-utility > /dev/null; then
if [ -f /usr/local/bin/certificates/vagrant-utility.key ]; then
logg info 'Assuming Vagrant VMWare Utility certificates have been properly generated since /usr/local/bin/certificates/vagrant-utility.key is present'
else
logg info 'Generating Vagrant VMWare Utility certificates'
sudo vagrant-vmware-utility certificate generate
logg success 'Generated Vagrant VMWare Utility certificates via `vagrant-vmware-utility certificate generate`'
fi
logg info 'Ensuring the Vagrant VMWare Utility service is enabled'
sudo vagrant-vmware-utility service install || EXIT_CODE=$?
if [ -n "$EXIT_CODE" ]; then
logg info 'The Vagrant VMWare Utility command `vagrant-vmware-utility service install` failed. It is probably already setup.'
fi
fi
else
logg info 'Vagrant is not installed so the Vagrant plugins will not be installed'
logg info 'Vagrant or VMWare is not installed so the Vagrant VMWare utility will not be configured'
fi
}
vmwareSetup

View file

@ -21,19 +21,33 @@ if command -v powerline > /dev/null && [ -f "$HOME/.bashrc" ]; then
# logg info 'Running `source ~/.bashrc`' # logg info 'Running `source ~/.bashrc`'
# source ~/.bashrc # source ~/.bashrc
# logg success 'Imported the `~/.bashrc` profile' # logg success 'Imported the `~/.bashrc` profile'
if command -v bash-it > /dev/null; then if [ -d "$BASH_IT" ]; then
if [ -n "$BASH_IT" ]; then ### Ensure bash-it is installed
cd "$BASH_IT" || logg warn "The $BASH_IT directory does not exist" if ! command -v bash-it > /dev/null; then
logg info 'Enabling bash-it completions' logg info 'Installing `bash-it` since it is not available yet as a command'
yes | bash-it enable completion defaults dirs docker docker-compose export git makefile ng npm ssh system vagrant bash "$BASH_IT/install.sh" --silent --no-modify-config
logg info 'Enabling bash-it plugins'
yes | bash-it enable plugin base blesh browser cht-sh dirs gitstatus powerline sudo xterm
logg info 'Finished enabling bash-it functions'
else
logg warn 'The BASH_IT variable needs to be defined'
fi fi
### Ensure completions are enabled
cd "$BASH_IT/enabled"
logg info 'Enabling bash-it completions'
# TODO: Move these plugins to the .chezmoidata.yaml
for COMPLETION in defaults dirs docker docker-compose export git makefile ng npm ssh system vagrant; do
if ! ls "$BASH_IT/enabled" | grep "$COMPLETION" > /dev/null; then
echo y | bash-it enable completion dirs > /dev/null && logg info "Enabled the bash-it $COMPLETION completion plugin" || logg error "Failed to install the $COMPLETION bash-it completion plugin"
fi
done
### Ensure plugins are enabled
logg info 'Enabling bash-it plugins'
# TODO: Move these plugins to the .chezmoidata.yaml
for PLUGIN in base blesh browser cht-sh dirs gitstatus powerline sudo xterm; do
if ls "$BASH_IT/enabled" | grep "$PLUGIN" > /dev/null; then
echo y | bash-it enable plugin "$PLUGIN" > /dev/null && logg info "Enabled the bash-it $PLUGIN plugin" || logg error "Failed to install the $PLUGIN bash-it plugin"
fi
done
else else
logg warn '`bash-it` is not available' logg warn 'The path specified by BASH_IT does not exist yet'
fi fi
else else
if ! command -v powerline > /dev/null; then if ! command -v powerline > /dev/null; then

View file

@ -248,7 +248,7 @@ if command -v cloudflared > /dev/null && [ -d "$HOME/.local/etc/cloudflared" ];
fi fi
TUNNEL_ID="$(cloudflared tunnel list | grep "host-{{ .host.hostname }}" | sed 's/ .*//')" TUNNEL_ID="$(cloudflared tunnel list | grep "host-{{ .host.hostname }}" | sed 's/ .*//')"
logg info "Tunnel ID: $TUNNEL_ID" logg info "Tunnel ID: $TUNNEL_ID"
if [ -f "/usr/local/etc/cloudflared/${TUNNEL_ID}.json" ] if [ -f "/usr/local/etc/cloudflared/${TUNNEL_ID}.json" ]; then
logg info 'Symlinking tunnel configuration to /usr/local/etc/cloudflared/credentials.json' logg info 'Symlinking tunnel configuration to /usr/local/etc/cloudflared/credentials.json'
rm -f /usr/local/etc/cloudflared/credentials.json rm -f /usr/local/etc/cloudflared/credentials.json
sudo ln -s "/usr/local/etc/cloudflared/${TUNNEL_ID}.json" /usr/local/etc/cloudflared/credentials.json sudo ln -s "/usr/local/etc/cloudflared/${TUNNEL_ID}.json" /usr/local/etc/cloudflared/credentials.json

View file

@ -19,6 +19,16 @@ if command -v brew > /dev/null; then
brew bundle --verbose --no-lock --file=/dev/stdin <<EOF brew bundle --verbose --no-lock --file=/dev/stdin <<EOF
{{ includeTemplate "darwin/Brewfile" . -}} {{ includeTemplate "darwin/Brewfile" . -}}
EOF EOF
### Ensure Python version is 3.11 or higher
PYTHON_VERSION="$(python3 --version | sed 's/Python //')"
MIN_PYTHON_VERSION="3.11.0"
if [ "$(printf '%s\n' "$MIN_PYTHON_VERSION" "$PYTHON_VERSION" | sort -V | head -n1)" = "$MIN_PYTHON_VERSION" ]; then
logg info "Minimum Python version satisfied (minimum: $MIN_PYTHON_VERSION, current: $PYTHON_VERSION)"
else
logg info 'Updating Python 3 version with `brew link --overwrite python@3.11`'
brew link --overwrite python@3.11
fi
else else
logg error '`brew` was not found in the PATH' logg error '`brew` was not found in the PATH'
fi fi

View file

@ -20,6 +20,7 @@ brew "gum"
brew "jq" brew "jq"
brew "node" brew "node"
brew "progress" brew "progress"
brew "python@3.11"
tap "go-task/tap" tap "go-task/tap"
brew "go-task/tap/go-task" brew "go-task/tap/go-task"
brew "volta" brew "volta"

View file

@ -47,7 +47,7 @@ if [ "$BASH_SUPPORT" = 'true' ]; then
# Prompt (on bash only) # Prompt (on bash only)
if [[ "$(hostname)" != *'-minimal' ]]; then if [[ "$(hostname)" != *'-minimal' ]]; then
### Styled Terminal ### Styled Terminal
export BASH_IT="$HOME/.local/bash_it" export BASH_IT="${XDG_DATA_HOME:-$HOME/.local/share}/bash_it"
export BASH_IT_THEME="powerline" export BASH_IT_THEME="powerline"
if command -v powerline-daemon > /dev/null && [ -f "$BASH_IT/bash_it.sh" ]; then if command -v powerline-daemon > /dev/null && [ -f "$BASH_IT/bash_it.sh" ]; then
. "$BASH_IT/bash_it.sh" . "$BASH_IT/bash_it.sh"

View file

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View file

@ -78,7 +78,7 @@
"jest-html-reporters", "jest-html-reporters",
{ {
"filename": "index.html", "filename": "index.html",
"logoImgPath": "~/.local/megabyte-labs/assets/icon-jest.png", "logoImgPath": "~/.local/assets/icon-jest.png",
"openReport": true, "openReport": true,
"pageTitle": "Code Coverage Report", "pageTitle": "Code Coverage Report",
"publicPath": "./coverage" "publicPath": "./coverage"

View file

@ -1,11 +1,5 @@
# shellcheck disable=SC1090,SC1091,SC2034,SC2154,SC2296 # shellcheck disable=SC1090,SC1091,SC2034,SC2154,SC2296
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
### Language / Fonts ### Language / Fonts
export LANG="en_US" export LANG="en_US"
export LC_ALL="en_US.UTF-8" export LC_ALL="en_US.UTF-8"
@ -19,6 +13,12 @@ if [ -f "$HOME/.config/shell/profile.sh" ]; then
. "$XDG_CONFIG_HOME/shell/profile.sh" . "$XDG_CONFIG_HOME/shell/profile.sh"
fi fi
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
### Misc. ### Misc.
export HISTFILE="$XDG_STATE_HOME/zsh/history" export HISTFILE="$XDG_STATE_HOME/zsh/history"
export ZLE_RPROMPT_INDENT=0 export ZLE_RPROMPT_INDENT=0

View file

@ -10028,16 +10028,17 @@ softwarePlugins:
docker: docker:
cmd: bash -c 'if ! docker extension list | grep "{PLUGIN}" > /dev/null; then echo y | docker extension install "{PLUGIN}"; fi' cmd: bash -c 'if ! docker extension list | grep "{PLUGIN}" > /dev/null; then echo y | docker extension install "{PLUGIN}"; fi'
plugins: plugins:
- docker/disk-usage-extension - ambassador/telepresence-docker-extension:1.0.13
- docker/logs-explorer-extension - docker/disk-usage-extension:0.2.7
- docker/logs-explorer-extension:0.2.3
- docker/resource-usage-extension - docker/resource-usage-extension
- docker/volumes-backup-extension:main - docker/volumes-backup-extension:main:1.1.4
- drone/drone-ci-docker-extension - drone/drone-ci-docker-extension:0.2.0
- okteto/docker-desktop-extension - okteto/docker-desktop-extension:0.3.3
- portainer/portainer-docker-extension - portainer/portainer-docker-extension:2.18.4
- redhatdeveloper/openshift-dd-ext - redhatdeveloper/openshift-dd-ext
- snyk/snyk-docker-desktop-extension - snyk/snyk-docker-desktop-extension
- tailscale/docker-extension - tailscale/docker-extension:1.0.0
dockerImages: dockerImages:
cmd: null cmd: null
plugins: plugins: