In regard to: Re: %install section script problem..., Erik Slagter said (at...:
+ 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
while ...
do ..
...
done)
That's good advice, but I don't think that's what's happening here.
As far as I can tell, your code is working as expected:
- you echo "SunOS" into an egrep
- it doesn't match the pattern
- you exit the loop
- return value from some previous command was not 0
- your scriptlet exits with a return value of 1111
- RPM detects that the script exited non-zero, and tells you so:
error: Bad exit status from /var/tmp/rpm-tmp.5856 (%install)
The question is, which command is the one that's setting the return value
that isn't 0? My assumption is that it's egrep that's returning 1, since
there were no matches. It's possible it's the "read", but I doubt that.
Your code isn't really portable, but I think it's working as it's written
to work.
Tim
--
Tim Mooney mooney@xxxxxxxxxxxxxxxxxxxxxxxxx
Information Technology Services (701) 231-1076 (Voice)
Room 242-J6, IACC Building (701) 231-8541 (Fax)
North Dakota State University, Fargo, ND 58105-5164
_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/rpm-list