Update of /cvsroot/env-switcher/modules-oscar/dist
In directory sc8-pr-cvs1:/tmp/cvs-serv7978/dist
Modified Files:
buildrpm.sh modules-oscar.spec
Log Message:
Updates to make the RPM more robust
Index: buildrpm.sh
===================================================================
RCS file: /cvsroot/env-switcher/modules-oscar/dist/buildrpm.sh,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** buildrpm.sh 27 Oct 2002 12:24:07 -0000 1.5
--- buildrpm.sh 21 Jul 2003 13:02:00 -0000 1.6
***************
*** 85,90 ****
if test -d /usr/src/RPM; then
rpmtopdir="/usr/src/RPM"
! else
rpmtopdir="/usr/src/redhat"
fi
echo "--> Found RPM top dir: $rpmtopdir"
--- 85,96 ----
if test -d /usr/src/RPM; then
rpmtopdir="/usr/src/RPM"
! elif test -d /usr/src/redhat; then
rpmtopdir="/usr/src/redhat"
+ elif test -d /usr/src/packages; then
+ rpmtopdir="/usr/src/packages"
+ else
+ echo "--> Unable to find RPM build directory."
+ echo "--> Aborting in despair :-("
+ exit 1
fi
echo "--> Found RPM top dir: $rpmtopdir"
***************
*** 146,154 ****
#
# build the OSCAR RPM
#
echo "--> Building the OSCAR RPM"
! cmd="rpm -ba --target=$oscar_target $specdest"
echo "--> $cmd"
eval $cmd
--- 152,171 ----
#
+ # what command to use?
+ #
+
+ which rpmbuild
+ if test "$?" = "0"; then
+ rpm_cmd="rpmbuild"
+ else
+ rpm_cmd="rpm"
+ fi
+
+ #
# build the OSCAR RPM
#
echo "--> Building the OSCAR RPM"
! cmd="$rpm_cmd -ba --target=$oscar_target $specdest"
echo "--> $cmd"
eval $cmd
***************
*** 168,172 ****
exit 1
fi
! echo "--> Done building the OSCAR RPM"
#
--- 185,202 ----
exit 1
fi
!
! #
! # Remove the build trees
! #
!
! dir="$rpmtopdir/BUILD/`basename $tarball_modules`"
! dir="`echo $dir | sed -e 's/.tar.gz$//'`"
! echo "--> removing directory: $dir"
! rm -rf $dir
!
! dir="$rpmtopdir/BUILD/`basename $tarball_modules_oscar`"
! dir="`echo $dir | sed -e 's/.tar.gz$//'`"
! echo "--> removing directory: $dir"
! rm -rf $dir
#
Index: modules-oscar.spec
===================================================================
RCS file: /cvsroot/env-switcher/modules-oscar/dist/modules-oscar.spec,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -r1.15 -r1.16
*** modules-oscar.spec 21 Jul 2003 10:44:38 -0000 1.15
--- modules-oscar.spec 21 Jul 2003 13:02:01 -0000 1.16
***************
*** 18,21 ****
--- 18,22 ----
%define _moddir /opt/modules
%define _profiledir /etc/profile.d
+ %define _modrpmfilelist /etc/%{name}-%{version}-rpmfiles
# Added to get around RPM 4.2 debugging additions (starting in RH 8.0)
***************
*** 72,75 ****
--- 73,81 ----
%setup -q -T -D -b 1 -n modules-%{version}
+ # Otherwise, this directory shows up on security reports
+
+ chmod -R o-w $RPM_BUILD_DIR/modules-oscar-@MORPM_VERSION@
+ chmod -R o-w $RPM_BUILD_DIR/modules-%{version}
+
#############################################################################
***************
*** 289,293 ****
bashfile="/etc/bashrc";
if test ! -f $bashfile; then
! bashfile=/etc/bash.bashrc
if test ! -f $bashfile; then
echo "Can't find bash startup file to edit. :-("
--- 295,299 ----
bashfile="/etc/bashrc";
if test ! -f $bashfile; then
! bashfile="/etc/bash.bashrc"
if test ! -f $bashfile; then
echo "Can't find bash startup file to edit. :-("
***************
*** 300,304 ****
grep $localfile $bashfile 2>&1 > /dev/null
if test "$?" = "0"; then
! bashfile=$"localfile"
fi
--- 306,310 ----
grep $localfile $bashfile 2>&1 > /dev/null
if test "$?" = "0"; then
! bashfile="$localfile"
fi
***************
*** 315,319 ****
# essentially the same reasons. Sucks!!
! cshfile="/etc/cshrc";
if test ! -f $cshfile; then
echo "Can't find csh startup file to edit. :-("
--- 321,325 ----
# essentially the same reasons. Sucks!!
! cshfile="/etc/csh.cshrc";
if test ! -f $cshfile; then
echo "Can't find csh startup file to edit. :-("
***************
*** 325,332 ****
grep $localfile $cshfile 2>&1 > /dev/null
if test "$?" = "0"; then
! cshfile=$"localfile"
fi
! if test -f "$bashfile"; then
%__cp $cshfile $cshfile.rpmsave
fi
--- 331,338 ----
grep $localfile $cshfile 2>&1 > /dev/null
if test "$?" = "0"; then
! cshfile="$localfile"
fi
! if test -f "$cshfile"; then
%__cp $cshfile $cshfile.rpmsave
fi
***************
*** 339,342 ****
--- 345,357 ----
unset special_string
+ # Save the names of the files that we altered so that %postun can know
+ # what files to clean.
+
+ rm -f %{_modrpmfilelist}
+ cat > %{_modrpmfilelist} <<EOF
+ $bashfile
+ $cshfile
+ EOF
+
#############################################################################
***************
*** 349,363 ****
special_string="MODULES-%{version}-%{release}-RPM-ADDITION"
! # Remove the addition that we put in the /etc/bashrc file in %post.
!
! egrep -v '^.*# '$special_string /etc/bashrc > /etc/bashrc.tmp
! %__cp /etc/bashrc.tmp /etc/bashrc
! %__rm -f /etc/bashrc.tmp
! # Ditto for /etc/csh.cshrc
!
! egrep -v '^.*# '$special_string /etc/csh.cshrc > /etc/csh.cshrc.tmp
! %__cp /etc/csh.cshrc.tmp /etc/csh.cshrc
! %__rm -f /etc/csh.cshrc.tmp
--- 364,377 ----
special_string="MODULES-%{version}-%{release}-RPM-ADDITION"
! # Look for the listing of the files that we modified
! if test -f %{_modrpmfilelist}; then
! for file in `cat %{_modrpmfilelist}`; do
! egrep -v '^.*# '$special_string $file > $file.tmp
! %__cp $file.tmp $file
! %__rm -f $file.tmp
! done
! rm -f %{_moddir}/%{version}/share/rpmfiles
! fi
|