diff --git a/install.d/10-brew.sh b/install.d/10-brew.sh index 1524b76..b1e437b 100755 --- a/install.d/10-brew.sh +++ b/install.d/10-brew.sh @@ -9,11 +9,11 @@ [[ "$DOTS_OS" != "macos" ]] && { log_skip "Not macOS"; return 0; } if ! command -v brew &> /dev/null; then - echo "Installing Homebrew..." + log_info "Installing Homebrew..." bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" eval "$(/opt/homebrew/bin/brew shellenv)" else - echo "Homebrew is already installed." + log_skip "Homebrew already installed" fi brew --version | log_quote log_pass "Homebrew installed" diff --git a/install.d/20-ssh.sh b/install.d/20-ssh.sh index 3d8d0c6..db1ace5 100755 --- a/install.d/20-ssh.sh +++ b/install.d/20-ssh.sh @@ -23,7 +23,7 @@ if [ ! -f "$ssh_key" ]; then -C "$(whoami)@$(hostname)-$(date -I)" fi -cat "$ssh_pub" +cat "$ssh_pub" | log_quote unset ssh_method ssh_target ssh_key ssh_pub log_pass "SSH key configured" diff --git a/install.d/22-zsh.sh b/install.d/22-zsh.sh index 40884d2..1821830 100755 --- a/install.d/22-zsh.sh +++ b/install.d/22-zsh.sh @@ -50,3 +50,5 @@ if [[ "$SHELL" != *zsh ]]; then sudo usermod -s "$(command -v zsh)" "$(whoami)" fi +log_pass "zsh configured" + diff --git a/install.d/23-stow.sh b/install.d/23-stow.sh index d3c9c15..d6c83bb 100755 --- a/install.d/23-stow.sh +++ b/install.d/23-stow.sh @@ -49,3 +49,5 @@ fi # Bust PATH cache to force rebuild with new profile rm -f "${XDG_CACHE_HOME:-$HOME/.cache}/dots/path" +log_pass "stow linked" + diff --git a/install.d/26-bat.sh b/install.d/26-bat.sh index a477b35..756b84e 100644 --- a/install.d/26-bat.sh +++ b/install.d/26-bat.sh @@ -29,5 +29,5 @@ fi bat --version | log_quote -bat cache --build 2>/dev/null +bat cache --build &>/dev/null log_pass "bat theme cache built" diff --git a/install.d/30-mise.sh b/install.d/30-mise.sh index 525fec7..2a3112f 100755 --- a/install.d/30-mise.sh +++ b/install.d/30-mise.sh @@ -36,7 +36,7 @@ if ! command -v mise &>/dev/null; then esac fi -echo "mise $(mise --version)" | log_quote +echo "mise $(MISE_QUIET=1 mise --version)" | log_quote # Skip runtimes in Codespaces (use pre-installed versions) if [[ "$DOTS_ENV" != "codespaces" ]]; then @@ -46,9 +46,9 @@ if [[ "$DOTS_ENV" != "codespaces" ]]; then ) log_info "Installing runtimes..." - mise install "${MISE_RUNTIMES[@]}" + MISE_QUIET=1 mise install "${MISE_RUNTIMES[@]}" 2>&1 | log_quote for tool in "${MISE_RUNTIMES[@]}"; do - mise use -g "$tool" + MISE_QUIET=1 mise use -g "$tool" 2>&1 | log_quote done fi @@ -76,11 +76,11 @@ fi log_info "Installing apps..." for tool in "${MISE_APPS[@]}"; do - mise use -g "$tool" + MISE_QUIET=1 mise use -g "$tool" 2>&1 | log_quote done # Rebuild bat theme cache with mise-installed bat (must match delta's syntect version) -bat cache --build 2>/dev/null +bat cache --build &>/dev/null if [[ "$DOTS_ENV" != "codespaces" ]]; then # Setup Poetry ZSH completions (XDG compliant) diff --git a/install.d/70-cca.sh b/install.d/70-cca.sh index f69dd9b..64f6843 100755 --- a/install.d/70-cca.sh +++ b/install.d/70-cca.sh @@ -11,6 +11,6 @@ if ! echo "$BREW_CASKS" | grep -q "^colour-contrast-analyser$"; then brew install --cask colour-contrast-analyser else - echo "Colour Contrast Analyser (CCA) is already installed." + log_skip "CCA already installed" fi log_pass "CCA installed" diff --git a/install.d/71-rectangle.sh b/install.d/71-rectangle.sh index 6280c5b..3596f8b 100755 --- a/install.d/71-rectangle.sh +++ b/install.d/71-rectangle.sh @@ -11,6 +11,6 @@ if ! echo "$BREW_CASKS" | grep -q "^rectangle$"; then brew install --cask rectangle else - echo "Rectangle is already installed." + log_skip "Rectangle already installed" fi log_pass "Rectangle installed" diff --git a/install.d/72-meetingbar.sh b/install.d/72-meetingbar.sh index 5091e79..21063d6 100755 --- a/install.d/72-meetingbar.sh +++ b/install.d/72-meetingbar.sh @@ -11,6 +11,6 @@ if ! echo "$BREW_CASKS" | grep -q "^meetingbar$"; then brew install --cask meetingbar else - echo "MeetingBar is already installed." + log_skip "MeetingBar already installed" fi log_pass "MeetingBar installed" diff --git a/install.d/73-betterdisplay.sh b/install.d/73-betterdisplay.sh index bb6f6fe..45cd6c4 100755 --- a/install.d/73-betterdisplay.sh +++ b/install.d/73-betterdisplay.sh @@ -11,6 +11,6 @@ if ! echo "$BREW_CASKS" | grep -q "^betterdisplay$"; then brew install --cask betterdisplay else - echo "BetterDisplay is already installed." + log_skip "BetterDisplay already installed" fi log_pass "BetterDisplay installed" diff --git a/install.d/74-dockutil.sh b/install.d/74-dockutil.sh index f6d32ea..84b894e 100755 --- a/install.d/74-dockutil.sh +++ b/install.d/74-dockutil.sh @@ -11,6 +11,6 @@ if ! echo "$BREW_FORMULAE" | grep -q "^dockutil$"; then brew install dockutil else - echo "dockutil is already installed." + log_skip "dockutil already installed" fi log_pass "dockutil installed" diff --git a/install.d/75-wispr-flow.sh b/install.d/75-wispr-flow.sh index 301506d..302a260 100644 --- a/install.d/75-wispr-flow.sh +++ b/install.d/75-wispr-flow.sh @@ -11,6 +11,6 @@ if ! echo "$BREW_CASKS" | grep -q "^wispr-flow$"; then brew install --cask wispr-flow else - echo "Wispr Flow is already installed." + log_skip "Wispr Flow already installed" fi log_pass "Wispr Flow installed" diff --git a/install.d/99-fastfetch.sh b/install.d/99-fastfetch.sh index 8519d93..627df95 100755 --- a/install.d/99-fastfetch.sh +++ b/install.d/99-fastfetch.sh @@ -8,5 +8,9 @@ # Skip in Codespaces (cosmetic only) [[ "$DOTS_ENV" == "codespaces" ]] && { log_skip "Codespaces"; return 0; } -fastfetch --pipe false +fastfetch --pipe false \ + --logo-color-1 "38;2;44;180;148" \ + --color-title "38;2;44;180;148" \ + --color-keys "38;2;114;144;184" \ + --color-separator "38;2;128;128;128" diff --git a/script/install b/script/install index 74b75a2..4e36a7d 100755 --- a/script/install +++ b/script/install @@ -6,18 +6,16 @@ set -eo pipefail # if [[ -t 1 && -n "$TERM" && "$TERM" != "dumb" ]]; then - BLUE=$'\033[38;2;12;72;204m' - CYAN=$'\033[38;2;0;228;252m' - CYAN_BOLD=$'\033[1;38;2;0;228;252m' - RED=$'\033[38;2;244;4;4m' - GREEN=$'\033[38;2;44;180;148m' + TEAL=$'\033[38;2;44;180;148m' + TEAL_BOLD=$'\033[1;38;2;44;180;148m' + RED=$'\033[38;2;248;140;20m' + GREEN=$'\033[38;2;114;144;184m' YELLOW=$'\033[38;2;252;252;56m' GREY=$'\033[38;2;128;128;128m' NC=$'\033[0m' else - BLUE="" - CYAN="" - CYAN_BOLD="" + TEAL="" + TEAL_BOLD="" RED="" GREEN="" YELLOW="" @@ -26,18 +24,18 @@ else fi # Log functions -log_info() { echo -e "${BLUE}[INFO]${NC} $*"; } +log_info() { echo -e "${TEAL}[INFO]${NC} $*"; } log_pass() { echo -e "${GREEN}[PASS]${NC} $*"; } log_skip() { echo -e "${GREY}[SKIP]${NC} $*"; } log_warn() { echo -e "${YELLOW}[WARN]${NC} $*"; } log_error() { echo -e "${RED}[FAIL]${NC} $*"; } -log_debug() { echo -e "${CYAN}$*${NC}"; } +log_debug() { echo -e "${TEAL}$*${NC}"; } log_quote() { sed "s/^/ ${GREY}│ /" | sed "s/$/${NC}/"; } # Export log functions export -f log_info log_pass log_skip log_warn log_error log_debug log_quote -printf "\n\t${CYAN} <<< ${CYAN_BOLD}dots${CYAN} >>> ${NC}\n" +printf "\n\t${TEAL} <<< ${TEAL_BOLD}dots${TEAL} >>> ${NC}\n" printf "\t${GREY}==============${NC}\n\n" # High-resolution time helpers @@ -55,8 +53,10 @@ fi # Ensure sudo credentials are cached if [[ -z "$SKIP_SUDO_CHECK" ]]; then - echo -e "${YELLOW}Checking sudo credentials...${NC}" - sudo -v + if ! sudo -n true 2>/dev/null; then + log_warn "Requesting sudo authentication..." + sudo -v + fi fi # Set up environment @@ -127,13 +127,15 @@ targets=($@) # Run install scripts run() { - echo -e "Running \"$(basename "$0")\" at \"$(date)\"" - echo -e "Running as \"$(whoami)\" on \"$(hostname)\"" - if [[ -n "$targets" ]]; then - echo -e "Running ${YELLOW}${#targets[@]}${NC} install target(s): ${YELLOW}${targets[@]}${NC}" - else - echo -e "Running all install targets" - fi + { + echo "Running \"$(basename "$0")\" at \"$(date)\"" + echo "Running as \"$(whoami)\" on \"$(hostname)\"" + if [[ -n "$targets" ]]; then + echo "Running ${#targets[@]} install target(s): ${targets[*]}" + else + echo "Running all install targets" + fi + } | log_quote scripts=("$install_dir"/*.sh) for script in "${scripts[@]}"; do @@ -147,7 +149,7 @@ run() { local script_name=$(basename "$script") - printf "\n\n${CYAN}<<< ${CYAN_BOLD}$script_name:${NC}\n" + printf "\n\n${TEAL}<<< ${TEAL_BOLD}$script_name:${NC}\n" local start_ns=$(now_ns) source "$script" local end_ns=$(now_ns) @@ -161,11 +163,11 @@ run() { else time_color="$RED" fi - printf "${CYAN}>>> ${CYAN_BOLD}${script_name}, ${NC}" + printf "${TEAL}>>> ${TEAL_BOLD}${script_name}, ${NC}" printf "completed in ${time_color}${execution_ms_formatted}ms${NC}\n" done } -echo -e "\ninstall: Logging to \"$log_abs_target\"" +echo -e "\n${GREY}Logging to \"$log_abs_target\"${NC}" total_start_ns=$(now_ns) run 2>&1 | tee "$log_abs_target" total_end_ns=$(now_ns) @@ -173,5 +175,5 @@ total_end_ns=$(now_ns) total_ms=$(( (total_end_ns - total_start_ns) / 1000000 )) total_s=$(( total_ms / 1000 )) total_ms_rem=$(( total_ms % 1000 )) -echo -e "\nThank you!" +printf "\n${TEAL}Thank you!${NC}\n" printf "Total time: ${GREEN}%d.%03ds${NC}\n\n" "$total_s" "$total_ms_rem"