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

This commit is contained in:
Brian Zalewski 2022-11-24 22:19:05 +00:00
parent 99474e17a8
commit 9b16806cc4
3 changed files with 27 additions and 16 deletions

View file

@ -0,0 +1,3 @@
if command -v logg > /dev/null; then
alias logg='echo'
fi

View file

@ -1,5 +1,13 @@
#!/usr/bin/env bash #!/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 # Clear ZSH cached stuff
if [ -f "$HOME/.zshrc.zwc" ]; then if [ -f "$HOME/.zshrc.zwc" ]; then
rm -f "$HOME/.zshrc.zwc" rm -f "$HOME/.zshrc.zwc"
@ -13,24 +21,24 @@ fi
if [ -f '/etc/qubes-release' ]; then if [ -f '/etc/qubes-release' ]; then
# Qubes dom0 # 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=$? 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' 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" 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" tar -xzf "/tmp/dotfiles.tar.gz" -C "$HOME"
rm -f "/tmp/dotfiles.tar.gz" rm -f "/tmp/dotfiles.tar.gz"
sudo rm -rf /usr/local/src/professor-dotfiles sudo rm -rf /usr/local/src/professor-dotfiles
sudo mv "$HOME/professor-dotfiles" /usr/local/src/professor-dotfiles sudo mv "$HOME/professor-dotfiles" /usr/local/src/professor-dotfiles
else else
if [ ! -w /usr/local/src/professor-dotfiles ]; then 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" SUDO_PREFIX="sudo"
fi fi
if [ -d /usr/local/src/professor-dotfiles/.git ]; then 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 cd /usr/local/src/professor-dotfiles
${SUDO_PREFIX} git config pull.rebase false ${SUDO_PREFIX} git config pull.rebase false
${SUDO_PREFIX} rm -rf dotfiles/.local/asdf ${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 ${SUDO_PREFIX} chown -Rf "$USER":"$(id -g -n)" /usr/local/src/professor-dotfiles
cd ~/ cd ~/
else 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} 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://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} 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 ${SUDO_PREFIX} chown -Rf "$USER":"$(id -g -n)" /usr/local/src/professor-dotfiles
fi fi
if [ -n "$CREATE_PACKAGE" ]; then if [ -n "$CREATE_PACKAGE" ]; then
logg info 'Creating /tmp/professor-dotfiles.tar.gz' logg 'Creating /tmp/professor-dotfiles.tar.gz'
cd /usr/local/src cd /usr/local/src
${SUDO_PREFIX} tar -zcvf /tmp/professor-dotfiles.tar.gz professor-dotfiles ${SUDO_PREFIX} tar -zcvf /tmp/professor-dotfiles.tar.gz professor-dotfiles
cd ~/ cd ~/
@ -58,7 +66,7 @@ else
fi fi
# Copy dotfile folders # 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 while read DOTFILE_FOLDER; do
BASENAME_FOLDER="$(basename "$DOTFILE_FOLDER")" BASENAME_FOLDER="$(basename "$DOTFILE_FOLDER")"
if [ ! -d "$HOME/$BASENAME_FOLDER" ]; then 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) done < <(find /usr/local/src/professor-dotfiles/dotfiles -maxdepth 1 -mindepth 1 -type d)
# Copy dotfile files # 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 while read DOTFILE_FILE; do
BASENAME_FILE="$(basename "$DOTFILE_FILE")" BASENAME_FILE="$(basename "$DOTFILE_FILE")"
cp "$DOTFILE_FILE" "$HOME/$BASENAME_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) done < <(find /usr/local/src/professor-dotfiles/dotfiles -maxdepth 1 -mindepth 1 -type f)
# Ensure .local/bin contents are executable # 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 while read LOCAL_BIN; do
chmod +x "${LOCAL_BIN}" chmod +x "${LOCAL_BIN}"
done < <(find "$HOME/.local/bin" -maxdepth 1 -mindepth 1 -type f) done < <(find "$HOME/.local/bin" -maxdepth 1 -mindepth 1 -type f)
if [ -d /Applications ] && [ -d /System ]; then 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" 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" 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) theme=$(<$HOME/.local/theme/Betelgeuse.macOS.terminal)
plutil -replace Window\ Settings.Betelgeuse -xml "$theme" ~/Library/Preferences/com.apple.Terminal.plist 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 "Default Window Settings" -string "Betelgeuse"
@ -97,14 +105,14 @@ if [ -d /Applications ] && [ -d /System ]; then
# macOS desktop background # macOS desktop background
if command -v m > /dev/null; then if command -v m > /dev/null; then
logg info 'Updating desktop wallpaper' logg 'Updating desktop wallpaper'
m wallpaper "/Users/$(whoami)/.local/theme/background.jpg" m wallpaper "/Users/$(whoami)/.local/theme/background.jpg"
fi fi
fi fi
# Update local Betelgeuse theme files (if not on macOS system) # Update local Betelgeuse theme files (if not on macOS system)
if [ ! -d /Applications ] && [ ! -d /Library ]; then if [ ! -d /Applications ] && [ ! -d /Library ]; then
logg info 'Updating Betelgeuse theme files' logg 'Updating Betelgeuse theme files'
if [ -f '/etc/qubes-release' ]; then if [ -f '/etc/qubes-release' ]; then
# Qubes dom0 # Qubes dom0
qvm-create --label red --template debian-11 provision &> /dev/null || EXIT_CODE=$? qvm-create --label red --template debian-11 provision &> /dev/null || EXIT_CODE=$?

View file

@ -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 # 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 # Required for styled logging
{{- includeTemplate "universal/logg" }} {{- includeTemplate "universal/logg-compat" }}
export COLOR_01="#282C34" # Black export COLOR_01="#282C34" # Black
export COLOR_02="#ED254E" # Red export COLOR_02="#ED254E" # Red