41 lines
701 B
Bash
Executable File
41 lines
701 B
Bash
Executable File
#!/bin/bash
|
|
E_BADARGS=85
|
|
if [ $# -ne "5" ]
|
|
then
|
|
echo "Usage: `basename $0` version root-dir packaging-dir outputdir arch"
|
|
exit $E_BADARGS
|
|
fi
|
|
|
|
if [ $5 -eq "x64" ]
|
|
then
|
|
ARCH=x86_64
|
|
else
|
|
ARCH=i386
|
|
fi
|
|
|
|
# Replace any dashes in the version string with periods
|
|
PKGVERSION=`echo $1 | sed "s/-/\\./g"`
|
|
|
|
sed -i "s/{VERSION_FIELD}/$PKGVERSION/" openra.spec
|
|
rootdir=`readlink -f $2`
|
|
sed -i "s|{ROOT_DIR}|$rootdir|" openra.spec
|
|
|
|
for x in `find $rootdir -type f`
|
|
do
|
|
y="/${x#$rootdir}"
|
|
sed -i "/%files/ a $y" openra.spec
|
|
done
|
|
|
|
cp openra.spec "$3/SPECS/"
|
|
|
|
cd "$3"
|
|
|
|
rpmbuild --target $ARCH -bb SPECS/openra.spec
|
|
if [ $? -ne 0 ]; then
|
|
exit 1
|
|
fi
|
|
|
|
cd RPMS/$ARCH/
|
|
mv openra-$PKGVERSION-1.$ARCH.rpm $4
|
|
|