diff --git a/stream8_snapshots/email_nopackages.tpl b/stream8_snapshots/email_nopackages.tpl new file mode 100644 index 0000000000000000000000000000000000000000..5b263cd7417013e5938e2ed627353649a3d7de30 --- /dev/null +++ b/stream8_snapshots/email_nopackages.tpl @@ -0,0 +1,20 @@ +To: $EMAIL_ADMIN +From: $EMAIL_FROM +Reply-To: noreply.$EMAIL_FROM +Return-Path: $EMAIL_ADMIN +Subject: CS8 - No new packages today + +Dear Linux admins, + +Just a quick message to let you know that there were no new upstream CentOS Stream 8 packages today. + +Here's the current state of the symlinks: + +$STATE + +Have a nice day! + +--- +Best regards, +CERN Linux Droid +(on behalf of the friendly humans of Linux Support) diff --git a/stream8_snapshots/sendemail.sh b/stream8_snapshots/sendemail.sh index 7e99452b1a253bbb898b93b47d146932aee8cdbe..74abf96b63e5c33434bc502791f6bfa5e3e474fe 100755 --- a/stream8_snapshots/sendemail.sh +++ b/stream8_snapshots/sendemail.sh @@ -43,8 +43,35 @@ for ARCH in $CENTOS_ARCHES; do done done +if [[ $CHANNEL == "daily" ]]; then + STATE="" + while IFS= read -r LINE; do + MODTIME="`echo $LINE | cut -d'.' -f1`" + LINK="`echo $LINE | cut -d' ' -f2`" + TARGET="`readlink $DESTINATION/$LINK`" + STATE="$STATE `printf '%-20s' "$LINK"` -> $TARGET (modified $MODTIME)\n" + done <<< "`find $DESTINATION -maxdepth 1 -type l -name \"${RELEASE}*\" -printf '%T+ %P\n' | sort | tail -n 10`" + # grab the last 10 symlinks so we can see the state of the previous point release as well + + FROZEN=`find $DESTINATION -maxdepth 1 -type f -name ".freeze.${RELEASE}*" -print -quit` + if [[ -n "$FROZEN" ]]; then + STATE="$STATE\n ***************************************************\n" + STATE="$STATE *** .freeze.${RELEASE}* exists, links won't be updated ***\n" + STATE="$STATE ***************************************************\n" + fi + export STATE="`printf "$STATE"`" +fi + # There are no diffs to report on, we can stop -[[ ! -s "$TMPDIR/.longlist" ]] && exit +if [[ ! -s "$TMPDIR/.longlist" ]]; then + if [[ $CHANNEL == "daily" ]]; then + # But let's inform the admins (so they don't worry unneccessarily) + envsubst < /root/email_nopackages.tpl >> "$TMPDIR/.email" + cat "$TMPDIR/.email" | swaks --server $MAILMX --to $EMAIL_TO --data - + rm "$TMPDIR/.email" + fi + exit +fi # Update website if [[ $CHANNEL == "production" ]] || [[ $CHANNEL == "testing" ]]; then @@ -67,25 +94,6 @@ export TODAY="$TODAY" export SHORTLIST="`echo "$SHORTLIST" | sed 's/\b\s\+\b/, /g'`" export WEBSITE -if [[ $CHANNEL == "daily" ]]; then - STATE="" - while IFS= read -r LINE; do - MODTIME="`echo $LINE | cut -d'.' -f1`" - LINK="`echo $LINE | cut -d' ' -f2`" - TARGET="`readlink $DESTINATION/$LINK`" - STATE="$STATE `printf '%-20s' "$LINK"` -> $TARGET (modified $MODTIME)\n" - done <<< "`find $DESTINATION -maxdepth 1 -type l -name \"${RELEASE}*\" -printf '%T+ %P\n' | sort | tail -n 10`" - # grab the last 10 symlinks so we can see the state of the previous point release as well - - FROZEN=`find $DESTINATION -maxdepth 1 -type f -name ".freeze.${RELEASE}*" -print -quit` - if [[ -n "$FROZEN" ]]; then - STATE="$STATE\n ***************************************************\n" - STATE="$STATE *** .freeze.${RELEASE}* exists, links won't be updated ***\n" - STATE="$STATE ***************************************************\n" - fi - export STATE="`printf "$STATE"`" -fi - envsubst < $TEMPLATE | sed '/^--PACKAGES--$/Q' > "$TMPDIR/.email" for ARCH in $CENTOS_ARCHES; do for REPO in $ALL_REPOS; do