install.fairie/dotfiles/.local/share/chezmoi/home/dot_local/bin/executable_install-dotfiles
Brian Zalewski 7bd467cb73 Update dotfiles/.local/share/chezmoi/home/Library/Application Support/tabby/plugins/symlink_package-lock.json, dotfiles/.local/share/chezmoi/home/Library/Developer/Xcode/UserData/FontAndColorThemes/Betelgeuse Dark.dvtcolortheme, dotfiles/.local/share/chezmoi/home/Library/Developer/Xcode/UserData/FontAndColorThemes/Betelgeuse Light.dvtcolortheme, dotfiles/.local/share/chezmoi/home/Library/Preferences/com.apple.Terminal.plist, dotfiles/.local/share/chezmoi/home/run_update, dotfiles/.local/share/chezmoi/home/AppData/Local/clink/oh-my-posh.lua, dotfiles/.local/share/chezmoi/home/.chezmoitemplates/chassis-info, dotfiles/.local/share/chezmoi/home/.chezmoitemplates/cpu-info, dotfiles/.local/share/chezmoi/home/.chezmoitemplates/profile.sh, dotfiles/.local/share/chezmoi/home/dot_cache/zsh/.gitkeep, dotfiles/.local/share/chezmoi/home/dot_local/assets/Betelgeuse.macOS.terminal, dotfiles/.local/share/chezmoi/home/dot_local/bin/executable_bwc, dotfiles/.local/share/chezmoi/home/dot_local/bin/executable_chrome-profile-export, dotfiles/.local/share/chezmoi/home/dot_local/bin/executable_chrome-profile-import, dotfiles/.local/share/chezmoi/home/dot_local/bin/executable_firefox-profile-export, dotfiles/.local/share/chezmoi/home/dot_local/bin/executable_firefox-profile-import, dotfiles/.local/share/chezmoi/home/dot_local/bin/executable_fonttest, dotfiles/.local/share/chezmoi/home/dot_local/bin/executable_install-dotfiles, dotfiles/.local/share/chezmoi/home/dot_local/bin/executable_install-terminal-theme, dotfiles/.local/share/chezmoi/home/dot_local/bin/executable_ksetwallpaper, dotfiles/.local/share/chezmoi/home/dot_local/bin/executable_logg, dotfiles/.local/share/chezmoi/home/dot_local/bin/executable_opener, dotfiles/.local/share/chezmoi/home/dot_local/bin/executable_provision, dotfiles/.local/share/chezmoi/home/dot_local/bin/executable_quickstart, dotfiles/.local/share/chezmoi/home/dot_local/bin/executable_ramqube, dotfiles/.local/share/chezmoi/home/dot_local/bin/executable_run, dotfiles/.local/share/chezmoi/home/dot_local/bin/executable_slack, dotfiles/.local/share/chezmoi/home/dot_local/bin/executable_squash-symlink, dotfiles/.local/share/chezmoi/home/dot_local/konsole/Default.profile, dotfiles/.local/share/chezmoi/home/dot_local/scripts/macos.bash, dotfiles/.local/share/chezmoi/home/dot_local/scripts/motd.bash, dotfiles/.local/share/chezmoi/home/dot_local/scripts/p10k.zsh, dotfiles/.local/share/chezmoi/home/dot_local/share/fonts/FontAwesome.ttf, dotfiles/.local/share/chezmoi/home/dot_local/share/fonts/Weather-Icons.ttf, dotfiles/.local/share/chezmoi/home/dot_local/share/git-core/templates/hooks/post-commit, dotfiles/.local/share/chezmoi/home/dot_local/state/bash/.gitkeep, dotfiles/.local/share/chezmoi/home/dot_local/state/zsh/.gitkeep, dotfiles/.local/share/chezmoi/home/dot_ssh/authorized_keys.github.tmpl, dotfiles/.local/share/chezmoi/home/dot_ssh/id_rsa.pub, dotfiles/.local/share/chezmoi/home/dot_ssh/private_config.tmpl, dotfiles/.local/share/chezmoi/home/dot_ssh/private_id_rsa.tmpl, dotfiles/.local/share/chezmoi/home/dot_vim/autoload/lightline/colorscheme/Betelgeuse.vim, dotfiles/.local/share/chezmoi/home/dot_vim/colors/Betelgeuse.vim, dotfiles/.local/share/chezmoi/home/dot_vim/vimrc, dotfiles/.local/share/chezmoi/home/private_dot_config/Kvantum/kvantum.config, dotfiles/.local/share/chezmoi/home/private_dot_config/alacritty/alacritty.yml, dotfiles/.local/share/chezmoi/home/private_dot_config/asdf/asdfrc.tmpl, dotfiles/.local/share/chezmoi/home/private_dot_config/asdf/default-cargo-pkgs.tmpl, dotfiles/.local/share/chezmoi/home/private_dot_config/asdf/default-golang-pkgs.tmpl, dotfiles/.local/share/chezmoi/home/private_dot_config/asdf/default-npm-packages, dotfiles/.local/share/chezmoi/home/private_dot_config/asdf/default-python-pkgs.tmpl, dotfiles/.local/share/chezmoi/home/private_dot_config/asdf/default-ruby-pkgs.tmpl, dotfiles/.local/share/chezmoi/home/private_dot_config/bashtop/bashtop.cfg, dotfiles/.local/share/chezmoi/home/private_dot_config/bat/config, dotfiles/.local/share/chezmoi/home/private_dot_config/brew/Brewfile.tmpl, dotfiles/.local/share/chezmoi/home/private_dot_config/brew/whalebrew, dotfiles/.local/share/chezmoi/home/private_dot_config/crontab/config, dotfiles/.local/share/chezmoi/home/private_dot_config/direnv/direnv.toml, dotfiles/.local/share/chezmoi/home/private_dot_config/fd/ignore, dotfiles/.local/share/chezmoi/home/private_dot_config/firejail/bitwarden.local, dotfiles/.local/share/chezmoi/home/private_dot_config/firejail/chromium.local, dotfiles/.local/share/chezmoi/home/private_dot_config/firejail/code.local, dotfiles/.local/share/chezmoi/home/private_dot_config/firejail/gcloud.local, dotfiles/.local/share/chezmoi/home/private_dot_config/firejail/google-chrome-stable.local, dotfiles/.local/share/chezmoi/home/private_dot_config/firejail/slack.local, dotfiles/.local/share/chezmoi/home/private_dot_config/firejail/thunderbird.local, dotfiles/.local/share/chezmoi/home/private_dot_config/fontconfig/fonts.conf, dotfiles/.local/share/chezmoi/home/private_dot_config/ghorg/conf.yaml.tmpl, dotfiles/.local/share/chezmoi/home/private_dot_config/git/attributes, dotfiles/.local/share/chezmoi/home/private_dot_config/git/commit-template, dotfiles/.local/share/chezmoi/home/private_dot_config/git/config.tmpl, dotfiles/.local/share/chezmoi/home/private_dot_config/git/ignore, dotfiles/.local/share/chezmoi/home/private_dot_config/gtk-1.0/.gitkeep, dotfiles/.local/share/chezmoi/home/private_dot_config/gtk-2.0/gtkrc, dotfiles/.local/share/chezmoi/home/private_dot_config/gtk-3.0/settings.ini, dotfiles/.local/share/chezmoi/home/private_dot_config/himalaya/config.toml.tmpl, dotfiles/.local/share/chezmoi/home/private_dot_config/k9s/plugin.yml, dotfiles/.local/share/chezmoi/home/private_dot_config/kitty/Betelgeuse-dark.conf, dotfiles/.local/share/chezmoi/home/private_dot_config/kitty/Betelgeuse-light.conf, dotfiles/.local/share/chezmoi/home/private_dot_config/kitty/kitty.conf, dotfiles/.local/share/chezmoi/home/private_dot_config/ngrok/ngrok.yml.tmpl, dotfiles/.local/share/chezmoi/home/private_dot_config/npm/npmrc.tmpl, dotfiles/.local/share/chezmoi/home/private_dot_config/oh-my-posh/Betelgeuse-minimal.omp.json, dotfiles/.local/share/chezmoi/home/private_dot_config/oh-my-posh/Betelgeuse.omp.json, dotfiles/.local/share/chezmoi/home/private_dot_config/pg/.gitkeep, dotfiles/.local/share/chezmoi/home/private_dot_config/pgcli/config, dotfiles/.local/share/chezmoi/home/private_dot_config/powershell/user_profile.ps1, dotfiles/.local/share/chezmoi/home/private_dot_config/private_Code/User/extensions/theme-betelgeuse-vscode/themes/themer-dark-color-theme.json, dotfiles/.local/share/chezmoi/home/private_dot_config/private_Code/User/extensions/theme-betelgeuse-vscode/themes/themer-light-color-theme.json, dotfiles/.local/share/chezmoi/home/private_dot_config/private_Code/User/extensions/theme-betelgeuse-vscode/README.md, dotfiles/.local/share/chezmoi/home/private_dot_config/private_Code/User/extensions/theme-betelgeuse-vscode/icon.svg, dotfiles/.local/share/chezmoi/home/private_dot_config/private_Code/User/extensions/theme-betelgeuse-vscode/package.json, dotfiles/.local/share/chezmoi/home/private_dot_config/private_Code/User/extensions.json, dotfiles/.local/share/chezmoi/home/private_dot_config/private_Code/User/keybindings.json, dotfiles/.local/share/chezmoi/home/private_dot_config/private_Code/User/settings.json, dotfiles/.local/share/chezmoi/home/private_dot_config/putty/.gitkeep, dotfiles/.local/share/chezmoi/home/private_dot_config/readline/inputrc, dotfiles/.local/share/chezmoi/home/private_dot_config/ripgrep/config, dotfiles/.local/share/chezmoi/home/private_dot_config/rofi/config.rasi.tmpl, dotfiles/.local/share/chezmoi/home/private_dot_config/shell/aliases.tmpl, dotfiles/.local/share/chezmoi/home/private_dot_config/shell/exports, dotfiles/.local/share/chezmoi/home/private_dot_config/shell/functions, dotfiles/.local/share/chezmoi/home/private_dot_config/shell/motd, dotfiles/.local/share/chezmoi/home/private_dot_config/shell/profile, dotfiles/.local/share/chezmoi/home/private_dot_config/slack-term/config.tmpl, dotfiles/.local/share/chezmoi/home/private_dot_config/tabby/config.yaml.tmpl, dotfiles/.local/share/chezmoi/home/private_dot_config/tabby/package-lock.json, dotfiles/.local/share/chezmoi/home/private_dot_config/terminator/config, dotfiles/.local/share/chezmoi/home/private_dot_config/tmux/.gitkeep, dotfiles/.local/share/chezmoi/home/private_dot_config/wget/wgetrc, dotfiles/.local/share/chezmoi/home/private_dot_config/xfce4/terminal/terminalrc, dotfiles/.local/share/chezmoi/home/private_dot_config/xfce4/xfconf/xfce-perchannel-xml/xsettings.xml, dotfiles/.local/share/chezmoi/home/private_dot_config/xsettingsd/xsettingsd.conf, dotfiles/.local/share/chezmoi/home/private_dot_config/chromium-flags.conf, dotfiles/.local/share/chezmoi/home/private_dot_config/gtkrc, dotfiles/.local/share/chezmoi/home/private_dot_config/kcminputrc, dotfiles/.local/share/chezmoi/home/private_dot_config/kdeglobals, dotfiles/.local/share/chezmoi/home/private_dot_config/konsolerc, dotfiles/.local/share/chezmoi/home/private_dot_config/ksplashrc, dotfiles/.local/share/chezmoi/home/private_dot_config/ktimezonedrc, dotfiles/.local/share/chezmoi/home/private_dot_config/kwinrc, dotfiles/.local/share/chezmoi/home/private_dot_config/mimeapps.list, dotfiles/.local/share/chezmoi/home/private_dot_config/plasma-localerc, dotfiles/.local/share/chezmoi/home/private_dot_config/plasmarc, dotfiles/.local/share/chezmoi/home/dot_Xresources, dotfiles/.local/share/chezmoi/home/dot_bash_logout, dotfiles/.local/share/chezmoi/home/dot_bash_profile, dotfiles/.local/share/chezmoi/home/dot_bashrc, dotfiles/.local/share/chezmoi/home/dot_editorconfig, dotfiles/.local/share/chezmoi/home/dot_zshrc, dotfiles/.local/share/chezmoi/home/run_once_before_install-software.sh.tmpl, dotfiles/.local/share/chezmoi/home/run_onchange_after_bash-completions, dotfiles/.local/share/chezmoi/home/run_onchange_after_crontab.tmpl, dotfiles/.local/share/chezmoi/.chezmoiroot
2022-11-22 19:59:10 +00:00

