-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrpmBuild
executable file
·96 lines (89 loc) · 2.19 KB
/
rpmBuild
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/bin/sh
if test 'whoami' != 'root'; then
echo "You have to be root to build the pegasus rpm"
#exit
fi
#
echo "This script executes <make clean> first"
read -n 1 -p "Do you want to continue ? (y/n)" retcode
if test $retcode != "y"; then
echo "Okay, you don\'t want to execute make clean now"
exit
fi
echo;
export PEGASUS_PLATFORM=LINUX_IX86_GNU
if test -z $PEGASUS_HOME; then
echo "Please make sure that PEGASUS_ROOT points to the current"
echo "location of the Pegasus sources"
read -n 1 -p "Is current directory the location of Pegasus? (y/n)" retcode
if test $retcode != "y"; then
echo "Okay, please set the variable first"
exit
fi
export PEGASUS_HOME=`pwd`
echo;
fi
#
#
export PEGASUS_ROOT=$PEGASUS_HOME
cd $PEGASUS_HOME
if make clean; then
echo "Sources are cleaned up"
else
echo "Cleanup hasn't been successful"
exit
fi
#
PEGASUS_BASE=`basename $PEGASUS_ROOT`
PEGASUS_DIR=`dirname $PEGASUS_ROOT`
if test "$PEGASUS_BASE" != "pegasus-1.0"; then
echo "I'm going to make sure that pegasus is found in */pegasus-1.0/ "
#cp -a $PEGASUS_ROOT $PEGASUS_ROOT/../pegasus-1.0
mv $PEGASUS_ROOT $PEGASUS_DIR/pegasus-1.0
export PEGASUS_ROOT=$PEGASUS_DIR/pegasus-1.0
fi
# pack the entire source, but first clean it up
#
# and copy it into /usr/src/packages/SOURCES
#
#pushd ..
cd $PEGASUS_DIR
if tar cfz /usr/src/packages/SOURCES/pegasus-1.0.tar.gz pegasus-1.0 ;then
echo "/usr/src/packages/SOURCES/pegasus-1.0.tar.gz created"
else
echo "Didn't succeed in tarring"
mv $PEGASUS_ROOT $PEGASUS_DIR/$PEGASUS_BASE
exit
fi
mv $PEGASUS_ROOT $PEGASUS_DIR/$PEGASUS_BASE
cd $PEGASUS_BASE
#popd
export PEGASUS_ROOT=$PEGASUS_DIR/$PEGASUS_BASE
#
#
#
chmod +x rpm/pegasus
if cp $PEGASUS_ROOT/rpm/pegasus-1.0.spec /usr/src/packages/SPECS/; then
echo "Copied spec file"
else
echo "Spec file missing ???"
exit
fi
#
#
#chmod +x rpm/buildincludes
#if cp $PEGASUS_ROOT/rpm/buildincludes /var/tmp; then
# echo "Copied buildincludes script"
#else
# echo "buildincludes script missing ???"
# exit
#fi
#
#
echo "Start building ...."
if rpm -ba /usr/src/packages/SPECS/pegasus-1.0.spec; then
echo "Package built as /usr/src/packages/RPMS/pegasus-1.0.rpm"
else
echo "Build error !"
fi
echo "Finished"