colorchanges and addet file oldness check

This commit is contained in:
pika 2025-05-19 13:36:04 +02:00
parent 00003f4cf3
commit 873bebd7e3

View file

@ -100,22 +100,22 @@ echo_pkg() {
echo "${BOLD}${BRIGHT_RED}${PACKAGE:-PKG}-dependencies:${BRIGHT_YELLOW} $2 ${NC}" echo "${BOLD}${BRIGHT_RED}${PACKAGE:-PKG}-dependencies:${BRIGHT_YELLOW} $2 ${NC}"
;; ;;
*) *)
echo "${BOLD}${BRIGHT_RED}${PACKAGE:-PKG}-$1:${NC}${YELLOW} $2 ${NC}" echo "${BOLD}${BRIGHT_RED}${PACKAGE:-PKG}-$1:${NC}${BRIGHT_YELLOW} $2 ${NC}"
;; ;;
esac esac
fi fi
} }
echo_info() { echo_info() {
echo "${BOLD}${BLUE}INFO:${NC}${BRIGHT_BLUE} $1 ${NC}" echo "${BOLD}${BLUE}INFO:${NC}${BRIGHT_BLUE} $1${NC}"
} }
echo_warning() { echo_warning() {
echo "${BOLD}${YELLOW}WARNING:${NC}${BRIGHT_YELLOW} $1 ${NC}" echo "${BOLD}${YELLOW}WARNING:${NC}${BRIGHT_YELLOW} $1${NC}"
} }
echo_note() { echo_note() {
echo "${BOLD}${GREEN}NOTE:${NC}${BRIGHT_GREEN} $1 ${NC}" echo "${BOLD}${GREEN}NOTE:${NC}${BRIGHT_GREEN} $1${NC}"
} }
# ─< Check if the given command exists silently >───────────────────────────────────────── # ─< Check if the given command exists silently >─────────────────────────────────────────
@ -183,12 +183,26 @@ check_env() {
fi fi
pikaCheckFile="$HOME/.cache/pika_script_detection" pikaCheckFile="$HOME/.cache/pika_script_detection"
checkFileAge() {
local file="$1"
[[ ! -e "$file" ]] && return 2 # File doesn't exist
if [ -e "$pikaCheckFile" ]; then if [[ $(find "$file" -mtime +7 -print) ]]; then
return 69 # File is older than 1 week
else
return 0 # File is within 1 week
fi
}
if [ -f "$pikaCheckFile" ]; then
if checkFileAge $pikaCheckFile; then
PIKA_INIT=true PIKA_INIT=true
else else
unset PIKA_INIT unset PIKA_INIT
fi fi
else
unset PIKA_INIT
fi
} }
_setup() { _setup() {