-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsrpmsbuild.sh
executable file
·47 lines (44 loc) · 1.52 KB
/
srpmsbuild.sh
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
#!/bin/bash
set -x
PACKAGE=$1
VERSION=$2
TOPDIR=$(pwd)
touch $TOPDIR/md5sums.txt.rej
export PATH=$PATH:/usr/bin:$TOPDIR
export CURL_HOME=$TOPDIR
echo '--insecure' > $CURL_HOME/.curlrc
SPECTOOL=spectool
which -a spectool
if [ -f /etc/rpmdevtools/curlrc ];
then
cat /etc/rpmdevtools/curlrc
fi
rm -rf $TOPDIR/$PACKAGE/$VERSION/rpmbuild/{SOURCES,SPECS,SRPMS}
mkdir -p $TOPDIR/$PACKAGE/$VERSION/rpmbuild/{SOURCES,SPECS,RPMS,SRPMS}
for a in $($SPECTOOL $TOPDIR/$PACKAGE/$VERSION/$PACKAGE.spec | tr -s ' '| cut -f 2 -d' ' | grep '://' ); do
wget --no-check-certificate --no-cache $a -P $TOPDIR/$PACKAGE/$VERSION/rpmbuild/SOURCES
s=$(md5sum $PACKAGE/$VERSION/rpmbuild/SOURCES/$(basename $a))
if grep -Fxq "$s" $TOPDIR/md5sums.txt
then
echo "MD5 sum->"$s"<- Found in "$TOPDIR"/md5sums.txt"
else
echo "MD5 sum->"$s"<- NOT found in "$TOPDIR"/md5sums.txt"
echo $s >> $TOPDIR/md5sums.txt.rej
exit
fi
done
for a in $($SPECTOOL $TOPDIR/$PACKAGE/$VERSION/$PACKAGE.spec | tr -s ' '| cut -f 2 -d' ' | grep -v '://' ); do
cp $TOPDIR/$PACKAGE/$VERSION/$(basename $a) $TOPDIR/$PACKAGE/$VERSION/rpmbuild/SOURCES
done
cd $TOPDIR/$PACKAGE/$VERSION
if [ -f do.sh ];
then
sh do.sh
fi
cd $TOPDIR
cp $TOPDIR/$PACKAGE/$VERSION/*$PACKAGE* $TOPDIR/$PACKAGE/$VERSION/rpmbuild/SOURCES
rpmbuild -bs --define='%_topdir '$TOPDIR/$PACKAGE/$VERSION'/rpmbuild' $TOPDIR/$PACKAGE/$VERSION/$PACKAGE.spec
if [ x$3 == x"--build" ];
then
rpmbuild --define='%_topdir '$TOPDIR/$PACKAGE/$VERSION'/rpmbuild' --rebuild $TOPDIR/$PACKAGE/$VERSION/rpmbuild/SRPMS/$PACKAGE*src.rpm --nodeps
fi