From 30d5fe31f8902dbf24ca5048654c96b0e98cdaa7 Mon Sep 17 00:00:00 2001 From: Brian Zalewski Date: Tue, 10 Jan 2023 04:51:59 +0000 Subject: [PATCH] Update 2 files - /local/provision.sh - /home/dot_local/bin/executable_provision.tmpl --- home/dot_local/bin/executable_provision.tmpl | 9 ++++++-- local/provision.sh | 23 +++++++++----------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/home/dot_local/bin/executable_provision.tmpl b/home/dot_local/bin/executable_provision.tmpl index d9ee507a..f12ba9c9 100644 --- a/home/dot_local/bin/executable_provision.tmpl +++ b/home/dot_local/bin/executable_provision.tmpl @@ -10,6 +10,11 @@ {{ includeTemplate "universal/logg" }} +### 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 + ### Qubes dom0 if command -v qubesctl > /dev/null; then # The VM name that will manage the Ansible provisioning (for Qubes dom0) @@ -255,7 +260,7 @@ export DEBIAN_FRONTEND=noninteractive # shellcheck disable=SC2016 logg info 'Running `chezmoi apply`' if [ -n "$FORCE_CHEZMOI" ]; then - chezmoi apply --force + chezmoi apply -k --force 2>&1 | tee "${XDG_DATA_DIR:-$HOME/.local/share}/megabyte-labs/betelgeuse.$(date +%s).log" else - chezmoi apply + chezmoi apply -k 2>&1 | tee "${XDG_DATA_DIR:-$HOME/.local/share}/megabyte-labs/betelgeuse.$(date +%s).log" fi diff --git a/local/provision.sh b/local/provision.sh index 588faa63..1d164df1 100644 --- a/local/provision.sh +++ b/local/provision.sh @@ -8,14 +8,10 @@ # ~/.local/share/chezmoi. Finally, it begins the TUI experience by displaying styled documentation, prompts, and finishes # by calling the appropriate Chezmoi commands. -### Print output to console and log file +### 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 -# Source: https://unix.stackexchange.com/a/323189 -exec 3<&1 -coproc logtee { tee "${XDG_DATA_DIR:-$HOME/.local/share}/megabyte-labs/betelgeuse.log" >&3; } -exec >&${logtee[1]} 2>&1 # @description Installs glow (a markdown renderer) from GitHub releases # @example installGlow @@ -384,12 +380,13 @@ fi ### Copy new files from src git repository to dotfiles with rsync rsyncChezmoiFiles() { - rsync -rtvu --delete /usr/local/src/hiawatha/docs/ "${XDG_DATA_DIR:-$HOME/.local/share}/chezmoi/docs/" - rsync -rtvu --delete /usr/local/src/hiawatha/home/ "${XDG_DATA_DIR:-$HOME/.local/share}/chezmoi/home/" - rsync -rtvu --delete /usr/local/src/hiawatha/system/ "${XDG_DATA_DIR:-$HOME/.local/share}/chezmoi/system/" - rsync -rtvu /usr/local/src/hiawatha/.chezmoiignore "${XDG_DATA_DIR:-$HOME/.local/share}/chezmoi/.chezmoiignore" - rsync -rtvu /usr/local/src/hiawatha/.chezmoiroot "${XDG_DATA_DIR:-$HOME/.local/share}/chezmoi/.chezmoiroot" - rsync -rtvu /usr/local/src/hiawatha/software.yml "${XDG_DATA_DIR:-$HOME/.local/share}/chezmoi/software.yml" + rsync -rtvu --delete /usr/local/src/hiawatha/docs/ "${XDG_DATA_DIR:-$HOME/.local/share}/chezmoi/docs/" & + rsync -rtvu --delete /usr/local/src/hiawatha/home/ "${XDG_DATA_DIR:-$HOME/.local/share}/chezmoi/home/" & + rsync -rtvu --delete /usr/local/src/hiawatha/system/ "${XDG_DATA_DIR:-$HOME/.local/share}/chezmoi/system/" & + rsync -rtvu /usr/local/src/hiawatha/.chezmoiignore "${XDG_DATA_DIR:-$HOME/.local/share}/chezmoi/.chezmoiignore" & + rsync -rtvu /usr/local/src/hiawatha/.chezmoiroot "${XDG_DATA_DIR:-$HOME/.local/share}/chezmoi/.chezmoiroot" & + rsync -rtvu /usr/local/src/hiawatha/software.yml "${XDG_DATA_DIR:-$HOME/.local/share}/chezmoi/software.yml" & + wait logg success 'Successfully updated the ~/.local/share/chezmoi folder with changes from the upstream repository' } @@ -430,7 +427,7 @@ export DEBIAN_FRONTEND=noninteractive # shellcheck disable=SC2016 logg info 'Running `chezmoi apply`' if [ -n "$FORCE_CHEZMOI" ]; then - chezmoi apply -k --force + chezmoi apply -k --force 2>&1 | tee "${XDG_DATA_DIR:-$HOME/.local/share}/megabyte-labs/betelgeuse.$(date +%s).log" else - chezmoi apply -k + chezmoi apply -k 2>&1 | tee "${XDG_DATA_DIR:-$HOME/.local/share}/megabyte-labs/betelgeuse.$(date +%s).log" fi