From 2ca1221090e594f3684baa0b378a7eb00bbc6fcd Mon Sep 17 00:00:00 2001 From: Brian Zalewski <59970525+ProfessorManhattan@users.noreply.github.com> Date: Sun, 5 Nov 2023 04:43:42 +0000 Subject: [PATCH] Added second application of Chezmoi --- docs/scripts/utility/provision.sh.md | 18 +++++++++++++----- home/dot_local/bin/executable_provision.tmpl | 17 ++++++++++++----- local/provision.sh | 15 +++++++++++---- scripts/provision.sh | 15 +++++++++++---- scripts/src/provision.sh.tmpl | 15 +++++++++++---- 5 files changed, 58 insertions(+), 22 deletions(-) diff --git a/docs/scripts/utility/provision.sh.md b/docs/scripts/utility/provision.sh.md index f2144368..14e56eba 100644 --- a/docs/scripts/utility/provision.sh.md +++ b/docs/scripts/utility/provision.sh.md @@ -437,19 +437,27 @@ if [ "$DEBUG_MODE" = 'true' ]; then DEBUG_MODIFIER="-vvvvv" fi -# @description Save the log of the provision process to `${XDG_DATA_HOME:-$HOME/.local/share}/install.doctor.$(date +%s).log` and add the Chezmoi +# @description Save the log of the provision process to `$HOME/.local/var/log/install.doctor/install.doctor.$(date +%s).log` and add the Chezmoi # `--force` flag if the `HEADLESS_INSTALL` variable is set to true. +mkdir -p "$HOME/.local/var/log/install.doctor" +LOG_FILE="$HOME/.local/var/log/install.doctor/install.doctor.$(date +%s).log" if [ "$HEADLESS_INSTALL" = 'true' ]; then + logg info 'Running chezmoi apply forcefully' if command -v unbuffer > /dev/null; then - unbuffer -p chezmoi apply $DEBUG_MODIFIER -k --force 2>&1 | tee "${XDG_DATA_HOME:-$HOME/.local/share}/install.doctor.$(date +%s).log" + unbuffer -p chezmoi apply $DEBUG_MODIFIER -k --force 2>&1 | tee "$LOG_FILE" + logg info 'Running chezmoi second time' && unbuffer -p chezmoi apply $DEBUG_MODIFIER -k --force 2>&1 | tee "$LOG_FILE" else - chezmoi apply $DEBUG_MODIFIER -k --force 2>&1 | tee "${XDG_DATA_HOME:-$HOME/.local/share}/install.doctor.$(date +%s).log" + chezmoi apply $DEBUG_MODIFIER -k --force 2>&1 | tee "$LOG_FILE" + logg info 'Running chezmoi second time' && chezmoi apply $DEBUG_MODIFIER -k --force 2>&1 | tee "$LOG_FILE" fi else + logg info 'Running chezmoi apply' if command -v unbuffer > /dev/null; then - unbuffer -p chezmoi apply $DEBUG_MODIFIER -k 2>&1 | tee "${XDG_DATA_HOME:-$HOME/.local/share}/install.doctor.$(date +%s).log" + unbuffer -p chezmoi apply $DEBUG_MODIFIER -k 2>&1 | tee "$LOG_FILE" + logg info 'Running chezmoi second time' && unbuffer -p chezmoi apply $DEBUG_MODIFIER -k 2>&1 | tee "$LOG_FILE" else - chezmoi apply $DEBUG_MODIFIER -k 2>&1 | tee "${XDG_DATA_HOME:-$HOME/.local/share}/install.doctor.$(date +%s).log" + chezmoi apply $DEBUG_MODIFIER -k 2>&1 | tee "$LOG_FILE" + logg info 'Running chezmoi second time' && chezmoi apply $DEBUG_MODIFIER -k 2>&1 | tee "$LOG_FILE" fi fi diff --git a/home/dot_local/bin/executable_provision.tmpl b/home/dot_local/bin/executable_provision.tmpl index 722498e5..36a83939 100644 --- a/home/dot_local/bin/executable_provision.tmpl +++ b/home/dot_local/bin/executable_provision.tmpl @@ -347,17 +347,24 @@ fi # @description Save the log of the provision process to `$HOME/.local/var/log/install.doctor/install.doctor.$(date +%s).log` and add the Chezmoi # `--force` flag if the `HEADLESS_INSTALL` variable is set to true. mkdir -p "$HOME/.local/var/log/install.doctor" +LOG_FILE="$HOME/.local/var/log/install.doctor/install.doctor.$(date +%s).log" if [ "$HEADLESS_INSTALL" = 'true' ]; then + logg info 'Running chezmoi apply forcefully' if command -v unbuffer > /dev/null; then - unbuffer -p chezmoi apply $DEBUG_MODIFIER -k --force 2>&1 | tee "$HOME/.local/var/log/install.doctor/install.doctor.$(date +%s).log" + unbuffer -p chezmoi apply $DEBUG_MODIFIER -k --force 2>&1 | tee "$LOG_FILE" + logg info 'Running chezmoi second time' && unbuffer -p chezmoi apply $DEBUG_MODIFIER -k --force 2>&1 | tee "$LOG_FILE" else - chezmoi apply $DEBUG_MODIFIER -k --force 2>&1 | tee "$HOME/.local/var/log/install.doctor/install.doctor.$(date +%s).log" + chezmoi apply $DEBUG_MODIFIER -k --force 2>&1 | tee "$LOG_FILE" + logg info 'Running chezmoi second time' && chezmoi apply $DEBUG_MODIFIER -k --force 2>&1 | tee "$LOG_FILE" fi else + logg info 'Running chezmoi apply' if command -v unbuffer > /dev/null; then - unbuffer -p chezmoi apply $DEBUG_MODIFIER -k 2>&1 | tee "$HOME/.local/var/log/install.doctor/install.doctor.$(date +%s).log" + unbuffer -p chezmoi apply $DEBUG_MODIFIER -k 2>&1 | tee "$LOG_FILE" + logg info 'Running chezmoi second time' && unbuffer -p chezmoi apply $DEBUG_MODIFIER -k 2>&1 | tee "$LOG_FILE" else - chezmoi apply $DEBUG_MODIFIER -k 2>&1 | tee "$HOME/.local/var/log/install.doctor/install.doctor.$(date +%s).log" + chezmoi apply $DEBUG_MODIFIER -k 2>&1 | tee "$LOG_FILE" + logg info 'Running chezmoi second time' && chezmoi apply $DEBUG_MODIFIER -k 2>&1 | tee "$LOG_FILE" fi fi @@ -383,4 +390,4 @@ fi logg success 'Provisioning complete!' if command -v glow > /dev/null && [ -f "${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi/docs/terminal/post-install.md" ]; then glow "${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi/docs/terminal/post-install.md" -fi \ No newline at end of file +fi diff --git a/local/provision.sh b/local/provision.sh index cbe1c11e..650044b4 100644 --- a/local/provision.sh +++ b/local/provision.sh @@ -467,17 +467,24 @@ fi # @description Save the log of the provision process to `$HOME/.local/var/log/install.doctor/install.doctor.$(date +%s).log` and add the Chezmoi # `--force` flag if the `HEADLESS_INSTALL` variable is set to true. mkdir -p "$HOME/.local/var/log/install.doctor" +LOG_FILE="$HOME/.local/var/log/install.doctor/install.doctor.$(date +%s).log" if [ "$HEADLESS_INSTALL" = 'true' ]; then + logg info 'Running chezmoi apply forcefully' if command -v unbuffer > /dev/null; then - unbuffer -p chezmoi apply $DEBUG_MODIFIER -k --force 2>&1 | tee "$HOME/.local/var/log/install.doctor/install.doctor.$(date +%s).log" + unbuffer -p chezmoi apply $DEBUG_MODIFIER -k --force 2>&1 | tee "$LOG_FILE" + logg info 'Running chezmoi second time' && unbuffer -p chezmoi apply $DEBUG_MODIFIER -k --force 2>&1 | tee "$LOG_FILE" else - chezmoi apply $DEBUG_MODIFIER -k --force 2>&1 | tee "$HOME/.local/var/log/install.doctor/install.doctor.$(date +%s).log" + chezmoi apply $DEBUG_MODIFIER -k --force 2>&1 | tee "$LOG_FILE" + logg info 'Running chezmoi second time' && chezmoi apply $DEBUG_MODIFIER -k --force 2>&1 | tee "$LOG_FILE" fi else + logg info 'Running chezmoi apply' if command -v unbuffer > /dev/null; then - unbuffer -p chezmoi apply $DEBUG_MODIFIER -k 2>&1 | tee "$HOME/.local/var/log/install.doctor/install.doctor.$(date +%s).log" + unbuffer -p chezmoi apply $DEBUG_MODIFIER -k 2>&1 | tee "$LOG_FILE" + logg info 'Running chezmoi second time' && unbuffer -p chezmoi apply $DEBUG_MODIFIER -k 2>&1 | tee "$LOG_FILE" else - chezmoi apply $DEBUG_MODIFIER -k 2>&1 | tee "$HOME/.local/var/log/install.doctor/install.doctor.$(date +%s).log" + chezmoi apply $DEBUG_MODIFIER -k 2>&1 | tee "$LOG_FILE" + logg info 'Running chezmoi second time' && chezmoi apply $DEBUG_MODIFIER -k 2>&1 | tee "$LOG_FILE" fi fi diff --git a/scripts/provision.sh b/scripts/provision.sh index 863d5326..b002ca37 100644 --- a/scripts/provision.sh +++ b/scripts/provision.sh @@ -393,17 +393,24 @@ fi # @description Save the log of the provision process to `$HOME/.local/var/log/install.doctor/install.doctor.$(date +%s).log` and add the Chezmoi # `--force` flag if the `HEADLESS_INSTALL` variable is set to true. mkdir -p "$HOME/.local/var/log/install.doctor" +LOG_FILE="$HOME/.local/var/log/install.doctor/install.doctor.$(date +%s).log" if [ "$HEADLESS_INSTALL" = 'true' ]; then + logg info 'Running chezmoi apply forcefully' if command -v unbuffer > /dev/null; then - unbuffer -p chezmoi apply $DEBUG_MODIFIER -k --force 2>&1 | tee "$HOME/.local/var/log/install.doctor/install.doctor.$(date +%s).log" + unbuffer -p chezmoi apply $DEBUG_MODIFIER -k --force 2>&1 | tee "$LOG_FILE" + logg info 'Running chezmoi second time' && unbuffer -p chezmoi apply $DEBUG_MODIFIER -k --force 2>&1 | tee "$LOG_FILE" else - chezmoi apply $DEBUG_MODIFIER -k --force 2>&1 | tee "$HOME/.local/var/log/install.doctor/install.doctor.$(date +%s).log" + chezmoi apply $DEBUG_MODIFIER -k --force 2>&1 | tee "$LOG_FILE" + logg info 'Running chezmoi second time' && chezmoi apply $DEBUG_MODIFIER -k --force 2>&1 | tee "$LOG_FILE" fi else + logg info 'Running chezmoi apply' if command -v unbuffer > /dev/null; then - unbuffer -p chezmoi apply $DEBUG_MODIFIER -k 2>&1 | tee "$HOME/.local/var/log/install.doctor/install.doctor.$(date +%s).log" + unbuffer -p chezmoi apply $DEBUG_MODIFIER -k 2>&1 | tee "$LOG_FILE" + logg info 'Running chezmoi second time' && unbuffer -p chezmoi apply $DEBUG_MODIFIER -k 2>&1 | tee "$LOG_FILE" else - chezmoi apply $DEBUG_MODIFIER -k 2>&1 | tee "$HOME/.local/var/log/install.doctor/install.doctor.$(date +%s).log" + chezmoi apply $DEBUG_MODIFIER -k 2>&1 | tee "$LOG_FILE" + logg info 'Running chezmoi second time' && chezmoi apply $DEBUG_MODIFIER -k 2>&1 | tee "$LOG_FILE" fi fi diff --git a/scripts/src/provision.sh.tmpl b/scripts/src/provision.sh.tmpl index 33eb9ca4..573e7c35 100644 --- a/scripts/src/provision.sh.tmpl +++ b/scripts/src/provision.sh.tmpl @@ -271,17 +271,24 @@ fi # @description Save the log of the provision process to `$HOME/.local/var/log/install.doctor/install.doctor.$(date +%s).log` and add the Chezmoi # `--force` flag if the `HEADLESS_INSTALL` variable is set to true. mkdir -p "$HOME/.local/var/log/install.doctor" +LOG_FILE="$HOME/.local/var/log/install.doctor/install.doctor.$(date +%s).log" if [ "$HEADLESS_INSTALL" = 'true' ]; then + logg info 'Running chezmoi apply forcefully' if command -v unbuffer > /dev/null; then - unbuffer -p chezmoi apply $DEBUG_MODIFIER -k --force 2>&1 | tee "$HOME/.local/var/log/install.doctor/install.doctor.$(date +%s).log" + unbuffer -p chezmoi apply $DEBUG_MODIFIER -k --force 2>&1 | tee "$LOG_FILE" + logg info 'Running chezmoi second time' && unbuffer -p chezmoi apply $DEBUG_MODIFIER -k --force 2>&1 | tee "$LOG_FILE" else - chezmoi apply $DEBUG_MODIFIER -k --force 2>&1 | tee "$HOME/.local/var/log/install.doctor/install.doctor.$(date +%s).log" + chezmoi apply $DEBUG_MODIFIER -k --force 2>&1 | tee "$LOG_FILE" + logg info 'Running chezmoi second time' && chezmoi apply $DEBUG_MODIFIER -k --force 2>&1 | tee "$LOG_FILE" fi else + logg info 'Running chezmoi apply' if command -v unbuffer > /dev/null; then - unbuffer -p chezmoi apply $DEBUG_MODIFIER -k 2>&1 | tee "$HOME/.local/var/log/install.doctor/install.doctor.$(date +%s).log" + unbuffer -p chezmoi apply $DEBUG_MODIFIER -k 2>&1 | tee "$LOG_FILE" + logg info 'Running chezmoi second time' && unbuffer -p chezmoi apply $DEBUG_MODIFIER -k 2>&1 | tee "$LOG_FILE" else - chezmoi apply $DEBUG_MODIFIER -k 2>&1 | tee "$HOME/.local/var/log/install.doctor/install.doctor.$(date +%s).log" + chezmoi apply $DEBUG_MODIFIER -k 2>&1 | tee "$LOG_FILE" + logg info 'Running chezmoi second time' && chezmoi apply $DEBUG_MODIFIER -k 2>&1 | tee "$LOG_FILE" fi fi