forked from mcallegari/qlcplus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
create-rpm.sh
executable file
·45 lines (37 loc) · 1.29 KB
/
create-rpm.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
#!/bin/sh
#
# This script creates Q Light Controller RPM packages.
if [ -f Makefile ]; then
echo Cleaning objects from previous compile
make distclean
fi
if [ ! -d rpm ]; then
echo ERROR: This script must be run from the top-level QLC+ source directory
exit 1;
fi
VERSION=`head -1 debian/changelog | sed 's/.*(\(.*\)).*/\1/'`
SOURCES=qlcplus
RPMBUILD=~/rpmbuild
# Prepare RPM build directory hierarchy
if [ ! -f $RPMBUILD ]; then
echo Creating RPMBUILD hierarchy in $RPMBUILD
mkdir -p $RPMBUILD/SOURCES $RPMBUILD/SPECS $RPMBUILD/BUILD $RPMBUILD/SRPMS
mkdir -p $RPMBUILD/RPMS/i386 $RPMBUILD/RPMS/athlon $RPMBUILD/RPMS/i486
mkdir -p $RPMBUILD/RPMS/i586 $RPMBUILD/RPMS/i686 $RPMBUILD/RPMS/noarch
fi
# Copy the RPM spec file so that rpmbuild finds it
cp -f platforms/linux/qlcplus.spec $RPMBUILD/SPECS
# Prepare a source tarball and move it under $RPMBUILD/SOURCES
echo "Packing sources into qlcplus-$VERSION.tar.gz..."
if [ -d /tmp/qlcplus-$VERSION ]; then
rm -rf /tmp/qlcplus-$VERSION
fi
mkdir /tmp/qlcplus-$VERSION
rsync -aC . /tmp/qlcplus-$VERSION
tar --directory=/tmp -czf /tmp/qlcplus-$VERSION.tar.gz qlcplus-$VERSION
mv /tmp/qlcplus-$VERSION.tar.gz $RPMBUILD/SOURCES
cd $RPMBUILD/SPECS
QLCPLUS_VERSION=$VERSION rpmbuild -bb qlcplus.spec
if [ $? == 0 ]; then
echo Packages created in $RPMBUILD/RPMS
fi