Update dotfiles/.local/share/chezmoi/dot_local/assets/Betelgeuse.macOS.terminal, dotfiles/.local/share/chezmoi/dot_local/bin/executable_squash-symlink, dotfiles/.local/share/chezmoi/dot_local/bin/executable_run, dotfiles/.local/share/chezmoi/dot_local/bin/executable_ramqube, dotfiles/.local/share/chezmoi/dot_local/bin/executable_quickstart, dotfiles/.local/share/chezmoi/dot_local/bin/executable_provision, dotfiles/.local/share/chezmoi/dot_local/bin/executable_opener, dotfiles/.local/share/chezmoi/dot_local/bin/executable_logg, dotfiles/.local/share/chezmoi/dot_local/bin/executable_ksetwallpaper, dotfiles/.local/share/chezmoi/dot_local/bin/executable_install-terminal-theme, dotfiles/.local/share/chezmoi/dot_local/bin/executable_install-dotfiles, dotfiles/.local/share/chezmoi/dot_local/bin/executable_firefox-profile-import, dotfiles/.local/share/chezmoi/dot_local/bin/executable_chrome-profile-import, dotfiles/.local/share/chezmoi/dot_local/bin/executable_firefox-profile-export, dotfiles/.local/share/chezmoi/dot_local/bin/executable_chrome-profile-export
Deleted dotfiles/.local/bin/dotfile-system-prune
2022-11-22 09:48:25 -08:00
#!/usr/bin/env bash
2022-12-24 21:13:11 -08:00
# @file .local/bin/provision
2023-01-13 20:13:00 -08:00
# @brief Installs dependencies, clones the Install Doctor repository, and then starts Chezmoi
2022-12-24 21:13:11 -08:00
# @description
# This script ensures Chezmoi, Glow, and Gum are installed. It also includes logging functions for styled logging.
2023-01-13 20:13:00 -08:00
# After dependencies are installed, it adds the necessary files from https://gitlab.com/megabyte-labs/install.doctor.git into
2022-12-24 21:13:11 -08:00
# ~/.local/share/chezmoi. Finally, it begins the TUI experience by displaying styled documentation, prompts, and finishes
# by calling the appropriate Chezmoi commands.
2022-12-02 07:33:04 -08:00
{{ includeTemplate "universal/logg" }}
2022-12-01 23:56:41 -08:00
2023-01-24 21:51:41 -08:00
### Prompt for sudo password and (optionally) enable passwordless sudo
sudo -n true || SUDO_EXIT_CODE=$?
if [ -n " $ SUDO_EXIT_CODE " ]; then
logg info 'Your user will temporarily be granted passwordless sudo for the duration of the script'
logg info 'Press `CTRL+C` to bypass this prompt to either enter your password when needed or perform a non-privileged installation'
logg info 'Note: Non-privileged installations are not yet supported'
echo "$(whoami) ALL=(ALL:ALL) NOPASSWD: ALL # TEMPORARY FOR INSTALL DOCTOR" | sudo tee -a /etc/sudoers
fi
2023-01-09 20:51:59 -08:00
### Ensure ~/.local/share/megabyte-labs is a directory
if [ ! -d " ${ XDG_DATA_DIR : - $ HOME / . local / share } /megabyte-labs" ]; then
mkdir -p " ${ XDG_DATA_DIR : - $ HOME / . local / share } /megabyte-labs"
fi
2022-11-30 01:02:39 -08:00
### Qubes dom0
if command -v qubesctl > /dev/null; then
# The VM name that will manage the Ansible provisioning (for Qubes dom0)
ANSIBLE_PROVISION_VM="provision"
# Ensure sys-whonix is configured (for Qubes dom0)
CONFIG_WIZARD_COUNT=0
function configureWizard() {
if xwininfo -root -tree | grep "Anon Connection Wizard"; then
WINDOW_ID="$(xwininfo -root -tree | grep "Anon Connection Wizard" | sed 's/^ *\([^ ]*\) .*/\1/')"
xdotool windowactivate " $ WINDOW_ID " && sleep 1 && xdotool key 'Enter' && sleep 1 && xdotool key 'Tab Tab Enter' && sleep 24 && xdotool windowactivate " $ WINDOW_ID " && sleep 1 && xdotool key 'Enter' && sleep 300
qvm-shutdown --wait sys-whonix
sleep 3
qvm-start sys-whonix
if xwininfo -root -tree | grep "systemcheck | Whonix" > /dev/null; then
2022-12-24 21:03:35 -08:00
WINDOW_ID_SYS_CHECK="$(xwininfo -root -tree | grep "systemcheck | Whonix" | sed 's/^ *\([^ ]*\) .*/\1/')"
2022-11-30 01:02:39 -08:00
if xdotool windowactivate " $ WINDOW_ID_SYS_CHECK "; then
sleep 1
xdotool key 'Enter'
fi
Update README.md, .local/share/chezmoi/home/dot_local/bin/executable_provision, .local/software.TODO/desktop/Brewfile, .local/software.TODO/desktop/Packages.config, .local/software.TODO/desktop/Wingetfile, .local/software.TODO/development/Brewfile, .local/software.TODO/development/Packages.config, .local/software.TODO/development/Scoopfile, .local/software.TODO/terminal/Brewfile, .local/software.TODO/terminal/Packages.config, .local/software.TODO/terminal/Scoopfile, .local/software.TODO/Gasfile.yml, .local/bin/provision, .local/bin/open, .local/share/chezmoi/home/dot_local/bin/executable_open, .local/share/chezmoi/home/dot_local/Taskfile-local.yml
Deleted .local/bin/quickstart, .local/bin/chrome-profile-export, .local/bin/chrome-profile-import, .local/bin/firefox-profile-export, .local/bin/firefox-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_chrome-profile-export, .local/share/chezmoi/home/dot_local/bin/executable_chrome-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_firefox-profile-export, .local/share/chezmoi/home/dot_local/bin/executable_firefox-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_fonttest, .local/share/chezmoi/home/dot_local/bin/executable_quickstart, .local/share/chezmoi/home/dot_local/bin/executable_squash-symlink
2022-11-29 22:54:50 -08:00
fi
else
2022-11-30 01:02:39 -08:00
sleep 3
CONFIG_WIZARD_COUNT=$((CONFIG_WIZARD_COUNT + 1))
if [[ " $ CONFIG_WIZARD_COUNT " == '4' ]]; then
echo "The sys-whonix anon-connection-wizard utility did not open."
else
echo "Checking for anon-connection-wizard again.."
configureWizard
fi
Update README.md, .local/share/chezmoi/home/dot_local/bin/executable_provision, .local/software.TODO/desktop/Brewfile, .local/software.TODO/desktop/Packages.config, .local/software.TODO/desktop/Wingetfile, .local/software.TODO/development/Brewfile, .local/software.TODO/development/Packages.config, .local/software.TODO/development/Scoopfile, .local/software.TODO/terminal/Brewfile, .local/software.TODO/terminal/Packages.config, .local/software.TODO/terminal/Scoopfile, .local/software.TODO/Gasfile.yml, .local/bin/provision, .local/bin/open, .local/share/chezmoi/home/dot_local/bin/executable_open, .local/share/chezmoi/home/dot_local/Taskfile-local.yml
Deleted .local/bin/quickstart, .local/bin/chrome-profile-export, .local/bin/chrome-profile-import, .local/bin/firefox-profile-export, .local/bin/firefox-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_chrome-profile-export, .local/share/chezmoi/home/dot_local/bin/executable_chrome-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_firefox-profile-export, .local/share/chezmoi/home/dot_local/bin/executable_firefox-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_fonttest, .local/share/chezmoi/home/dot_local/bin/executable_quickstart, .local/share/chezmoi/home/dot_local/bin/executable_squash-symlink
2022-11-29 22:54:50 -08:00
fi
2022-11-30 01:02:39 -08:00
}
Update README.md, .local/share/chezmoi/home/dot_local/bin/executable_provision, .local/software.TODO/desktop/Brewfile, .local/software.TODO/desktop/Packages.config, .local/software.TODO/desktop/Wingetfile, .local/software.TODO/development/Brewfile, .local/software.TODO/development/Packages.config, .local/software.TODO/development/Scoopfile, .local/software.TODO/terminal/Brewfile, .local/software.TODO/terminal/Packages.config, .local/software.TODO/terminal/Scoopfile, .local/software.TODO/Gasfile.yml, .local/bin/provision, .local/bin/open, .local/share/chezmoi/home/dot_local/bin/executable_open, .local/share/chezmoi/home/dot_local/Taskfile-local.yml
Deleted .local/bin/quickstart, .local/bin/chrome-profile-export, .local/bin/chrome-profile-import, .local/bin/firefox-profile-export, .local/bin/firefox-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_chrome-profile-export, .local/share/chezmoi/home/dot_local/bin/executable_chrome-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_firefox-profile-export, .local/share/chezmoi/home/dot_local/bin/executable_firefox-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_fonttest, .local/share/chezmoi/home/dot_local/bin/executable_quickstart, .local/share/chezmoi/home/dot_local/bin/executable_squash-symlink
2022-11-29 22:54:50 -08:00
### Ensure dom0 is updated
if [ ! -f /root/dom0-updated ]; then
sudo qubesctl --show-output state.sls update.qubes-dom0
sudo qubes-dom0-update --clean -y
touch /root/dom0-updated
Update dotfiles/.local/share/chezmoi/dot_local/assets/Betelgeuse.macOS.terminal, dotfiles/.local/share/chezmoi/dot_local/bin/executable_squash-symlink, dotfiles/.local/share/chezmoi/dot_local/bin/executable_run, dotfiles/.local/share/chezmoi/dot_local/bin/executable_ramqube, dotfiles/.local/share/chezmoi/dot_local/bin/executable_quickstart, dotfiles/.local/share/chezmoi/dot_local/bin/executable_provision, dotfiles/.local/share/chezmoi/dot_local/bin/executable_opener, dotfiles/.local/share/chezmoi/dot_local/bin/executable_logg, dotfiles/.local/share/chezmoi/dot_local/bin/executable_ksetwallpaper, dotfiles/.local/share/chezmoi/dot_local/bin/executable_install-terminal-theme, dotfiles/.local/share/chezmoi/dot_local/bin/executable_install-dotfiles, dotfiles/.local/share/chezmoi/dot_local/bin/executable_firefox-profile-import, dotfiles/.local/share/chezmoi/dot_local/bin/executable_chrome-profile-import, dotfiles/.local/share/chezmoi/dot_local/bin/executable_firefox-profile-export, dotfiles/.local/share/chezmoi/dot_local/bin/executable_chrome-profile-export
Deleted dotfiles/.local/bin/dotfile-system-prune
2022-11-22 09:48:25 -08:00
fi
Update README.md, .local/share/chezmoi/home/dot_local/bin/executable_provision, .local/software.TODO/desktop/Brewfile, .local/software.TODO/desktop/Packages.config, .local/software.TODO/desktop/Wingetfile, .local/software.TODO/development/Brewfile, .local/software.TODO/development/Packages.config, .local/software.TODO/development/Scoopfile, .local/software.TODO/terminal/Brewfile, .local/software.TODO/terminal/Packages.config, .local/software.TODO/terminal/Scoopfile, .local/software.TODO/Gasfile.yml, .local/bin/provision, .local/bin/open, .local/share/chezmoi/home/dot_local/bin/executable_open, .local/share/chezmoi/home/dot_local/Taskfile-local.yml
Deleted .local/bin/quickstart, .local/bin/chrome-profile-export, .local/bin/chrome-profile-import, .local/bin/firefox-profile-export, .local/bin/firefox-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_chrome-profile-export, .local/share/chezmoi/home/dot_local/bin/executable_chrome-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_firefox-profile-export, .local/share/chezmoi/home/dot_local/bin/executable_firefox-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_fonttest, .local/share/chezmoi/home/dot_local/bin/executable_quickstart, .local/share/chezmoi/home/dot_local/bin/executable_squash-symlink
2022-11-29 22:54:50 -08:00
### Ensure sys-whonix is running
if ! qvm-check --running sys-whonix; then
qvm-start sys-whonix --skip-if-running
configureWizard > /dev/null
fi
### Ensure TemplateVMs are updated
if [ ! -f /root/templatevms-updated ]; then
# timeout of 10 minutes is added here because the whonix-gw VM does not like to get updated
# with this method. Anyone know how to fix this?
2022-12-24 21:03:35 -08:00
sudo timeout 600 qubesctl --show-output --skip-dom0 --templates state.sls update.qubes-vm &> /dev/null || true
while read -r RESTART_VM; do
Update README.md, .local/share/chezmoi/home/dot_local/bin/executable_provision, .local/software.TODO/desktop/Brewfile, .local/software.TODO/desktop/Packages.config, .local/software.TODO/desktop/Wingetfile, .local/software.TODO/development/Brewfile, .local/software.TODO/development/Packages.config, .local/software.TODO/development/Scoopfile, .local/software.TODO/terminal/Brewfile, .local/software.TODO/terminal/Packages.config, .local/software.TODO/terminal/Scoopfile, .local/software.TODO/Gasfile.yml, .local/bin/provision, .local/bin/open, .local/share/chezmoi/home/dot_local/bin/executable_open, .local/share/chezmoi/home/dot_local/Taskfile-local.yml
Deleted .local/bin/quickstart, .local/bin/chrome-profile-export, .local/bin/chrome-profile-import, .local/bin/firefox-profile-export, .local/bin/firefox-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_chrome-profile-export, .local/share/chezmoi/home/dot_local/bin/executable_chrome-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_firefox-profile-export, .local/share/chezmoi/home/dot_local/bin/executable_firefox-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_fonttest, .local/share/chezmoi/home/dot_local/bin/executable_quickstart, .local/share/chezmoi/home/dot_local/bin/executable_squash-symlink
2022-11-29 22:54:50 -08:00
qvm-shutdown --wait " $ RESTART_VM "
done< <(qvm-ls --all --no-spinner --fields=name,state | grep Running | grep -v sys-net | grep -v sys-firewall | grep -v sys-whonix | grep -v dom0 | awk '{print $1}')
sudo touch /root/templatevms-updated
fi
### Ensure provisioning VM can run commands on any VM
echo "/bin/bash" | sudo tee /etc/qubes-rpc/qubes.VMShell
sudo chmod 755 /etc/qubes-rpc/qubes.VMShell
echo " $ ANSIBLE_PROVISION_VM "' dom0 allow' | sudo tee /etc/qubes-rpc/policy/qubes.VMShell
2022-12-24 21:03:35 -08:00
# shellcheck disable=SC2016
Update README.md, .local/share/chezmoi/home/dot_local/bin/executable_provision, .local/software.TODO/desktop/Brewfile, .local/software.TODO/desktop/Packages.config, .local/software.TODO/desktop/Wingetfile, .local/software.TODO/development/Brewfile, .local/software.TODO/development/Packages.config, .local/software.TODO/development/Scoopfile, .local/software.TODO/terminal/Brewfile, .local/software.TODO/terminal/Packages.config, .local/software.TODO/terminal/Scoopfile, .local/software.TODO/Gasfile.yml, .local/bin/provision, .local/bin/open, .local/share/chezmoi/home/dot_local/bin/executable_open, .local/share/chezmoi/home/dot_local/Taskfile-local.yml
Deleted .local/bin/quickstart, .local/bin/chrome-profile-export, .local/bin/chrome-profile-import, .local/bin/firefox-profile-export, .local/bin/firefox-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_chrome-profile-export, .local/share/chezmoi/home/dot_local/bin/executable_chrome-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_firefox-profile-export, .local/share/chezmoi/home/dot_local/bin/executable_firefox-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_fonttest, .local/share/chezmoi/home/dot_local/bin/executable_quickstart, .local/share/chezmoi/home/dot_local/bin/executable_squash-symlink
2022-11-29 22:54:50 -08:00
echo " $ ANSIBLE_PROVISION_VM "' $ anyvm allow' | sudo tee -a /etc/qubes-rpc/policy/qubes.VMShell
sudo chown "$(whoami):$(whoami)" /etc/qubes-rpc/policy/qubes.VMShell
sudo chmod 644 /etc/qubes-rpc/policy/qubes.VMShell
### Create provisioning VM and initialize the provisioning process from there
2022-12-24 21:03:35 -08:00
qvm-create --label red --template debian-11 " $ ANSIBLE_PROVISION_VM " &> /dev/null || true
Update README.md, .local/share/chezmoi/home/dot_local/bin/executable_provision, .local/software.TODO/desktop/Brewfile, .local/software.TODO/desktop/Packages.config, .local/software.TODO/desktop/Wingetfile, .local/software.TODO/development/Brewfile, .local/software.TODO/development/Packages.config, .local/software.TODO/development/Scoopfile, .local/software.TODO/terminal/Brewfile, .local/software.TODO/terminal/Packages.config, .local/software.TODO/terminal/Scoopfile, .local/software.TODO/Gasfile.yml, .local/bin/provision, .local/bin/open, .local/share/chezmoi/home/dot_local/bin/executable_open, .local/share/chezmoi/home/dot_local/Taskfile-local.yml
Deleted .local/bin/quickstart, .local/bin/chrome-profile-export, .local/bin/chrome-profile-import, .local/bin/firefox-profile-export, .local/bin/firefox-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_chrome-profile-export, .local/share/chezmoi/home/dot_local/bin/executable_chrome-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_firefox-profile-export, .local/share/chezmoi/home/dot_local/bin/executable_firefox-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_fonttest, .local/share/chezmoi/home/dot_local/bin/executable_quickstart, .local/share/chezmoi/home/dot_local/bin/executable_squash-symlink
2022-11-29 22:54:50 -08:00
qvm-volume extend " $ ANSIBLE_PROVISION_VM :private" "40G"
if [ -f ~/.vaultpass ]; then
qvm-run " $ ANSIBLE_PROVISION_VM " 'rm -f ~/QubesIncoming/dom0/.vaultpass'
qvm-copy-to-vm " $ ANSIBLE_PROVISION_VM " ~/.vaultpass
qvm-run " $ ANSIBLE_PROVISION_VM " 'cp ~/QubesIncoming/dom0/.vaultpass ~/.vaultpass'
fi
qvm-run --pass-io " $ ANSIBLE_PROVISION_VM " 'curl -sSL https://install.doctor/start > ~/start.sh && bash ~/start.sh'
exit 0
2022-11-30 01:02:39 -08:00
fi
2022-12-25 00:34:15 -08:00
### Source Homebrew if it installed but not in PATH
if ! command -v brew > /dev/null && [ -f /home/linuxbrew/.linuxbrew/bin/brew ]; then
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
fi
2022-11-30 01:02:39 -08:00
### System package manager update / Homebrew dependencies
2023-01-10 00:33:15 -08:00
if ! command -v curl > /dev/null || ! command -v git > /dev/null || ! command -v brew > /dev/null || ! command -v rsync > /dev/null || ! command -v unbuffer > /dev/null; then
2022-12-24 21:03:35 -08:00
# shellcheck disable=SC2016
2023-01-10 00:33:15 -08:00
logg info 'Ensuring `curl`, `expect`, `git`, and `rsync` are installed via the system package manager'
2022-11-30 01:02:39 -08:00
if command -v apt-get > /dev/null; then
# Debian / Ubuntu
sudo apt-get update
2023-01-10 00:33:15 -08:00
sudo apt-get install -y build-essential curl expect git rsync
2022-11-30 01:02:39 -08:00
elif command -v dnf > /dev/null; then
# Fedora
2023-01-10 00:33:15 -08:00
sudo dnf install -y curl expect git rsync
2022-11-30 01:02:39 -08:00
elif command -v yum > /dev/null; then
# CentOS
2023-01-10 00:33:15 -08:00
sudo yum install -y curl expect git rsync
2022-11-30 01:02:39 -08:00
elif command -v pacman > /dev/null; then
# Archlinux
sudo pacman update
2023-01-10 00:33:15 -08:00
sudo pacman -Sy curl expect git rsync
2022-11-30 01:02:39 -08:00
elif command -v zypper > /dev/null; then
# OpenSUSE
2023-01-10 00:33:15 -08:00
sudo zypper install -y curl expect git rsync
2022-11-30 01:02:39 -08:00
elif command -v apk > /dev/null; then
# Alpine
2023-01-10 00:33:15 -08:00
apk add curl expect git rsync
2022-11-30 01:02:39 -08:00
elif [ -d /Applications ] && [ -d /Library ]; then
# macOS
sudo xcode-select -p >/dev/null 2>&1 || xcode-select --install
elif command -v nix-env > /dev/null; then
# NixOS
echo "TODO - Add support for NixOS"
elif [[ " $ OSTYPE " == 'freebsd'* ]]; then
# FreeBSD
echo "TODO - Add support for FreeBSD"
elif command -v pkg > /dev/null; then
# Termux
echo "TODO - Add support for Termux"
elif command -v xbps-install > /dev/null; then
# Void
echo "TODO - Add support for Void"
elif [[ " $ OSTYPE " == 'cygwin' ]] || [[ " $ OSTYPE " == 'msys' ]] || [[ " $ OSTYPE " == 'win32' ]]; then
# Windows
2023-01-10 00:33:15 -08:00
choco install -y curl expect git node rsync
2022-11-30 01:02:39 -08:00
fi
Update dotfiles/.local/share/chezmoi/dot_local/assets/Betelgeuse.macOS.terminal, dotfiles/.local/share/chezmoi/dot_local/bin/executable_squash-symlink, dotfiles/.local/share/chezmoi/dot_local/bin/executable_run, dotfiles/.local/share/chezmoi/dot_local/bin/executable_ramqube, dotfiles/.local/share/chezmoi/dot_local/bin/executable_quickstart, dotfiles/.local/share/chezmoi/dot_local/bin/executable_provision, dotfiles/.local/share/chezmoi/dot_local/bin/executable_opener, dotfiles/.local/share/chezmoi/dot_local/bin/executable_logg, dotfiles/.local/share/chezmoi/dot_local/bin/executable_ksetwallpaper, dotfiles/.local/share/chezmoi/dot_local/bin/executable_install-terminal-theme, dotfiles/.local/share/chezmoi/dot_local/bin/executable_install-dotfiles, dotfiles/.local/share/chezmoi/dot_local/bin/executable_firefox-profile-import, dotfiles/.local/share/chezmoi/dot_local/bin/executable_chrome-profile-import, dotfiles/.local/share/chezmoi/dot_local/bin/executable_firefox-profile-export, dotfiles/.local/share/chezmoi/dot_local/bin/executable_chrome-profile-export
Deleted dotfiles/.local/bin/dotfile-system-prune
2022-11-22 09:48:25 -08:00
fi
Update README.md, .local/share/chezmoi/home/dot_local/bin/executable_provision, .local/software.TODO/desktop/Brewfile, .local/software.TODO/desktop/Packages.config, .local/software.TODO/desktop/Wingetfile, .local/software.TODO/development/Brewfile, .local/software.TODO/development/Packages.config, .local/software.TODO/development/Scoopfile, .local/software.TODO/terminal/Brewfile, .local/software.TODO/terminal/Packages.config, .local/software.TODO/terminal/Scoopfile, .local/software.TODO/Gasfile.yml, .local/bin/provision, .local/bin/open, .local/share/chezmoi/home/dot_local/bin/executable_open, .local/share/chezmoi/home/dot_local/Taskfile-local.yml
Deleted .local/bin/quickstart, .local/bin/chrome-profile-export, .local/bin/chrome-profile-import, .local/bin/firefox-profile-export, .local/bin/firefox-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_chrome-profile-export, .local/share/chezmoi/home/dot_local/bin/executable_chrome-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_firefox-profile-export, .local/share/chezmoi/home/dot_local/bin/executable_firefox-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_fonttest, .local/share/chezmoi/home/dot_local/bin/executable_quickstart, .local/share/chezmoi/home/dot_local/bin/executable_squash-symlink
2022-11-29 22:54:50 -08:00
### Install Homebrew
ensurePackageManagerHomebrew() {
if ! command -v brew > /dev/null; then
2022-12-01 23:56:41 -08:00
logg info 'Installing Homebrew'
Update README.md, .local/share/chezmoi/home/dot_local/bin/executable_provision, .local/software.TODO/desktop/Brewfile, .local/software.TODO/desktop/Packages.config, .local/software.TODO/desktop/Wingetfile, .local/software.TODO/development/Brewfile, .local/software.TODO/development/Packages.config, .local/software.TODO/development/Scoopfile, .local/software.TODO/terminal/Brewfile, .local/software.TODO/terminal/Packages.config, .local/software.TODO/terminal/Scoopfile, .local/software.TODO/Gasfile.yml, .local/bin/provision, .local/bin/open, .local/share/chezmoi/home/dot_local/bin/executable_open, .local/share/chezmoi/home/dot_local/Taskfile-local.yml
Deleted .local/bin/quickstart, .local/bin/chrome-profile-export, .local/bin/chrome-profile-import, .local/bin/firefox-profile-export, .local/bin/firefox-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_chrome-profile-export, .local/share/chezmoi/home/dot_local/bin/executable_chrome-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_firefox-profile-export, .local/share/chezmoi/home/dot_local/bin/executable_firefox-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_fonttest, .local/share/chezmoi/home/dot_local/bin/executable_quickstart, .local/share/chezmoi/home/dot_local/bin/executable_squash-symlink
2022-11-29 22:54:50 -08:00
if command -v sudo > /dev/null && sudo -n true; then
echo | bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
2022-12-25 00:08:21 -08:00
if [ -f /home/linuxbrew/.linuxbrew/bin/brew ]; then
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
brew install gcc
fi
Update README.md, .local/share/chezmoi/home/dot_local/bin/executable_provision, .local/software.TODO/desktop/Brewfile, .local/software.TODO/desktop/Packages.config, .local/software.TODO/desktop/Wingetfile, .local/software.TODO/development/Brewfile, .local/software.TODO/development/Packages.config, .local/software.TODO/development/Scoopfile, .local/software.TODO/terminal/Brewfile, .local/software.TODO/terminal/Packages.config, .local/software.TODO/terminal/Scoopfile, .local/software.TODO/Gasfile.yml, .local/bin/provision, .local/bin/open, .local/share/chezmoi/home/dot_local/bin/executable_open, .local/share/chezmoi/home/dot_local/Taskfile-local.yml
Deleted .local/bin/quickstart, .local/bin/chrome-profile-export, .local/bin/chrome-profile-import, .local/bin/firefox-profile-export, .local/bin/firefox-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_chrome-profile-export, .local/share/chezmoi/home/dot_local/bin/executable_chrome-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_firefox-profile-export, .local/share/chezmoi/home/dot_local/bin/executable_firefox-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_fonttest, .local/share/chezmoi/home/dot_local/bin/executable_quickstart, .local/share/chezmoi/home/dot_local/bin/executable_squash-symlink
2022-11-29 22:54:50 -08:00
else
2022-12-01 23:56:41 -08:00
logg info 'Looks like the user does not have passwordless sudo privileges. A sudo password may be required.'
Update README.md, .local/share/chezmoi/home/dot_local/bin/executable_provision, .local/software.TODO/desktop/Brewfile, .local/software.TODO/desktop/Packages.config, .local/software.TODO/desktop/Wingetfile, .local/software.TODO/development/Brewfile, .local/software.TODO/development/Packages.config, .local/software.TODO/development/Scoopfile, .local/software.TODO/terminal/Brewfile, .local/software.TODO/terminal/Packages.config, .local/software.TODO/terminal/Scoopfile, .local/software.TODO/Gasfile.yml, .local/bin/provision, .local/bin/open, .local/share/chezmoi/home/dot_local/bin/executable_open, .local/share/chezmoi/home/dot_local/Taskfile-local.yml
Deleted .local/bin/quickstart, .local/bin/chrome-profile-export, .local/bin/chrome-profile-import, .local/bin/firefox-profile-export, .local/bin/firefox-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_chrome-profile-export, .local/share/chezmoi/home/dot_local/bin/executable_chrome-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_firefox-profile-export, .local/share/chezmoi/home/dot_local/bin/executable_firefox-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_fonttest, .local/share/chezmoi/home/dot_local/bin/executable_quickstart, .local/share/chezmoi/home/dot_local/bin/executable_squash-symlink
2022-11-29 22:54:50 -08:00
bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" || BREW_EXIT_CODE="$?"
2022-12-25 00:08:21 -08:00
if [ -f /home/linuxbrew/.linuxbrew/bin/brew ]; then
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
brew install gcc
fi
Update README.md, .local/share/chezmoi/home/dot_local/bin/executable_provision, .local/software.TODO/desktop/Brewfile, .local/software.TODO/desktop/Packages.config, .local/software.TODO/desktop/Wingetfile, .local/software.TODO/development/Brewfile, .local/software.TODO/development/Packages.config, .local/software.TODO/development/Scoopfile, .local/software.TODO/terminal/Brewfile, .local/software.TODO/terminal/Packages.config, .local/software.TODO/terminal/Scoopfile, .local/software.TODO/Gasfile.yml, .local/bin/provision, .local/bin/open, .local/share/chezmoi/home/dot_local/bin/executable_open, .local/share/chezmoi/home/dot_local/Taskfile-local.yml
Deleted .local/bin/quickstart, .local/bin/chrome-profile-export, .local/bin/chrome-profile-import, .local/bin/firefox-profile-export, .local/bin/firefox-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_chrome-profile-export, .local/share/chezmoi/home/dot_local/bin/executable_chrome-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_firefox-profile-export, .local/share/chezmoi/home/dot_local/bin/executable_firefox-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_fonttest, .local/share/chezmoi/home/dot_local/bin/executable_quickstart, .local/share/chezmoi/home/dot_local/bin/executable_squash-symlink
2022-11-29 22:54:50 -08:00
if [ -n " $ BREW_EXIT_CODE " ]; then
if command -v brew > /dev/null; then
logg warn 'Homebrew was installed but part of the installation failed. Attempting to fix..'
BREW_DIRS="share/man share/doc share/zsh/site-functions etc/bash_completion.d"
for BREW_DIR in $ BREW_DIRS ; do
if [ -d "$(brew --prefix)/ $ BREW_DIR " ]; then
sudo chown -R "$(whoami)" "$(brew --prefix)/ $ BREW_DIR "
fi
done
brew update --force --quiet
fi
fi
fi
fi
}
ensurePackageManagerHomebrew
Update dotfiles/.local/share/chezmoi/dot_local/assets/Betelgeuse.macOS.terminal, dotfiles/.local/share/chezmoi/dot_local/bin/executable_squash-symlink, dotfiles/.local/share/chezmoi/dot_local/bin/executable_run, dotfiles/.local/share/chezmoi/dot_local/bin/executable_ramqube, dotfiles/.local/share/chezmoi/dot_local/bin/executable_quickstart, dotfiles/.local/share/chezmoi/dot_local/bin/executable_provision, dotfiles/.local/share/chezmoi/dot_local/bin/executable_opener, dotfiles/.local/share/chezmoi/dot_local/bin/executable_logg, dotfiles/.local/share/chezmoi/dot_local/bin/executable_ksetwallpaper, dotfiles/.local/share/chezmoi/dot_local/bin/executable_install-terminal-theme, dotfiles/.local/share/chezmoi/dot_local/bin/executable_install-dotfiles, dotfiles/.local/share/chezmoi/dot_local/bin/executable_firefox-profile-import, dotfiles/.local/share/chezmoi/dot_local/bin/executable_chrome-profile-import, dotfiles/.local/share/chezmoi/dot_local/bin/executable_firefox-profile-export, dotfiles/.local/share/chezmoi/dot_local/bin/executable_chrome-profile-export
Deleted dotfiles/.local/bin/dotfile-system-prune
2022-11-22 09:48:25 -08:00
Update README.md, .local/share/chezmoi/home/dot_local/bin/executable_provision, .local/software.TODO/desktop/Brewfile, .local/software.TODO/desktop/Packages.config, .local/software.TODO/desktop/Wingetfile, .local/software.TODO/development/Brewfile, .local/software.TODO/development/Packages.config, .local/software.TODO/development/Scoopfile, .local/software.TODO/terminal/Brewfile, .local/software.TODO/terminal/Packages.config, .local/software.TODO/terminal/Scoopfile, .local/software.TODO/Gasfile.yml, .local/bin/provision, .local/bin/open, .local/share/chezmoi/home/dot_local/bin/executable_open, .local/share/chezmoi/home/dot_local/Taskfile-local.yml
Deleted .local/bin/quickstart, .local/bin/chrome-profile-export, .local/bin/chrome-profile-import, .local/bin/firefox-profile-export, .local/bin/firefox-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_chrome-profile-export, .local/share/chezmoi/home/dot_local/bin/executable_chrome-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_firefox-profile-export, .local/share/chezmoi/home/dot_local/bin/executable_firefox-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_fonttest, .local/share/chezmoi/home/dot_local/bin/executable_quickstart, .local/share/chezmoi/home/dot_local/bin/executable_squash-symlink
2022-11-29 22:54:50 -08:00
### Install installer dependencies via Homebrew
2022-11-30 01:02:39 -08:00
installBrewPackage() {
if ! command -v "$1" > /dev/null; then
2022-12-01 23:56:41 -08:00
logg 'Installing `'"$1"'`'
2022-11-30 01:02:39 -08:00
brew install "$1"
fi
}
Update README.md, .local/share/chezmoi/home/dot_local/bin/executable_provision, .local/software.TODO/desktop/Brewfile, .local/software.TODO/desktop/Packages.config, .local/software.TODO/desktop/Wingetfile, .local/software.TODO/development/Brewfile, .local/software.TODO/development/Packages.config, .local/software.TODO/development/Scoopfile, .local/software.TODO/terminal/Brewfile, .local/software.TODO/terminal/Packages.config, .local/software.TODO/terminal/Scoopfile, .local/software.TODO/Gasfile.yml, .local/bin/provision, .local/bin/open, .local/share/chezmoi/home/dot_local/bin/executable_open, .local/share/chezmoi/home/dot_local/Taskfile-local.yml
Deleted .local/bin/quickstart, .local/bin/chrome-profile-export, .local/bin/chrome-profile-import, .local/bin/firefox-profile-export, .local/bin/firefox-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_chrome-profile-export, .local/share/chezmoi/home/dot_local/bin/executable_chrome-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_firefox-profile-export, .local/share/chezmoi/home/dot_local/bin/executable_firefox-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_fonttest, .local/share/chezmoi/home/dot_local/bin/executable_quickstart, .local/share/chezmoi/home/dot_local/bin/executable_squash-symlink
2022-11-29 22:54:50 -08:00
if command -v brew > /dev/null; then
2022-11-30 01:02:39 -08:00
installBrewPackage chezmoi
2022-12-01 23:56:41 -08:00
installBrewPackage glow
installBrewPackage gum
2022-11-30 01:02:39 -08:00
installBrewPackage node
installBrewPackage zx
Update dotfiles/.local/share/chezmoi/dot_local/assets/Betelgeuse.macOS.terminal, dotfiles/.local/share/chezmoi/dot_local/bin/executable_squash-symlink, dotfiles/.local/share/chezmoi/dot_local/bin/executable_run, dotfiles/.local/share/chezmoi/dot_local/bin/executable_ramqube, dotfiles/.local/share/chezmoi/dot_local/bin/executable_quickstart, dotfiles/.local/share/chezmoi/dot_local/bin/executable_provision, dotfiles/.local/share/chezmoi/dot_local/bin/executable_opener, dotfiles/.local/share/chezmoi/dot_local/bin/executable_logg, dotfiles/.local/share/chezmoi/dot_local/bin/executable_ksetwallpaper, dotfiles/.local/share/chezmoi/dot_local/bin/executable_install-terminal-theme, dotfiles/.local/share/chezmoi/dot_local/bin/executable_install-dotfiles, dotfiles/.local/share/chezmoi/dot_local/bin/executable_firefox-profile-import, dotfiles/.local/share/chezmoi/dot_local/bin/executable_chrome-profile-import, dotfiles/.local/share/chezmoi/dot_local/bin/executable_firefox-profile-export, dotfiles/.local/share/chezmoi/dot_local/bin/executable_chrome-profile-export
Deleted dotfiles/.local/bin/dotfile-system-prune
2022-11-22 09:48:25 -08:00
fi
2023-01-11 21:44:24 -08:00
### Clones the source repository
cloneStart() {
2023-01-13 20:13:00 -08:00
logg info "Cloning ${ START_REPO : - https : / / gitlab . com / megabyte - labs / install . doctor . git } to /usr/local/src/install.doctor"
rm -rf /usr/local/src/install.doctor
sudo git clone ${ START_REPO : - https : / / gitlab . com / megabyte - labs / install . doctor . git } /usr/local/src/install.doctor
chown -Rf " $ USER ":"$(id -g -n)" /usr/local/src/install.doctor
2023-01-11 21:44:24 -08:00
}
Update README.md, .local/share/chezmoi/home/dot_local/bin/executable_provision, .local/software.TODO/desktop/Brewfile, .local/software.TODO/desktop/Packages.config, .local/software.TODO/desktop/Wingetfile, .local/software.TODO/development/Brewfile, .local/software.TODO/development/Packages.config, .local/software.TODO/development/Scoopfile, .local/software.TODO/terminal/Brewfile, .local/software.TODO/terminal/Packages.config, .local/software.TODO/terminal/Scoopfile, .local/software.TODO/Gasfile.yml, .local/bin/provision, .local/bin/open, .local/share/chezmoi/home/dot_local/bin/executable_open, .local/share/chezmoi/home/dot_local/Taskfile-local.yml
Deleted .local/bin/quickstart, .local/bin/chrome-profile-export, .local/bin/chrome-profile-import, .local/bin/firefox-profile-export, .local/bin/firefox-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_chrome-profile-export, .local/share/chezmoi/home/dot_local/bin/executable_chrome-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_firefox-profile-export, .local/share/chezmoi/home/dot_local/bin/executable_firefox-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_fonttest, .local/share/chezmoi/home/dot_local/bin/executable_quickstart, .local/share/chezmoi/home/dot_local/bin/executable_squash-symlink
2022-11-29 22:54:50 -08:00
### Ensure source files are present
2023-01-13 20:13:00 -08:00
logg 'Ensuring /usr/local/src/install.doctor is owned by the user'
if [ -d /usr/local/src/install.doctor ] && [ ! -w /usr/local/src/install.doctor ]; then
sudo chown -Rf " $ USER ":"$(id -g -n)" /usr/local/src/install.doctor
Update README.md, .local/share/chezmoi/home/dot_local/bin/executable_provision, .local/software.TODO/desktop/Brewfile, .local/software.TODO/desktop/Packages.config, .local/software.TODO/desktop/Wingetfile, .local/software.TODO/development/Brewfile, .local/software.TODO/development/Packages.config, .local/software.TODO/development/Scoopfile, .local/software.TODO/terminal/Brewfile, .local/software.TODO/terminal/Packages.config, .local/software.TODO/terminal/Scoopfile, .local/software.TODO/Gasfile.yml, .local/bin/provision, .local/bin/open, .local/share/chezmoi/home/dot_local/bin/executable_open, .local/share/chezmoi/home/dot_local/Taskfile-local.yml
Deleted .local/bin/quickstart, .local/bin/chrome-profile-export, .local/bin/chrome-profile-import, .local/bin/firefox-profile-export, .local/bin/firefox-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_chrome-profile-export, .local/share/chezmoi/home/dot_local/bin/executable_chrome-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_firefox-profile-export, .local/share/chezmoi/home/dot_local/bin/executable_firefox-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_fonttest, .local/share/chezmoi/home/dot_local/bin/executable_quickstart, .local/share/chezmoi/home/dot_local/bin/executable_squash-symlink
2022-11-29 22:54:50 -08:00
fi
2023-01-13 20:13:00 -08:00
if [ -d /usr/local/src/install.doctor/.git ]; then
cd /usr/local/src/install.doctor || exit 1
if [ "$(git remote get-url origin)" == 'https://gitlab.com/megabyte-labs/install.doctor.git' ]; then
logg info "Pulling the latest changes from ${ START_REPO : - https : / / gitlab . com / megabyte - labs / install . doctor . git } to /usr/local/src/install.doctor"
2023-01-11 21:44:24 -08:00
git config pull.rebase false
git reset --hard HEAD
git clean -fxd
git pull origin master
else
2023-01-13 20:13:00 -08:00
logg info "The repository's origin URL has changed so /usr/local/src/install.doctor will be removed and re-cloned using the origin specified by the START_REPO variable"
2023-01-11 21:44:24 -08:00
cloneStart
fi
Update dotfiles/.local/share/chezmoi/dot_local/assets/Betelgeuse.macOS.terminal, dotfiles/.local/share/chezmoi/dot_local/bin/executable_squash-symlink, dotfiles/.local/share/chezmoi/dot_local/bin/executable_run, dotfiles/.local/share/chezmoi/dot_local/bin/executable_ramqube, dotfiles/.local/share/chezmoi/dot_local/bin/executable_quickstart, dotfiles/.local/share/chezmoi/dot_local/bin/executable_provision, dotfiles/.local/share/chezmoi/dot_local/bin/executable_opener, dotfiles/.local/share/chezmoi/dot_local/bin/executable_logg, dotfiles/.local/share/chezmoi/dot_local/bin/executable_ksetwallpaper, dotfiles/.local/share/chezmoi/dot_local/bin/executable_install-terminal-theme, dotfiles/.local/share/chezmoi/dot_local/bin/executable_install-dotfiles, dotfiles/.local/share/chezmoi/dot_local/bin/executable_firefox-profile-import, dotfiles/.local/share/chezmoi/dot_local/bin/executable_chrome-profile-import, dotfiles/.local/share/chezmoi/dot_local/bin/executable_firefox-profile-export, dotfiles/.local/share/chezmoi/dot_local/bin/executable_chrome-profile-export
Deleted dotfiles/.local/bin/dotfile-system-prune
2022-11-22 09:48:25 -08:00
else
2023-01-11 21:44:24 -08:00
cloneStart
Update dotfiles/.local/share/chezmoi/dot_local/assets/Betelgeuse.macOS.terminal, dotfiles/.local/share/chezmoi/dot_local/bin/executable_squash-symlink, dotfiles/.local/share/chezmoi/dot_local/bin/executable_run, dotfiles/.local/share/chezmoi/dot_local/bin/executable_ramqube, dotfiles/.local/share/chezmoi/dot_local/bin/executable_quickstart, dotfiles/.local/share/chezmoi/dot_local/bin/executable_provision, dotfiles/.local/share/chezmoi/dot_local/bin/executable_opener, dotfiles/.local/share/chezmoi/dot_local/bin/executable_logg, dotfiles/.local/share/chezmoi/dot_local/bin/executable_ksetwallpaper, dotfiles/.local/share/chezmoi/dot_local/bin/executable_install-terminal-theme, dotfiles/.local/share/chezmoi/dot_local/bin/executable_install-dotfiles, dotfiles/.local/share/chezmoi/dot_local/bin/executable_firefox-profile-import, dotfiles/.local/share/chezmoi/dot_local/bin/executable_chrome-profile-import, dotfiles/.local/share/chezmoi/dot_local/bin/executable_firefox-profile-export, dotfiles/.local/share/chezmoi/dot_local/bin/executable_chrome-profile-export
Deleted dotfiles/.local/bin/dotfile-system-prune
2022-11-22 09:48:25 -08:00
fi
Update README.md, .local/share/chezmoi/home/dot_local/bin/executable_provision, .local/software.TODO/desktop/Brewfile, .local/software.TODO/desktop/Packages.config, .local/software.TODO/desktop/Wingetfile, .local/software.TODO/development/Brewfile, .local/software.TODO/development/Packages.config, .local/software.TODO/development/Scoopfile, .local/software.TODO/terminal/Brewfile, .local/software.TODO/terminal/Packages.config, .local/software.TODO/terminal/Scoopfile, .local/software.TODO/Gasfile.yml, .local/bin/provision, .local/bin/open, .local/share/chezmoi/home/dot_local/bin/executable_open, .local/share/chezmoi/home/dot_local/Taskfile-local.yml
Deleted .local/bin/quickstart, .local/bin/chrome-profile-export, .local/bin/chrome-profile-import, .local/bin/firefox-profile-export, .local/bin/firefox-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_chrome-profile-export, .local/share/chezmoi/home/dot_local/bin/executable_chrome-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_firefox-profile-export, .local/share/chezmoi/home/dot_local/bin/executable_firefox-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_fonttest, .local/share/chezmoi/home/dot_local/bin/executable_quickstart, .local/share/chezmoi/home/dot_local/bin/executable_squash-symlink
2022-11-29 22:54:50 -08:00
2023-01-11 21:44:24 -08:00
### Copy new files from src git repository to dotfiles with rsync
rsyncChezmoiFiles() {
2023-01-13 20:13:00 -08:00
rsync -rtvu --delete /usr/local/src/install.doctor/docs/ " ${ XDG_DATA_DIR : - $ HOME / . local / share } /chezmoi/docs/" &
rsync -rtvu --delete /usr/local/src/install.doctor/home/ " ${ XDG_DATA_DIR : - $ HOME / . local / share } /chezmoi/home/" &
rsync -rtvu --delete /usr/local/src/install.doctor/system/ " ${ XDG_DATA_DIR : - $ HOME / . local / share } /chezmoi/system/" &
rsync -rtvu /usr/local/src/install.doctor/.chezmoiignore " ${ XDG_DATA_DIR : - $ HOME / . local / share } /chezmoi/.chezmoiignore" &
rsync -rtvu /usr/local/src/install.doctor/.chezmoiroot " ${ XDG_DATA_DIR : - $ HOME / . local / share } /chezmoi/.chezmoiroot" &
rsync -rtvu /usr/local/src/install.doctor/software.yml " ${ XDG_DATA_DIR : - $ HOME / . local / share } /chezmoi/software.yml" &
2023-01-11 21:44:24 -08:00
wait
logg success 'Successfully updated the ~/.local/share/chezmoi folder with changes from the upstream repository'
}
Update README.md, .local/share/chezmoi/home/dot_local/bin/executable_provision, .local/software.TODO/desktop/Brewfile, .local/software.TODO/desktop/Packages.config, .local/software.TODO/desktop/Wingetfile, .local/software.TODO/development/Brewfile, .local/software.TODO/development/Packages.config, .local/software.TODO/development/Scoopfile, .local/software.TODO/terminal/Brewfile, .local/software.TODO/terminal/Packages.config, .local/software.TODO/terminal/Scoopfile, .local/software.TODO/Gasfile.yml, .local/bin/provision, .local/bin/open, .local/share/chezmoi/home/dot_local/bin/executable_open, .local/share/chezmoi/home/dot_local/Taskfile-local.yml
Deleted .local/bin/quickstart, .local/bin/chrome-profile-export, .local/bin/chrome-profile-import, .local/bin/firefox-profile-export, .local/bin/firefox-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_chrome-profile-export, .local/share/chezmoi/home/dot_local/bin/executable_chrome-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_firefox-profile-export, .local/share/chezmoi/home/dot_local/bin/executable_firefox-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_fonttest, .local/share/chezmoi/home/dot_local/bin/executable_quickstart, .local/share/chezmoi/home/dot_local/bin/executable_squash-symlink
2022-11-29 22:54:50 -08:00
2023-01-11 21:44:24 -08:00
### Copy files to HOME folder with rsync
2023-01-13 20:13:00 -08:00
logg info 'Copying files from /usr/local/src/install.doctor to the HOME directory via rsync'
2023-01-11 21:44:24 -08:00
mkdir -p " ${ XDG_DATA_DIR : - $ HOME / . local / share } /chezmoi"
rsyncChezmoiFiles
Update README.md, .local/share/chezmoi/home/dot_local/bin/executable_provision, .local/software.TODO/desktop/Brewfile, .local/software.TODO/desktop/Packages.config, .local/software.TODO/desktop/Wingetfile, .local/software.TODO/development/Brewfile, .local/software.TODO/development/Packages.config, .local/software.TODO/development/Scoopfile, .local/software.TODO/terminal/Brewfile, .local/software.TODO/terminal/Packages.config, .local/software.TODO/terminal/Scoopfile, .local/software.TODO/Gasfile.yml, .local/bin/provision, .local/bin/open, .local/share/chezmoi/home/dot_local/bin/executable_open, .local/share/chezmoi/home/dot_local/Taskfile-local.yml
Deleted .local/bin/quickstart, .local/bin/chrome-profile-export, .local/bin/chrome-profile-import, .local/bin/firefox-profile-export, .local/bin/firefox-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_chrome-profile-export, .local/share/chezmoi/home/dot_local/bin/executable_chrome-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_firefox-profile-export, .local/share/chezmoi/home/dot_local/bin/executable_firefox-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_fonttest, .local/share/chezmoi/home/dot_local/bin/executable_quickstart, .local/share/chezmoi/home/dot_local/bin/executable_squash-symlink
2022-11-29 22:54:50 -08:00
### Ensure ~/.local/bin files are executable
2022-12-01 23:56:41 -08:00
logg info 'Ensuring scripts in ~/.local/bin are executable'
2022-12-24 21:03:35 -08:00
find " $ HOME /.local/bin" -maxdepth 1 -mindepth 1 -type f | while read -r BINFILE; do
Update README.md, .local/share/chezmoi/home/dot_local/bin/executable_provision, .local/software.TODO/desktop/Brewfile, .local/software.TODO/desktop/Packages.config, .local/software.TODO/desktop/Wingetfile, .local/software.TODO/development/Brewfile, .local/software.TODO/development/Packages.config, .local/software.TODO/development/Scoopfile, .local/software.TODO/terminal/Brewfile, .local/software.TODO/terminal/Packages.config, .local/software.TODO/terminal/Scoopfile, .local/software.TODO/Gasfile.yml, .local/bin/provision, .local/bin/open, .local/share/chezmoi/home/dot_local/bin/executable_open, .local/share/chezmoi/home/dot_local/Taskfile-local.yml
Deleted .local/bin/quickstart, .local/bin/chrome-profile-export, .local/bin/chrome-profile-import, .local/bin/firefox-profile-export, .local/bin/firefox-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_chrome-profile-export, .local/share/chezmoi/home/dot_local/bin/executable_chrome-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_firefox-profile-export, .local/share/chezmoi/home/dot_local/bin/executable_firefox-profile-import, .local/share/chezmoi/home/dot_local/bin/executable_fonttest, .local/share/chezmoi/home/dot_local/bin/executable_quickstart, .local/share/chezmoi/home/dot_local/bin/executable_squash-symlink
2022-11-29 22:54:50 -08:00
chmod +x " $ BINFILE "
done
2022-12-04 20:15:39 -08:00
### Run chezmoi init
if [ ! -f " $ HOME /.config/chezmoi/chezmoi.yaml" ]; then
### Show README.md snippet
if command -v glow > /dev/null; then
2022-12-24 20:21:19 -08:00
glow " $ HOME /.local/share/chezmoi/docs/CHEZMOI-INTRO.md"
2022-12-04 20:15:39 -08:00
fi
2022-12-02 15:28:30 -08:00
2022-12-04 20:15:39 -08:00
### Prompt for variables
if command -v gum > /dev/null; then
if [ -z " $ SOFTWARE_GROUP " ]; then
logg prompt 'Select the software group you would like to install. If your environment is a macOS, Windows, or environment with the DISPLAY environment variable then desktop software will be installed too. The software groups are in the ~/.local/share/chezmoi/home/.chezmoidata.yaml file.'
2022-12-05 20:44:36 -08:00
SOFTWARE_GROUP="$(gum choose "Basic" "Standard" "Full")"
2022-12-06 13:00:35 -08:00
export SOFTWARE_GROUP
2022-12-04 20:15:39 -08:00
fi
2022-12-02 08:43:15 -08:00
fi
2022-12-24 21:03:35 -08:00
# shellcheck disable=SC2016
2022-12-04 20:14:44 -08:00
logg info 'Running `chezmoi init` since the ~/.config/chezmoi/chezmoi.yaml is not present'
chezmoi init
fi
2023-01-03 19:18:30 -08:00
### Ensure Debian noninteractive mode
export DEBIAN_FRONTEND=noninteractive
2022-12-02 08:43:15 -08:00
### Run chezmoi apply
2022-12-24 21:03:35 -08:00
# shellcheck disable=SC2016
2022-12-02 08:43:15 -08:00
logg info 'Running `chezmoi apply`'
2023-01-10 02:11:58 -08:00
if [ " $ DEBUG_MODE " == 'true' ]; then
DEBUG_MODIFIER="-vvvvv"
else
DEBUG_MODIFIER=""
fi
2022-12-04 20:14:44 -08:00
if [ -n " $ FORCE_CHEZMOI " ]; then
2023-01-10 00:41:42 -08:00
if command -v unbuffer > /dev/null; then
2023-01-10 02:11:58 -08:00
unbuffer -p chezmoi apply $ DEBUG_MODIFIER -k --force 2>&1 | tee " ${ XDG_DATA_DIR : - $ HOME / . local / share } /megabyte-labs/betelgeuse.$(date +%s).log"
2023-01-10 00:41:42 -08:00
else
2023-01-10 02:11:58 -08:00
chezmoi apply $ DEBUG_MODIFIER -k --force 2>&1 | tee " ${ XDG_DATA_DIR : - $ HOME / . local / share } /megabyte-labs/betelgeuse.$(date +%s).log"
2023-01-10 00:41:42 -08:00
fi
2022-12-04 20:14:44 -08:00
else
2023-01-10 00:41:42 -08:00
if command -v unbuffer > /dev/null; then
2023-01-10 02:11:58 -08:00
unbuffer -p chezmoi apply $ DEBUG_MODIFIER -k 2>&1 | tee " ${ XDG_DATA_DIR : - $ HOME / . local / share } /megabyte-labs/betelgeuse.$(date +%s).log"
2023-01-10 00:41:42 -08:00
else
2023-01-10 02:11:58 -08:00
chezmoi apply $ DEBUG_MODIFIER -k 2>&1 | tee " ${ XDG_DATA_DIR : - $ HOME / . local / share } /megabyte-labs/betelgeuse.$(date +%s).log"
2023-01-10 00:41:42 -08:00
fi
2022-12-04 20:14:44 -08:00
fi
2023-01-24 21:51:41 -08:00
### Ensure gsed is available on macOS (for modifying /etc/sudoers to remove passwordless sudo)
if [ -d /Applications ] && [ -d /System ]; then
if ! command -v gsed > /dev/null; then
if command -v brew > /dev/null; then
brew install gsed
else
logg warn 'Homebrew is not available and passwordless sudo might still be enabled in /etc/sudoers. Modify the file manually if you wish to disable passwordless sudo.'
fi
fi
fi
### Remove temporary passwordless sudo privileges
if command -v gsed > /dev/null; then
sudo gsed -i '/ # TEMPORARY FOR INSTALL DOCTOR/d' /etc/sudoers
else
sudo sed -i '/ # TEMPORARY FOR INSTALL DOCTOR/d' /etc/sudoers
fi
logg success 'Provisioning complete!'
if command -v glow > /dev/null && [ -f " $ HOME /.local/share/chezmoi/docs/POST-INSTALL.md" ]; then
glow " $ HOME /.local/share/chezmoi/docs/POST-INSTALL.md"
fi