mirror of
https://github.com/balena-io/open-balena.git
synced 2024-12-19 05:37:52 +00:00
2a7d0687a2
Update open-balena-s3 to 2.8.3 This makes new installations of openBalena use the S3 container as a storage backend for the Registry service by default. Existing installs should not be affected. Change-type: major Signed-off-by: Rich Bayliss <rich@balena.io>
62 lines
1.0 KiB
Bash
62 lines
1.0 KiB
Bash
#!/bin/sh
|
|
|
|
BLACK=`tput setaf 0`
|
|
RED=`tput setaf 1`
|
|
GREEN=`tput setaf 2`
|
|
YELLOW=`tput setaf 3`
|
|
BLUE=`tput setaf 4`
|
|
MAGENTA=`tput setaf 5`
|
|
CYAN=`tput setaf 6`
|
|
WHITE=`tput setaf 7`
|
|
|
|
BOLD=`tput bold`
|
|
RESET=`tput sgr0`
|
|
|
|
log_raw () {
|
|
local COLOR="${WHITE}"
|
|
local LEVEL="${1}"
|
|
local MESSAGE="${2}"
|
|
case "${LEVEL}" in
|
|
info)
|
|
COLOR="${BLUE}"
|
|
;;
|
|
warn)
|
|
COLOR="${YELLOW}"
|
|
;;
|
|
fatal)
|
|
COLOR="${RED}"
|
|
;;
|
|
*)
|
|
LEVEL="debug"
|
|
;;
|
|
esac
|
|
LEVEL="${LEVEL} "
|
|
echo "[$(date +%T)] ${COLOR}$(echo "${LEVEL:0:5}" | tr '[:lower:]' '[:upper:]')${RESET} ${MESSAGE}";
|
|
}
|
|
|
|
log () {
|
|
log_raw "debug" "${1}"
|
|
}
|
|
|
|
info () {
|
|
log_raw "info" "${1}";
|
|
}
|
|
|
|
warn () {
|
|
log_raw "warn" "${1}";
|
|
}
|
|
|
|
die () {
|
|
log_raw "fatal" "${1}";
|
|
exit 1;
|
|
}
|
|
|
|
die_unless_forced () {
|
|
if [ ! -z "$1" ]; then
|
|
log_raw "warn" "$2";
|
|
return;
|
|
fi
|
|
|
|
log_raw "fatal" "$2";
|
|
die "Use -f to forcibly upgrade.";
|
|
} |