1996-05-16 00:52:17 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
1996-05-16 02:11:23 +00:00
|
|
|
# The directory in which to find the last snapshot; must be absolute path
|
|
|
|
dir=/home/mccallum/gnu/releases
|
1996-05-16 01:49:42 +00:00
|
|
|
|
|
|
|
# The email addresses of people to receive mail about the new diff
|
1996-05-16 00:52:17 +00:00
|
|
|
diff_recipients=drepper
|
|
|
|
|
1996-05-16 01:49:42 +00:00
|
|
|
# The name of this module
|
|
|
|
module=gstep-base
|
|
|
|
# A regular expression for the six-digit date string "yymmdd"
|
1996-05-16 00:52:17 +00:00
|
|
|
yrptn='[0-9][0-9][0-9][0-9][0-9][0-9]'
|
1996-05-16 01:49:42 +00:00
|
|
|
# The pattern for the file containing the diff
|
1996-05-16 00:52:17 +00:00
|
|
|
ptn="${module}-${yrptn}"
|
|
|
|
dptn="${ptn}-${yrptn}.diff"
|
|
|
|
|
1996-05-16 01:49:42 +00:00
|
|
|
# Get the current date
|
1996-05-16 00:52:17 +00:00
|
|
|
date=`date +%y%m%d`
|
|
|
|
|
1996-05-16 01:49:42 +00:00
|
|
|
# Find date of the last snapshot
|
1996-05-16 02:11:23 +00:00
|
|
|
lastsnap=`cd $dir; ls $ptn.tar.gz 2>/dev/null |
|
1996-05-16 00:52:17 +00:00
|
|
|
sed -e "s/^.*\\(${yrptn}\\)[.a-z]*$/\\1/" |
|
|
|
|
sort -nr | head -1`
|
|
|
|
|
1996-05-16 02:11:23 +00:00
|
|
|
# Find the date of the second-to-last snapshot
|
|
|
|
secondlastsnap=`cd $dir; ls $ptn.tar.gz 2>/dev/null |
|
|
|
|
sed -e "s/^.*\\(${yrptn}\\)[.a-z]*$/\\1/" |
|
|
|
|
sort -nr | head -2 | tail -1`
|
|
|
|
|
1996-05-16 01:49:42 +00:00
|
|
|
# Find the date of the last diff
|
1996-05-16 00:52:17 +00:00
|
|
|
lastdiff=`cd $dir; ls $dptn $dptn.gz 2>/dev/null |
|
|
|
|
sed -e "s/^.*\\(${yrptn}\\)[.a-z]*$/\\1/" |
|
|
|
|
sort -nr | head -1`
|
|
|
|
|
1996-05-16 02:11:23 +00:00
|
|
|
echo Making diff between $secondlastsnap and $lastsnap
|
1996-05-16 00:52:17 +00:00
|
|
|
|
1996-05-16 02:11:23 +00:00
|
|
|
# The name of the diff file
|
|
|
|
diff="${module}-${secondlastsnap}-${lastsnap}.diff"
|
1996-05-16 00:52:17 +00:00
|
|
|
|
1996-05-16 02:11:23 +00:00
|
|
|
if [ -f $dir/$diff ]; then
|
|
|
|
echo $dir/$diff already exists! Exiting.
|
|
|
|
exit -1
|
1996-05-16 00:52:17 +00:00
|
|
|
fi
|
1996-05-16 01:49:42 +00:00
|
|
|
echo Making $diff
|
|
|
|
|
1996-05-16 02:11:23 +00:00
|
|
|
# Untar the old snapshot
|
|
|
|
(cd /tmp ; tar -zvxf $dir/${module}-${secondlastsnap}.tar.gz)
|
|
|
|
# Untar the new snapshot
|
|
|
|
(cd /tmp ; tar -zvxf $dir/${module}-${lastsnap}.tar.gz)
|
|
|
|
# Make the diff
|
|
|
|
echo Diffing...
|
|
|
|
rm -f /tmp/$diff
|
|
|
|
(cd /tmp; diff -u -r ${module}-${secondlastsnap} ${module}-${lastsnap} > $diff)
|
|
|
|
# Remove the snapshot dirs
|
|
|
|
rm -rf /tmp/${module}-${secondlastsnap} /tmp/${module}-${lastsnap}
|
|
|
|
|
|
|
|
if [ -s /tmp/$diff ]; then
|
1996-05-16 01:49:42 +00:00
|
|
|
# Mail a message saying the new diff is available. (Commented out for now)
|
|
|
|
# mail -s $diff < $diff $diff_recipients
|
1996-05-16 02:11:23 +00:00
|
|
|
gzip -9 /tmp/$diff && mv -f /tmp/$diff.gz $dir
|
1996-05-16 00:52:17 +00:00
|
|
|
else
|
1996-05-16 02:11:23 +00:00
|
|
|
rm -f /tmp/$diff
|
1996-05-16 00:52:17 +00:00
|
|
|
fi
|