forked from neilbrown/mdadm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makedist
executable file
·96 lines (95 loc) · 2.78 KB
/
makedist
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/sh
# avoid silly sorting
export LANG=C
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 '^#define VERSION' ReadMe.c `
version=`echo $3 | sed -e 's/"//g'`
grep "^.TH MDADM 8 .. v$version" mdadm.8.in > /dev/null 2>&1 ||
{
echo mdadm.8.in does not mention version $version.
exit 1
}
grep "^.TH MDMON 8 .. v$version" mdmon.8 > /dev/null 2>&1 ||
{
echo mdmon.8 does not mention version $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-$rpmv.tar.gz
if [ " $arg" != " diff" ]
then
if [ -f $target/$base ]
then
echo $target/$base exists.
exit 1
fi
trap "rm $target/$base; exit" 1 2 3
git archive --prefix=mdadm-$rpmv/ HEAD | 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 ~/rpmbuild/RPMS -name "*mdadm-$version-*" \
-exec cp {} $target/RPM \;
cp ANNOUNCE-$version $target/ANNOUNCE
cp ChangeLog $target/ChangeLog
if [ " $arg" != " test" ]
then
echo -n "Confirm signing this release? "
read a
if [ " $a" != " y" ]; then echo OK - bye. ; exit 1; fi
if zcat $target/$base | gpg -ba > $target/$base.sign && gpg -ba $target/ANNOUNCE
then
kup put $target/$base $target/$base.sign \
/pub/linux/utils/raid/mdadm/mdadm-$version.tar.gz
kup put $target/ANNOUNCE $target/ANNOUNCE.asc /pub/linux/utils/raid/mdadm/ANNOUNCE
else
echo signing failed
exit 1
fi
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=.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
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