1#!/bin/sh
2# MPlayer mirroring script
3# $Id: update_mplayer_rsync 30838 2010-03-04 15:57:21Z diego $
4
5PATH=<set_path_if_necessary>
6LOCK=<path_to_lockfile>
7MIRROR_ROOT=<path_to_mirror_root>
8MAILADR=<report_mail_to_adr>
9
10#TMPDIR = /tmp
11#export TMPDIR
12
13TMPFILE=$(mktemp -t mplayer.XXXXXXXXXXX)
14
15# Check to see if another sync is in progress
16if lockfile -! -l 43200 -r 0 "$LOCK"; then
17  echo Unable to start mirroring MPlayer, lock file exists.
18  exit 1
19fi
20trap "rm -f $LOCK > /dev/null 2>&1" exit
21
22cd $MIRROR_ROOT
23
24echo "************ rsyncing homepage ************" >> $TMPFILE
25rsync -pxlrHtWv --delete --delete-after rsync.mplayerhq.hu::homepage/ \
26      homepage >> $TMPFILE 2>&1
27
28echo "************ rsyncing MPlayer ************" >> $TMPFILE
29rsync -pxlrHtWv --delete --delete-after --exclude '/benchmark' \
30      --exclude '/old_stuff' --exclude '/tests' rsync.mplayerhq.hu::ftp/ \
31      MPlayer  >> $TMPFILE 2>&1
32
33x=$(wc -l $TMPFILE | awk '{print $1}')
34if [ "$x" -ne "10" ]; then
35  mailx -s "MPlayer mirror" $MAILADR < $TMPFILE
36fi
37rm -f $TMPFILE
38