fix colors
This commit is contained in:
@@ -1,17 +1,28 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
# Colors + logging same pattern
|
||||
RED='\033[0;31m'; GREEN='\033[0;32m'; YELLOW='\033[0;33m'
|
||||
CYAN='\033[0;36m'; GRAY='\033[0;37m'; BOLD='\033[1m'; RESET='\033[0m'
|
||||
[ ! -t 1 ] && RED='' GREEN='' YELLOW='' CYAN='' GRAY='' BOLD='' RESET=''
|
||||
##########################
|
||||
# Color helpers (printf-safe, no tput)
|
||||
##########################
|
||||
RED="\033[0;31m"
|
||||
GREEN="\033[0;32m"
|
||||
YELLOW="\033[0;33m"
|
||||
CYAN="\033[0;36m"
|
||||
GRAY="\033[0;37m"
|
||||
BOLD="\033[1m"
|
||||
RESET="\033[0m"
|
||||
|
||||
color_red() { printf '%b' "$RED"; }
|
||||
color_green() { printf '%b' "$GREEN"; }
|
||||
color_yellow() { printf '%b' "$YELLOW"; }
|
||||
color_cyan() { printf '%b' "$CYAN"; }
|
||||
color_gray() { printf '%b' "$GRAY"; }
|
||||
color_reset() { printf '%b' "$RESET"; }
|
||||
# Disable colors if output is not a terminal
|
||||
if [ ! -t 1 ]; then
|
||||
RED="" GREEN="" YELLOW="" CYAN="" GRAY="" BOLD="" RESET=""
|
||||
fi
|
||||
|
||||
say_red() { printf "%b%s%b\n" "$RED" "$*" "$RESET"; }
|
||||
say_green() { printf "%b%s%b\n" "$GREEN" "$*" "$RESET"; }
|
||||
say_yellow() { printf "%b%s%b\n" "$YELLOW" "$*" "$RESET"; }
|
||||
say_cyan() { printf "%b%s%b\n" "$CYAN" "$*" "$RESET"; }
|
||||
say_gray() { printf "%b%s%b\n" "$GRAY" "$*" "$RESET"; }
|
||||
say_bold() { printf "%b%s%b\n" "$BOLD" "$*" "$RESET"; }
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
OS="${DETECTED_OS:-debian}"
|
||||
@@ -23,7 +34,7 @@ DE="${SELECTED_DE:-none}"
|
||||
install_packages() { sudo apt update; sudo apt install -y --no-install-recommends "$@"; }
|
||||
is_package_installed() { dpkg -s "$1" &>/dev/null; }
|
||||
|
||||
color_yellow; echo "Starting minimal setup..."; color_reset
|
||||
say_yellow "Starting minimal setup..."
|
||||
|
||||
# Create user directories
|
||||
mkdir -p "$HOME"/{.bin,.fonts,.icons,.themes,DATA} "$HOME/.local/share/"{icons,themes,applications} "$HOME/.config/"{autostart,gtk-{3.0,4.0},variety,fish,neofetch}
|
||||
@@ -43,4 +54,4 @@ sudo systemctl enable chrony
|
||||
sudo systemctl enable fstrim.timer
|
||||
|
||||
# End of script
|
||||
color_green; echo "Minimal setup completed."; color_reset
|
||||
say_green "Minimal setup completed."
|
||||
Reference in New Issue
Block a user