fix: reorganize color definitions and enhance output formatting in gitapply.sh

This commit is contained in:
2025-12-23 20:23:56 -05:00
parent e1b364d96e
commit e805d38961

View File

@@ -1,12 +1,15 @@
#!/bin/bash #!/bin/bash
# Colors # Colors - Blue to Teal/Cyan gradient palette
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m' BLUE='\033[0;34m'
LBLUE='\033[1;34m'
CYAN='\033[0;36m' CYAN='\033[0;36m'
MAGENTA='\033[0;35m' LCYAN='\033[1;36m'
GREEN='\033[0;32m'
TEAL='\033[38;5;37m'
DTEAL='\033[38;5;30m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
BOLD='\033[1m' BOLD='\033[1m'
NC='\033[0m' # No Color NC='\033[0m' # No Color
@@ -19,62 +22,62 @@ ROCKET="🚀"
clear clear
echo -e "${CYAN}╔══════════════════════════════════════════════════════════════════════╗${NC}" echo -e "${CYAN}╔════════════════════════════════════════════════════════════════════════════════════╗${NC}"
echo -e "${CYAN}║ ║${NC}" echo -e "${CYAN}║ ║${NC}"
echo -e "${CYAN}║ ${BOLD}${MAGENTA}██╗ ██╗██╗██████╗ ████████╗███╗ ██╗███████╗████████╗${NC}${CYAN} ║${NC}" echo -e "${CYAN}║ ${LBLUE} .-~~~-. ${LCYAN}██╗ ██╗██╗██████╗ ████████╗███╗ ██╗███████╗████████╗${CYAN} ║${NC}"
echo -e "${CYAN}║ ${BOLD}${MAGENTA}██║ ██║██║██╔══██╗╚══██╔══╝████╗ ██║██╔════╝╚══██╔══╝${NC}${CYAN} ║${NC}" echo -e "${CYAN}║ ${LBLUE} .- ~ ~-( )- ~~ -. ${LCYAN}██║ ██║██║██╔══██╗╚══██╔══╝████╗ ██║██╔════╝╚══██╔══╝${CYAN} ║${NC}"
echo -e "${CYAN}║ ${BOLD}${MAGENTA}██║ ██║██║██████╔╝ ██║ ██╔██╗ ██║█████╗ ██║${NC}${CYAN} ║${NC}" echo -e "${CYAN}║ ${LBLUE} / \\${LCYAN}██║ ██║██║██████╔╝ ██║ ██╔██╗ ██║█████╗ ██║${CYAN} ║${NC}"
echo -e "${CYAN}║ ${BOLD}${MAGENTA}╚██╗ ██╔╝██║██╔══██╗ ██║ ██║╚██╗██║██╔══╝ ██║${NC}${CYAN} ║${NC}" echo -e "${CYAN}║ ${BLUE} | ${DTEAL}.-----.${BLUE} |${TEAL}╚██╗ ██╔╝██║██╔══██╗ ██║ ██║╚██╗██║██╔══╝ ██║${CYAN} ║${NC}"
echo -e "${CYAN}║ ${BOLD}${MAGENTA} ╚████╔╝ ██║██║ ██║ ██║ ██║ ╚████║███████╗ ██║${NC}${CYAN} ║${NC}" echo -e "${CYAN}║ ${BLUE} \\ ${DTEAL}( )${BLUE} / ${TEAL} ╚████╔╝ ██║██║ ██║ ██║ ██║ ╚████║███████╗ ██║${CYAN} ║${NC}"
echo -e "${CYAN}║ ${BOLD}${MAGENTA} ╚═══╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═══╝╚══════╝ ╚═╝${NC}${CYAN} ║${NC}" echo -e "${CYAN}║ ${DTEAL} \`~ --._____.-- ~\` ${TEAL} ╚═══╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═══╝╚══════╝ ╚═╝${CYAN} ║${NC}"
echo -e "${CYAN}║ ║${NC}" echo -e "${CYAN}║ ║${NC}"
echo -e "${CYAN}║ ${BOLD}${YELLOW}Paymenter Load Balancer - Git Update & Apply${NC}${CYAN} ║${NC}" echo -e "${CYAN}║ ${BOLD}${YELLOW}Paymenter Load Balancer - Git Update & Apply${NC}${CYAN} ║${NC}"
echo -e "${CYAN}║ ║${NC}" echo -e "${CYAN}║ ║${NC}"
echo -e "${CYAN}╚══════════════════════════════════════════════════════════════════════╝${NC}" echo -e "${CYAN}╚════════════════════════════════════════════════════════════════════════════════════╝${NC}"
echo "" echo ""
echo -e "${BLUE}${ARROW}${NC} Repository: ${CYAN}https://gitea.virtnet.bond/Joseph.Rawlings/Virtnet.bond/${NC}" echo -e "${LBLUE}${ARROW}${NC} Repository: ${LCYAN}https://gitea.virtnet.bond/Joseph.Rawlings/Virtnet.bond/${NC}"
echo "" echo ""
sleep_time=$((RANDOM % 5 + 1)) sleep_time=$((RANDOM % 5 + 1))
cd /var/www/paymenter cd /var/www/paymenter
echo -e "${YELLOW}${GEAR}${NC} ${BOLD}Preparing update...${NC}" echo -e "${TEAL}${GEAR}${NC} ${BOLD}Preparing update...${NC}"
echo -ne " ${BLUE}⏳${NC} Waiting " echo -ne " ${LBLUE}⏳${NC} Waiting "
for ((i=sleep_time; i>0; i--)); do for ((i=sleep_time; i>0; i--)); do
echo -ne "${CYAN}${i}${NC} " echo -ne "${LCYAN}${i}${NC} "
sleep 1 sleep 1
done done
echo -e "${GREEN}${CHECK}${NC}" echo -e "${TEAL}${CHECK}${NC}"
echo "" echo ""
echo -e "${YELLOW}${GEAR}${NC} ${BOLD}Pulling latest changes from Git...${NC}" echo -e "${TEAL}${GEAR}${NC} ${BOLD}Pulling latest changes from Git...${NC}"
if ! git pull; then if ! git pull; then
echo -e " ${RED}${CROSS}${NC} Git pull failed!" echo -e " ${RED}${CROSS}${NC} Git pull failed!"
echo -e "${YELLOW}${ARROW}${NC} Restarting script..." echo -e "${LBLUE}${ARROW}${NC} Restarting script..."
sleep 2 sleep 2
exec "$0" "$@" exec "$0" "$@"
fi fi
echo -e " ${GREEN}${CHECK}${NC} Git pull completed" echo -e " ${TEAL}${CHECK}${NC} Git pull completed"
echo "" echo ""
echo -e "${YELLOW}${GEAR}${NC} ${BOLD}Clearing caches...${NC}" echo -e "${TEAL}${GEAR}${NC} ${BOLD}Clearing caches...${NC}"
php artisan view:clear > /dev/null 2>&1 php artisan view:clear > /dev/null 2>&1
echo -e " ${GREEN}${CHECK}${NC} View cache cleared" echo -e " ${TEAL}${CHECK}${NC} View cache cleared"
php artisan cache:clear > /dev/null 2>&1 php artisan cache:clear > /dev/null 2>&1
echo -e " ${GREEN}${CHECK}${NC} Application cache cleared" echo -e " ${TEAL}${CHECK}${NC} Application cache cleared"
echo "" echo ""
echo -e "${YELLOW}${GEAR}${NC} ${BOLD}Restarting PHP-FPM...${NC}" echo -e "${TEAL}${GEAR}${NC} ${BOLD}Restarting PHP-FPM...${NC}"
systemctl restart php8.3-fpm systemctl restart php8.3-fpm
echo -e " ${GREEN}${CHECK}${NC} PHP 8.3 FPM restarted" echo -e " ${TEAL}${CHECK}${NC} PHP 8.3 FPM restarted"
echo "" echo ""
echo -e "${CYAN}╔══════════════════════════════════════════════════════════════════════╗${NC}" echo -e "${CYAN}╔════════════════════════════════════════════════════════════════════════════════════╗${NC}"
echo -e "${CYAN}║ ║${NC}" echo -e "${CYAN}║ ║${NC}"
echo -e "${CYAN}║ ${GREEN}${ROCKET} ${BOLD}UPDATE COMPLETE!${NC}${CYAN} ║${NC}" echo -e "${CYAN}║ ${TEAL}${ROCKET} ${BOLD}UPDATE COMPLETE!${NC}${CYAN} ║${NC}"
echo -e "${CYAN}║ ║${NC}" echo -e "${CYAN}║ ║${NC}"
echo -e "${CYAN}║ ${NC}Paymenter has been successfully updated and services restarted.${CYAN} ║${NC}" echo -e "${CYAN}║ ${NC}Paymenter has been successfully updated and services restarted.${CYAN} ║${NC}"
echo -e "${CYAN}║ ║${NC}" echo -e "${CYAN}║ ║${NC}"
echo -e "${CYAN}╚══════════════════════════════════════════════════════════════════════╝${NC}" echo -e "${CYAN}╚════════════════════════════════════════════════════════════════════════════════════╝${NC}"
echo "" echo ""