pkgs/scripts/lib.sh
Ivan Cherniy b0663e96ad Add signed deb, rpm and arch repositories tooling
Release signing in a container, KeePassXC key handling, landing page,
end-to-end test with apt, dnf and pacman.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-15 15:20:03 +03:00

22 lines
972 B
Shell
Executable file

# shellcheck shell=bash
# Общая часть для скриптов в scripts/: PATH, цвета, лог-функции.
# SCRIPT_DIR/SCRIPT_NAME/ROOT_DIR сюда не входят — они специфичны для
# каждого вызывающего скрипта и определяются перед `source lib.sh`.
export PATH="${PATH}:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin"
setup_colors() {
if [[ -t 2 ]] && [[ "${TERM-}" != "dumb" ]] && command -v tput > /dev/null 2>&1; then
RESET=$(tput sgr0)
RED=$(tput setaf 1) GREEN=$(tput setaf 2)
YELLOW=$(tput setaf 3) BLUE=$(tput setaf 4)
else
RESET="" RED="" GREEN="" YELLOW="" BLUE=""
fi
}
log_info() { printf '%s[INFO]%s - %s\n' "$BLUE" "$RESET" "$*" >&2; }
log_warn() { printf '%s[WARN]%s - %s\n' "$YELLOW" "$RESET" "$*" >&2; }
log_error() { printf '%s[ERROR]%s - %s\n' "$RED" "$RESET" "$*" >&2; exit 1; }
setup_colors