1 |
|
#!/bin/sh |
2 |
|
|
3 |
|
# This script attempts to build .deb, .rpm and .tar.gz packages from |
4 |
|
# the bubblemon. |
5 |
|
|
6 |
|
# FIXME: This script is extremely non-portable and is only guaranteed |
7 |
|
# to work at Johan's place. Portability enhancements are greatly |
8 |
|
# appreciated, send them to d92-jwa@nada.kth.se. |
9 |
|
|
10 |
|
# FIXME: This script will erase files in your RPM_SOURCES directory, |
11 |
|
# in your BUBBLEMON_ROOT directory and in your RPMS directory. For |
12 |
|
# this script to ever get any good it should probably be rewritten in |
13 |
|
# some real scripting language. |
14 |
|
|
15 |
|
# FIXME: If you don't have write permissions in your RPM_SOURCES |
16 |
|
# directory, in your BUBBLEMON_ROOT directory or in your RPMS |
17 |
|
# directory, I don't know what happens. |
18 |
|
|
19 |
|
BUBBLEMON_ROOT=/home/rael/bubbletest |
20 |
|
RPM_SOURCES=/usr/src/redhat/SOURCES |
21 |
|
RPM_SRPMS=/usr/src/redhat/SRPMS |
22 |
|
|
23 |
|
# See to that we are in the root bubblemon directory |
24 |
|
if [ `pwd` != $BUBBLEMON_ROOT ] ; then |
25 |
|
cat <<EOF |
26 |
|
This script ($0) works only when started from the directory in the |
27 |
|
\$BUBBLEMON_ROOT variable (currently $BUBBLEMON_ROOT). |
28 |
|
|
29 |
|
The \$BUBBLEMON_ROOT variable can be configured at the top of this |
30 |
|
script. It must *not* end with a slash (/). |
31 |
|
EOF |
32 |
|
|
33 |
|
exit 1 |
34 |
|
fi |
35 |
|
|
36 |
|
if [ ! -d $RPM_SOURCES ] ; then |
37 |
|
cat <<EOF |
38 |
|
This script ($0) needs of the $RPM_SOURCES directory to work. |
39 |
|
Please fix this problem and try again. |
40 |
|
EOF |
41 |
|
exit 1 |
42 |
|
fi |
43 |
|
|
44 |
|
if [ ! -d $RPM_SRPMS ] ; then |
45 |
|
cat <<EOF |
46 |
|
This script ($0) needs of the $RPM_SRPMS directory to work. |
47 |
|
Please fix this problem and try again. |
48 |
|
EOF |
49 |
|
exit 1 |
50 |
|
fi |
51 |
|
|
52 |
|
# Build a source package |
53 |
|
make -j2 dist |
54 |
|
if [ $? != 0 ] ; then |
55 |
|
echo Error: Source package building failed > /dev/stderr |
56 |
|
exit 1 |
57 |
|
fi |
58 |
|
|
59 |
|
# Build an RPM |
60 |
|
rm -f bubblemon-*.tar.gz |
61 |
|
make -j2 dist |
62 |
|
if [ $? != 0 ] ; then |
63 |
|
echo Error: Source package building failed > /dev/stderr |
64 |
|
exit 1 |
65 |
|
fi |
66 |
|
ln -s $BUBBLEMON_ROOT/bubblemon-*.tar.gz $RPM_SOURCES |
67 |
|
rpm -bs packaging/bubblemon.spec |
68 |
|
if [ $? != 0 ] ; then |
69 |
|
echo Error: RPM package building failed > /dev/stderr |
70 |
|
rm -f bubblemon-*.tar.gz $RPM_SOURCES/bubblemon-*.tar.gz |
71 |
|
exit 1 |
72 |
|
fi |
73 |
|
|
74 |
|
echo |
75 |
|
echo Package creation done, look in $RPM_SRPMS for the generated packages. |
76 |
|
echo |