forked from MIT-Mobile/MIT-Mobile-Web
-
Notifications
You must be signed in to change notification settings - Fork 7
/
mitmobile-make-rpm.sh
executable file
·62 lines (44 loc) · 1.34 KB
/
mitmobile-make-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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
RPMBUILDDIR=~/rpmbuild
VERSION=2.1
RPMVERSION=4
OS=fc12
PACKAGE=mitmobile-all
cd `dirname $0`
cd ..
# section on getting and compiling pngcrush source
# not sure if it's kosher to build it in rpmbuild
CRUSHVER=1.7.11
PNGCRUSH=pngcrush-${CRUSHVER}
if [ ! -d ${PNGCRUSH} ]; then
if [ ! -f /tmp/${PNGCRUSH}.tar.gz ]; then
wget http://cdnetworks-us-2.dl.sourceforge.net/project/pmt/pngcrush/00-${CRUSHVER}/${PNGCRUSH}.tar.gz -O /tmp/${PNGCRUSH}.tar.gz
fi
tar -zxf /tmp/${PNGCRUSH}.tar.gz
cd $PNGCRUSH
make
cd ..
fi
# rpm proper
echo "creating rpms for version $VERSION, release $RPMVERSION"
TARBALL=${PACKAGE}-${VERSION}-${RPMVERSION}.${OS}.tar.gz
SRCROOT=${PACKAGE}-${VERSION}
mkdir $SRCROOT
mkdir -p $SRCROOT/var/www/
cp -r mobi-web $SRCROOT/var/www/html
cp setup/.htaccess $SRCROOT/var/www/html
cp -r opt $SRCROOT
cp -r mobi-config $SRCROOT/opt/mitmobile
cp -r mobi-lib $SRCROOT/opt/mitmobile
cp mobi-scripts/* $SRCROOT/opt/mitmobile/bin
if [ -f $PNGCRUSH/pngcrush ]; then
cp $PNGCRUSH/pngcrush opt/mitmobile/bin
fi
tar -zcf ${TARBALL} ${SRCROOT} --exclude=.git*
mv ${TARBALL} ${RPMBUILDDIR}/SOURCES
SPEC=${PACKAGE}-${VERSION}.spec
cp setup/${SPEC} ${RPMBUILDDIR}/SPECS
sed -i 's/__RELEASE__/'${RPMVERSION}.${OS}'/g' ${RPMBUILDDIR}/SPECS/${SPEC}
rpmbuild -ba ${RPMBUILDDIR}/SPECS/${SPEC}
# cleanup
rm -r $SRCROOT