There are two lines in the rpm2targz script which cause errors on g/fbsd due to
their incompatibility with fbsd's sh:
1] line 26 -> [ "$TMPDIR" == "" ] && TMPDIR=/tmp
The correct expression, compatibile with the sh syntax, is with only one
equal sign, so:
[ "$TMPDIR" = "" ] && TMPDIR=/tmp
2] line 91 -> if echo ${PAYLOADHEAD} | grep -e $'^\037\213' > /dev/null ; then
This line fails due to the fact that the $'' construct is unsupported, as
noted by exg, and therefore grep interprets \037 and \213 as backward
expressions, instead of the considering the respective non-printable
characters (which are the magic bytes of the gzip format).
A possibile solution could be to filter PAYLOADHEAD trough `od -c` and then
simply: grep -e '037.213'
However as Flameeyes noted, the most simple (yet effective) solution is to use
bash instead of sh to parse the script.
Reproducible: Always
Steps to Reproduce: