#!/bin/sh if test 'whoami' != 'root'; then echo "You have to be root to build the pegasus rpm" #exit fi # echo "This script executes 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"