Re: %install section script problem...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 20 Jul 2004, Erik Slagter wrote:

> >    + read -a line
> >    + echo SunOS
> >    + egrep -qs '^Linux$|^Linux,|,Linux,|,Linux$'
> >    + '[' 1 -ne 0 ']' 
> >    + return 1111
> >    error: Bad exit status from /var/tmp/rpm-tmp.5856 (%install)
> >  
> > Here's the snippet of code from "func":
> >  
> >     cat $file | egrep -v '^#' |  \
> >     while read -a line; do
> >         echo ${line[$platform_idx]} | egrep $egrep_flags "^$platform$|^$platform,|,$platform,|,$platform$"
> >         if [ $? -eq 0 ]; then
> >            # Do some stuff here.
> >         fi
> >     done    
> >     # Check if file processing succeeded.
> >     if [ $? -ne 0 ]; then
> >         return 1111
> >     fi
> >  
> > For some reason, when run inside rpmbuild, the failure of the egrep call is causing the 
> > while loop to be exited!  I have no idea why.
> 
> I'd suspect the shell. I assume your script is made to be run with bash
> (I believe using plain bourne shell you should write
grin...I missed his bashism's.  Actually the heinous bash stuff (as far 
as bourne shell is concered) is the arrays as in the lines:

     while read -a line; do
         echo ${line[$platform_idx]} | egrep $egrep_flags "^$platform$|^$platform,|,$platform,|,$platform$"

The "read -a" is reading into a line, and "${line[$platform_idx]}" is 
accessing an elemnt of the array.  Since arrays don't exist in bourne 
shell which is going to be the default shell on Solaris, that would be 
another explanation of the error (unless of course he was doing
"-p /usr/bin/bash" or something like it).

Cheers...james


_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/rpm-list

[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux