From 9b16806cc42fa06159ff29395e56a698d2edfa00 Mon Sep 17 00:00:00 2001 From: Brian Zalewski Date: Thu, 24 Nov 2022 22:19:05 +0000 Subject: [PATCH] Update dotfiles/.local/share/chezmoi/home/dot_local/bin/executable_install-dotfiles.tmpl, dotfiles/.local/share/chezmoi/home/dot_local/bin/executable_install-terminal-theme, dotfiles/.local/share/chezmoi/home/.chezmoitemplates/universal/logg-compat --- .../.chezmoitemplates/universal/logg-compat | 3 ++ ...files => executable_install-dotfiles.tmpl} | 38 +++++++++++-------- .../bin/executable_install-terminal-theme | 2 +- 3 files changed, 27 insertions(+), 16 deletions(-) create mode 100644 dotfiles/.local/share/chezmoi/home/.chezmoitemplates/universal/logg-compat rename dotfiles/.local/share/chezmoi/home/dot_local/bin/{executable_install-dotfiles => executable_install-dotfiles.tmpl} (85%) diff --git a/dotfiles/.local/share/chezmoi/home/.chezmoitemplates/universal/logg-compat b/dotfiles/.local/share/chezmoi/home/.chezmoitemplates/universal/logg-compat new file mode 100644 index 00000000..93501128 --- /dev/null +++ b/dotfiles/.local/share/chezmoi/home/.chezmoitemplates/universal/logg-compat @@ -0,0 +1,3 @@ +if command -v logg > /dev/null; then + alias logg='echo' +fi diff --git a/dotfiles/.local/share/chezmoi/home/dot_local/bin/executable_install-dotfiles b/dotfiles/.local/share/chezmoi/home/dot_local/bin/executable_install-dotfiles.tmpl similarity index 85% rename from dotfiles/.local/share/chezmoi/home/dot_local/bin/executable_install-dotfiles rename to dotfiles/.local/share/chezmoi/home/dot_local/bin/executable_install-dotfiles.tmpl index 79cc9d1b..b2713d27 100644 --- a/dotfiles/.local/share/chezmoi/home/dot_local/bin/executable_install-dotfiles +++ b/dotfiles/.local/share/chezmoi/home/dot_local/bin/executable_install-dotfiles.tmpl @@ -1,5 +1,13 @@ #!/usr/bin/env bash +# Exclude dom0 since it has no internet access to download Gum / Glow +if [ ! -f '/etc/qubes-release' ]; then + # Required for styled logging + {{- includeTemplate "universal/logg" }} +else + alias logg='echo' +fi + # Clear ZSH cached stuff if [ -f "$HOME/.zshrc.zwc" ]; then rm -f "$HOME/.zshrc.zwc" @@ -13,24 +21,24 @@ fi if [ -f '/etc/qubes-release' ]; then # Qubes dom0 - logg info 'Ensuring provision VM is present' + logg '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' + logg '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' + logg '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' + logg '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' + logg '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' + logg '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 @@ -41,7 +49,7 @@ else ${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' + logg '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 @@ -50,7 +58,7 @@ else ${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' + logg 'Creating /tmp/professor-dotfiles.tar.gz' cd /usr/local/src ${SUDO_PREFIX} tar -zcvf /tmp/professor-dotfiles.tar.gz professor-dotfiles cd ~/ @@ -58,7 +66,7 @@ else fi # Copy dotfile folders -logg info 'Copying dotfiles folders to user $HOME directory' +logg 'Copying dotfiles folders to user $HOME directory' while read DOTFILE_FOLDER; do BASENAME_FOLDER="$(basename "$DOTFILE_FOLDER")" if [ ! -d "$HOME/$BASENAME_FOLDER" ]; then @@ -68,7 +76,7 @@ while read DOTFILE_FOLDER; do 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' +logg 'Copying dotfiles files to user $HOME directory' while read DOTFILE_FILE; do BASENAME_FILE="$(basename "$DOTFILE_FILE")" cp "$DOTFILE_FILE" "$HOME/$BASENAME_FILE" @@ -76,16 +84,16 @@ while read DOTFILE_FILE; do 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' +logg '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' + logg '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' + logg '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" @@ -97,14 +105,14 @@ if [ -d /Applications ] && [ -d /System ]; then # macOS desktop background if command -v m > /dev/null; then - logg info 'Updating desktop wallpaper' + logg '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' + logg 'Updating Betelgeuse theme files' if [ -f '/etc/qubes-release' ]; then # Qubes dom0 qvm-create --label red --template debian-11 provision &> /dev/null || EXIT_CODE=$? diff --git a/dotfiles/.local/share/chezmoi/home/dot_local/bin/executable_install-terminal-theme b/dotfiles/.local/share/chezmoi/home/dot_local/bin/executable_install-terminal-theme index c2b99587..3e5e6dd3 100644 --- a/dotfiles/.local/share/chezmoi/home/dot_local/bin/executable_install-terminal-theme +++ b/dotfiles/.local/share/chezmoi/home/dot_local/bin/executable_install-terminal-theme @@ -11,7 +11,7 @@ # Themer.dev: https://themer.dev/?calculateIntermediaryShades.dark=true&colors.dark.shade0=%23161925&colors.dark.shade7=%23C3C7D1&colors.dark.accent0=%23ED254E&colors.dark.accent3=%2371F79F&colors.dark.accent2=%23F9DC5C&colors.dark.accent4=%2300C1E4&colors.dark.accent5=%237CB7FF&colors.dark.accent7=%23C74D89&colors.dark.accent6=%23C3C7D1&colors.dark.accent1=%23DCDFE4&colors.light.accent0=%23FF4972&colors.light.accent3=%2395FFC3&colors.light.accent2=%23FFFF80&colors.light.accent5=%23A0DBFF&colors.light.accent7=%23EB71AD&colors.light.accent6=%234C5058&colors.light.shade7=%234C5058&colors.light.shade0=%23FFFFFF&colors.light.accent4=%2324E5FF&colors.light.accent1=%23DCDFE4&activeColorSet=dark # Required for styled logging -{{- includeTemplate "universal/logg" }} +{{- includeTemplate "universal/logg-compat" }} export COLOR_01="#282C34" # Black export COLOR_02="#ED254E" # Red