Skip to content

Instantly share code, notes, and snippets.

@dirkmueller
Created March 28, 2018 09:07
Show Gist options
  • Save dirkmueller/25a552d157fd9f9cf850a6e334dfa7c6 to your computer and use it in GitHub Desktop.
Save dirkmueller/25a552d157fd9f9cf850a6e334dfa7c6 to your computer and use it in GitHub Desktop.
#!/bin/bash
fpn=/usr/share/osc-plugin-factory/factory-package-news/factory-package-news.py
dosend=1
cd ~/src/Cloud/provo/media-announcer
announce_new_media() {
local dir=$1
currentmedia=$(ls -1tr $dir/Build* | tail -n 1 | cut -d/ -f2)
lastmedia=$(readlink $dir/last)
if [ -z $currentmedia ]; then
echo "buildid is not set!"
exit 1
fi
if [ "$lastmedia" != "$currentmedia" ]; then
echo "new $dir media: $currentmedia!"
$fpn diff --dir $PWD/$dir $lastmedia $currentmedia > output.txt
if [ $(wc -l < output.txt) -gt 4 ]; then
if [ "$dosend" = "1" ]; then
mail -r [email protected] -s "New $dir media published: $currentmedia" [email protected] < output.txt
ln -sf $currentmedia $dir/last
fi
cat output.txt
fi
fi
}
announce_new_media dc8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment