#!/bin/sh
arg=$1
target=~/public_html/source/mdadm
if [ " $arg" = " test" ]
then
target=/tmp/mdadm-test
rm -rf $target
mkdir -p $target
fi
if [ -d $target ]
then :
else echo $target is not a directory
exit 2
fi
set `grep '^char Version' ReadMe.c `
version=`echo $7 | sed 's/v//'`
grep "^.TH MDADM 8 .. v$version" mdadm.8 > /dev/null 2>&1 ||
{
echo mdadm.8 does not mention verion $version.
exit 1
}
rpmv=`echo $version | tr - _`
grep "^Version: *$rpmv$" mdadm.spec > /dev/null 2>&1 ||
{
echo mdadm.spec does not mention version $version.
exit 1
}
if [ -f ANNOUNCE-$version ]
then :
else
echo ANNOUNCE-$version does not exist
exit 1
fi
if grep "^ANNOUNCE-$version\$" inventory
then :
else { cat inventory ; echo ANNOUNCE-$version ; } | sort -o inventory
fi
echo version = $version
base=mdadm-$version.tgz
if [ " $arg" != " diff" ]
then
if [ -f $target/$base ]
then
echo $target/$base exists.
exit 1
fi
trap "rm $target/$base; exit" 1 2 3
( cd .. ; ln -s mdadm.v2 mdadm-$version ; tar chvf - --exclude="TAGS" --exclude='*~' --exclude=.patches --exclude='*,v' --exclude='*.o' --exclude mdadm --exclude=mdadm'.[^ch0-9]' --exclude=RCS mdadm-$version ; rm mdadm-$version ) | gzip --best > $target/$base
chmod a+r $target/$base
ls -l $target/$base
if tar tzf $target/$base | sed 's,[^/]*/,,' | sort | diff -u inventory -
then : correct files found
else echo "Extra files, or inventory is out-of-date"
rm $target/$base
exit 1
fi
rpmbuild -ta $target/$base || exit 1
find /home/neilb/src/RPM -name "*mdadm-$version-*" \
-exec cp {} $target/RPM \;
cp ANNOUNCE-$version $target/ANNOUNCE
cp ChangeLog $target/ChangeLog
if [ " $arg" != " test" ]
then
scp $target/$base master.kernel.org:/pub/linux/utils/raid/mdadm/mdadm-$version.tar.gz
scp $target/ANNOUNCE $target/ChangeLog master.kernel.org:/pub/linux/utils/raid/mdadm/
fi
else
if [ ! -f $target/$base ]
then
echo $target/$base does not exist.
exit 1
fi
( cd .. ; ln -s mdadm.v2 mdadm-$version ; tar chf - --exclude="TAGS" --exclude='*,v' --exclude='*~' --exclude='*.o' --exclude mdadm --exclude=mdadm'.[^ch0-9]' --exclude=RCS mdadm-$version ; rm mdadm-$version ) | gzip --best > /var/tmp/mdadm-new.tgz
mkdir /var/tmp/mdadm-old ; zcat $target/$base | ( cd /var/tmp/mdadm-old ; tar xf - )
mkdir /var/tmp/mdadm-new ; zcat /var/tmp/mdadm-new.tgz | ( cd /var/tmp/mdadm-new ; tar xf - )
diff -ru /var/tmp/mdadm-old /var/tmp/mdadm-new
rm -rf /var/tmp/mdadm-old /var/tmp/mdadm-new /var/tmp/mdadm-new.tgz
fi