Skip to content

Commit

Permalink
Add -B flag for BINARY images
Browse files Browse the repository at this point in the history
It has a few hardcoded paths for oSC13 for now
  • Loading branch information
Theo Chatzimichos committed May 24, 2013
1 parent 86fd0cb commit f9d4a3f
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions cron.sh
Expand Up @@ -2,18 +2,21 @@
REMOTE_HOST="counter.o.o"
BASEDIR="/home/counter.opensuse.org/svg"
LOCAL="/home/counter.opensuse.org/output"
BINARY_LOCATION="https://raw.github.com/openSUSE/artwork/master/Marketing%20Materials/Events/openSUSE%20Conference/2013/countdown-banner"
BINARY_FINAL_DATE=$(date -d "2013-07-18" +%s)
REMOTE_LOCATION="counter.o.o:/srv/www/vhosts/0b965c33b89fac9ea53708de378f93dcda084d34/opensuse.org/counter/htdocs"

set -e

VERBOSE=
RENDER=
REMOTE=
while getopts 'vRE' v; do
while getopts 'vREB' v; do
case $v in
v) VERBOSE=1;;
R) REMOTE=1;;
E) RENDER=1;;
B) BINARY=1;;
*) echo "ERROR: unsupported parameter -$v">&2; exit 1;;
esac
done
Expand Down Expand Up @@ -41,9 +44,19 @@ if [ -n "$RENDER" ]; then
done
fi

if [ -n "$BINARY" ]; then
/bin/rm -f "$LOCAL"/*.png
TODAY=$(date +%s)
days_left=$(printf "%02d" $(($(($BINARY_FINAL_DATE-$TODAY+86400))/86400)))
[ $days_left -le 00 ] && days_left=00
for size in large medium small; do
wget "${BINARY_LOCATION}/${days_left}-$size.png" -O "$LOCAL/$size-nolabel.en.png"
ln -s "$LOCAL/$size-nolabel.en.png" "$LOCAL/$size-label.en.png"
done
fi

if [ -n "$REMOTE" ]; then
RSFLAGS=""
[ -n "$VERBOSE" ] && RSFLAGS="$RSFLAGS -v"
rsync -ap --delete-after $RSFLAGS "$LOCAL/" "$REMOTE_LOCATION/"
fi

0 comments on commit f9d4a3f

Please sign in to comment.