catalyst-auto: standardize indentation

This file uses tabs in most of it, so migrate the few funcs using
spaces over to tabs.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
This commit is contained in:
Mike Frysinger 2020-05-31 12:32:02 -04:00
parent 5bfe6e81dc
commit cfc55d1712

View file

@ -25,13 +25,13 @@ lastrun=0
lock_file= lock_file=
usage() { usage() {
local msg=$1 local msg=$1
if [ -n "${msg}" ]; then if [ -n "${msg}" ]; then
printf "%b\n\n" "${msg}" printf "%b\n\n" "${msg}"
fi fi
cat <<EOH cat <<EOH
Usage: Usage:
catalyst-auto [-c|--config <config>] [-v|--verbose] [-h|--help] catalyst-auto [-c|--config <config>] [-v|--verbose] [-h|--help]
@ -49,66 +49,66 @@ EOH
} }
send_email() { send_email() {
local subject="${EMAIL_SUBJECT_PREPEND} $1" local subject="${EMAIL_SUBJECT_PREPEND} $1"
local message=$2 local message=$2
local logfile=$3 local logfile=$3
local body local body
if [ -n "${logfile}" ]; then if [ -n "${logfile}" ]; then
body=$(printf '%b\n\n\n' "${message}"; tail -n 200 "${logfile}"; printf '\n\n\nFull build log at %s\n' "${logfile}") body=$(printf '%b\n\n\n' "${message}"; tail -n 200 "${logfile}"; printf '\n\n\nFull build log at %s\n' "${logfile}")
else else
body=${message} body=${message}
fi fi
printf 'From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n%b' \ printf 'From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n%b' \
"${EMAIL_FROM}" "${EMAIL_TO}" "${subject}" "${body}" | \ "${EMAIL_FROM}" "${EMAIL_TO}" "${subject}" "${body}" | \
/usr/sbin/sendmail -f "${EMAIL_FROM}" ${EMAIL_TO//,/ } /usr/sbin/sendmail -f "${EMAIL_FROM}" ${EMAIL_TO//,/ }
} }
# Usage: run_cmd <logfile> <command to run> # Usage: run_cmd <logfile> <command to run>
run_cmd() { run_cmd() {
local logfile="$1" local logfile="$1"
shift shift
echo "*** Running command: $*" &>> "${logfile}" echo "*** Running command: $*" &>> "${logfile}"
if [ $verbose = 2 ]; then if [[ ${verbose} == 2 ]]; then
echo "*** Running command: $*" echo "*** Running command: $*"
"$@" 2>&1 | tee -a "${logfile}" "$@" 2>&1 | tee -a "${logfile}"
elif [ $verbose = 1 ]; then elif [[ ${verbose} == 1 ]]; then
echo "*** Running command: $*" echo "*** Running command: $*"
"$@" &>> "${logfile}" "$@" &>> "${logfile}"
else else
"$@" &>> "${logfile}" "$@" &>> "${logfile}"
fi fi
# If we used tee above, make sure we pass back up the command's error. # If we used tee above, make sure we pass back up the command's error.
return ${PIPESTATUS[0]} return ${PIPESTATUS[0]}
} }
update_symlinks() { update_symlinks() {
# This is a skeleton function that you can override from the config file. # This is a skeleton function that you can override from the config file.
# It will be called by pre_build and after completing the build of a set # It will be called by pre_build and after completing the build of a set
# to ensure the symlinks point to the latest built stages. # to ensure the symlinks point to the latest built stages.
: :
} }
pre_build() { pre_build() {
# This is a skeleton function that you can override from the config file. # This is a skeleton function that you can override from the config file.
# It will be executed before the build is started. # It will be executed before the build is started.
update_symlinks update_symlinks
} }
post_build() { post_build() {
# This is a skeleton function that you can override from the config file. # This is a skeleton function that you can override from the config file.
# It will be executed after the build is successfully completed. You can # It will be executed after the build is successfully completed. You can
# use this to rsync the builds to another box # use this to rsync the builds to another box
: :
} }
catalyst_var() { catalyst_var() {
# Extract a setting from the catalyst.conf. # Extract a setting from the catalyst.conf.
local var=$1 local var=$1
(. "${CATALYST_CONFIG}"; echo "${!var}") (. "${CATALYST_CONFIG}"; echo "${!var}")
} }
trigger_post_build() { trigger_post_build() {
@ -166,13 +166,13 @@ parse_args() {
} }
give_latest_from_dates() { give_latest_from_dates() {
sed 's,-20,~20,g' | \ sed 's,-20,~20,g' | \
sort -k +1 -n -t '~' |\ sort -k +1 -n -t '~' | \
awk -F\~ \ awk -F'~' \
'BEGIN{i=$1; o=$0}; 'BEGIN{i=$1; o=$0};
{ if($1 != i && i != "") { print o; }; i=$1; o=$0; } { if($1 != i && i != "") { print o; }; i=$1; o=$0; }
END { print o; };' | \ END { print o; };' | \
tr '~' '-' tr '~' '-'
} }
# Replace the date/time stamp in the filename to "latest". # Replace the date/time stamp in the filename to "latest".