133 lines
7.1 KiB
Bash

#!/usr/bin/env bash
# Alias logg function to true if it is not available
if ! command -v logg > /dev/null; then
alias logg='true'
fi
# Clear ZSH cached stuff
if [ -f "$HOME/.zshrc.zwc" ]; then
rm -f "$HOME/.zshrc.zwc"
fi
if [ -d "$HOME/.local/antigen" ]; then
rm -rf "$HOME/.local/antigen"
fi
if [ -d "$HOME/.zsh_sessions" ]; then
rm -rf "$HOME/.zsh_sessions"
fi
if [ -f '/etc/qubes-release' ]; then
# Qubes dom0
logg info 'Ensuring provision VM is present'
qvm-create --label red --template debian-11 provision &> /dev/null || EXIT_CODE=$?
logg info 'Downloading dotfile assets with provision VM'
qvm-run --pass-io provision 'if [ -d ~/Downloads/professor-dotfiles ]; then cd ~/Downloads/professor-dotfiles && git config pull.rebase false && rm -rf dotfiles/.local/asdf && rm -rf dotfiles/.local/common/shared && git pull origin master && git clone https://github.com/asdf-vm/asdf.git dotfiles/.local/asdf --branch v0.10.2 && mkdir -p dotfiles/.local/common/shared && git clone https://gitlab.com/megabyte-labs/common/shared.git dotfiles/.local/common/shared; else git clone https://gitlab.com/megabyte-labs/dotfiles.git ~/Downloads/professor-dotfiles; cd ~/Downloads/professor-dotfiles/dotfiles/.local && git clone https://github.com/asdf-vm/asdf.git asdf --branch v0.10.2 && mkdir common && git clone https://gitlab.com/megabyte-labs/common/shared.git common/shared; fi; cd ~/Downloads; tar -zcvf /tmp/professor-dotfiles.tar.gz professor-dotfiles'
logg info 'Transferring dotfiles to dom0 from provision VM'
qvm-run --pass-io provision "cat /tmp/professor-dotfiles.tar.gz" > "/tmp/dotfiles.tar.gz"
logg info 'Unpacking dotfile assets to /usr/local/src/professor-dotfiles'
tar -xzf "/tmp/dotfiles.tar.gz" -C "$HOME"
rm -f "/tmp/dotfiles.tar.gz"
sudo rm -rf /usr/local/src/professor-dotfiles
sudo mv "$HOME/professor-dotfiles" /usr/local/src/professor-dotfiles
else
if [ ! -w /usr/local/src/professor-dotfiles ]; then
logg info 'Using sudo because /usr/local/src/professor-dotfiles is not writable'
SUDO_PREFIX="sudo"
fi
if [ -d /usr/local/src/professor-dotfiles/.git ]; then
logg info 'Updating dotfiles already present in /usr/local/src/professor-dotfiles'
cd /usr/local/src/professor-dotfiles
${SUDO_PREFIX} git config pull.rebase false
${SUDO_PREFIX} rm -rf dotfiles/.local/asdf
${SUDO_PREFIX} rm -rf dotfiles/.local/common/shared
${SUDO_PREFIX} git pull origin master
${SUDO_PREFIX} git clone https://github.com/asdf-vm/asdf.git dotfiles/.local/asdf --branch v0.10.2
${SUDO_PREFIX} git clone https://gitlab.com/megabyte-labs/common/shared.git dotfiles/.local/common/shared
${SUDO_PREFIX} chown -Rf "$USER":"$(id -g -n)" /usr/local/src/professor-dotfiles
cd ~/
else
logg info 'Cloning new dotfiles to /usr/local/src/professor-dotfiles'
${SUDO_PREFIX} rm -rf /usr/local/src/professor-dotfiles
${SUDO_PREFIX} git clone https://gitlab.com/megabyte-labs/dotfiles.git /usr/local/src/professor-dotfiles
${SUDO_PREFIX} git clone https://github.com/asdf-vm/asdf.git /usr/local/src/professor-dotfiles/dotfiles/.local/asdf --branch v0.10.2
${SUDO_PREFIX} mkdir -p /usr/local/src/professor-dotfiles/dotfiles/.local/common/shared
${SUDO_PREFIX} git clone https://gitlab.com/megabyte-labs/common/shared.git /usr/local/src/professor-dotfiles/dotfiles/.local/common/shared
${SUDO_PREFIX} chown -Rf "$USER":"$(id -g -n)" /usr/local/src/professor-dotfiles
fi
if [ -n "$CREATE_PACKAGE" ]; then
logg info 'Creating /tmp/professor-dotfiles.tar.gz'
cd /usr/local/src
${SUDO_PREFIX} tar -zcvf /tmp/professor-dotfiles.tar.gz professor-dotfiles
cd ~/
fi
fi
# Copy dotfile folders
logg info 'Copying dotfiles folders to user $HOME directory'
while read DOTFILE_FOLDER; do
BASENAME_FOLDER="$(basename "$DOTFILE_FOLDER")"
if [ ! -d "$HOME/$BASENAME_FOLDER" ]; then
mkdir -p "$HOME/$BASENAME_FOLDER"
fi
cp -rf "$DOTFILE_FOLDER/"* "$HOME/$BASENAME_FOLDER"
done < <(find /usr/local/src/professor-dotfiles/dotfiles -maxdepth 1 -mindepth 1 -type d)
# Copy dotfile files
logg info 'Copying dotfiles files to user $HOME directory'
while read DOTFILE_FILE; do
BASENAME_FILE="$(basename "$DOTFILE_FILE")"
cp "$DOTFILE_FILE" "$HOME/$BASENAME_FILE"
chmod 600 "$HOME/$BASENAME_FILE"
done < <(find /usr/local/src/professor-dotfiles/dotfiles -maxdepth 1 -mindepth 1 -type f)
# Ensure .local/bin contents are executable
logg info 'Ensuring programs in ~/.local/bin are executable'
while read LOCAL_BIN; do
chmod +x "${LOCAL_BIN}"
done < <(find "$HOME/.local/bin" -maxdepth 1 -mindepth 1 -type f)
if [ -d /Applications ] && [ -d /System ]; then
logg info 'Adding Hack font to ~/Library/Fonts'
mkdir -p "$HOME/Library/Fonts"
cp "$HOME/.local/share/fonts/Hack Bold Nerd Font Complete.ttf" "$HOME/Library/Fonts/Hack Bold Nerd Font Complete.ttf"
logg info 'Configuring the Terminal.app'
theme=$(<$HOME/.local/theme/Betelgeuse.macOS.terminal)
plutil -replace Window\ Settings.Betelgeuse -xml "$theme" ~/Library/Preferences/com.apple.Terminal.plist
defaults write com.apple.Terminal "Default Window Settings" -string "Betelgeuse"
defaults write com.apple.Terminal "Startup Window Settings" -string "Betelgeuse"
/usr/libexec/PlistBuddy -c "Add :Window\ Settings:Betelgeuse:columnCount integer 124" ~/Library/Preferences/com.apple.Terminal.plist
/usr/libexec/PlistBuddy -c "Add :Window\ Settings:Betelgeuse:rowCount integer 35" ~/Library/Preferences/com.apple.Terminal.plist
/usr/libexec/PlistBuddy -c "Add :Window\ Settings:Betel-Bash:columnCount integer 124" ~/Library/Preferences/com.apple.Terminal.plist
/usr/libexec/PlistBuddy -c "Add :Window\ Settings:Betel-Bash:rowCount integer 35" ~/Library/Preferences/com.apple.Terminal.plist
# macOS desktop background
if command -v m > /dev/null; then
logg info 'Updating desktop wallpaper'
m wallpaper "/Users/$(whoami)/.local/theme/background.jpg"
fi
fi
# Update local Betelgeuse theme files (if not on macOS system)
if [ ! -d /Applications ] && [ ! -d /Library ]; then
logg info 'Updating Betelgeuse theme files'
if [ -f '/etc/qubes-release' ]; then
# Qubes dom0
qvm-create --label red --template debian-11 provision &> /dev/null || EXIT_CODE=$?
qvm-run --pass-io provision 'rm -f ~/Downloads/betelgeuse-master.tar.gz && curl -sSL https://gitlab.com/megabyte-labs/misc/betelgeuse/-/archive/master/betelgeuse-master.tar.gz > /tmp/betelgeuse-master.tar.gz'
qvm-run --pass-io provision "cat /tmp/betelgeuse-master.tar.gz" > "/tmp/betelgeuse-master.tar.gz"
cd /tmp
tar -xvf betelgeuse-master.tar.gz > /dev/null
rm betelgeuse-master.tar.gz
cp -rf betelgeuse-master/share/ "$HOME/.local/share"
rm -rf betelgeuse-master
else
curl -sSL https://gitlab.com/megabyte-labs/misc/betelgeuse/-/archive/master/betelgeuse-master.tar.gz > betelgeuse-master.tar.gz
tar -xzf betelgeuse-master.tar.gz > /dev/null
rm betelgeuse-master.tar.gz
cp -rf betelgeuse-master/share/ "$HOME/.local/share"
rm -rf betelgeuse-master
fi
fi
# grep -q QT_QPA_PLATFORMTHEME=qt5ct /etc/environment || echo QT_QPA_PLATFORMTHEME=qt5ct | sudo tee -a /etc/environment
# sudo cp -rv "$HOME/.local/share/qt5ct" /usr/share