TOR: fix compilation
[tomato.git] / release / src / router / mdadm / makedist
blob7adbd7f2cdcae491c9795f654fb90098cc690f92
1 #!/bin/sh
2 arg=$1
3 target=~/public_html/source/mdadm
4 if [ " $arg" = " test" ]
5 then
6 target=/tmp/mdadm-test
7 rm -rf $target
8 mkdir -p $target
9 fi
10 if [ -d $target ]
11 then :
12 else echo $target is not a directory
13 exit 2
15 set `grep '^char Version' ReadMe.c `
16 version=`echo $7 | sed 's/v//'`
17 grep "^.TH MDADM 8 .. v$version" mdadm.8 > /dev/null 2>&1 ||
19 echo mdadm.8 does not mention verion $version.
20 exit 1
22 rpmv=`echo $version | tr - _`
23 grep "^Version: *$rpmv$" mdadm.spec > /dev/null 2>&1 ||
25 echo mdadm.spec does not mention version $version.
26 exit 1
28 if [ -f ANNOUNCE-$version ]
29 then :
30 else
31 echo ANNOUNCE-$version does not exist
32 exit 1
34 if grep "^ANNOUNCE-$version\$" inventory
35 then :
36 else { cat inventory ; echo ANNOUNCE-$version ; } | sort -o inventory
39 echo version = $version
40 base=mdadm-$version.tgz
41 if [ " $arg" != " diff" ]
42 then
43 if [ -f $target/$base ]
44 then
45 echo $target/$base exists.
46 exit 1
48 trap "rm $target/$base; exit" 1 2 3
49 ( cd .. ; ln -s mdadm.v2 mdadm-$version ; tar chvf - --exclude=.git --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
50 chmod a+r $target/$base
51 ls -l $target/$base
52 if tar tzf $target/$base | sed 's,[^/]*/,,' | sort | diff -u inventory -
53 then : correct files found
54 else echo "Extra files, or inventory is out-of-date"
55 rm $target/$base
56 exit 1
58 rpmbuild -ta $target/$base || exit 1
59 find /home/neilb/src/RPM -name "*mdadm-$version-*" \
60 -exec cp {} $target/RPM \;
61 cp ANNOUNCE-$version $target/ANNOUNCE
62 cp ChangeLog $target/ChangeLog
63 if [ " $arg" != " test" ]
64 then
65 scp $target/$base master.kernel.org:/pub/linux/utils/raid/mdadm/mdadm-$version.tar.gz
66 scp $target/ANNOUNCE $target/ChangeLog master.kernel.org:/pub/linux/utils/raid/mdadm/
68 else
69 if [ ! -f $target/$base ]
70 then
71 echo $target/$base does not exist.
72 exit 1
74 ( cd .. ; ln -s mdadm.v2 mdadm-$version ; tar chf - --exclude=.git --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
75 mkdir /var/tmp/mdadm-old ; zcat $target/$base | ( cd /var/tmp/mdadm-old ; tar xf - )
76 mkdir /var/tmp/mdadm-new ; zcat /var/tmp/mdadm-new.tgz | ( cd /var/tmp/mdadm-new ; tar xf - )
77 diff -ru /var/tmp/mdadm-old /var/tmp/mdadm-new
78 rm -rf /var/tmp/mdadm-old /var/tmp/mdadm-new /var/tmp/mdadm-new.tgz