From cbdff4460a469cdfdb7aea17fa4853857da1e2e8 Mon Sep 17 00:00:00 2001 From: Brian Zalewski <59970525+ProfessorManhattan@users.noreply.github.com> Date: Wed, 8 Nov 2023 04:48:22 +0000 Subject: [PATCH] Latest --- local/provision.sh | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/local/provision.sh b/local/provision.sh index 8e5df114..e1707fd6 100644 --- a/local/provision.sh +++ b/local/provision.sh @@ -470,20 +470,32 @@ 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 "$LOG_FILE" - logg info 'Running chezmoi second time' && unbuffer -p chezmoi apply $DEBUG_MODIFIER -k --force 2>&1 | tee "$LOG_FILE" + if command -v caffeinate > /dev/null; then + caffeinate unbuffer -p chezmoi apply $DEBUG_MODIFIER -k --force 2>&1 | tee "$LOG_FILE" + else + unbuffer -p chezmoi apply $DEBUG_MODIFIER -k --force 2>&1 | tee "$LOG_FILE" + fi else - 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" + if command -v caffeinate > /dev/null; then + caffeinate chezmoi apply $DEBUG_MODIFIER -k --force 2>&1 | tee "$LOG_FILE" + else + chezmoi apply $DEBUG_MODIFIER -k --force 2>&1 | tee "$LOG_FILE" + fi fi else logg info 'Running chezmoi apply' if command -v unbuffer > /dev/null; then - 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" + if command -v caffeinate > /dev/null; then + caffeinate unbuffer -p chezmoi apply $DEBUG_MODIFIER -k 2>&1 | tee "$LOG_FILE" + else + unbuffer -p chezmoi apply $DEBUG_MODIFIER -k 2>&1 | tee "$LOG_FILE" + fi else - 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" + if command -v caffeinate > /dev/null; then + caffeinate chezmoi apply $DEBUG_MODIFIER -k 2>&1 | tee "$LOG_FILE" + else + chezmoi apply $DEBUG_MODIFIER -k 2>&1 | tee "$LOG_FILE" + fi fi fi