If multiple versions of the same package are in the package feed then the
generate status file would only contains a "deinstall" status for the last one,
which meant that BAD_RECOMMENDATIONS wouldn't actually work.
Use awk instead of grep and stop reading when we reach a newline, so we only
ever output a single stanza.
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
for i in ${BAD_RECOMMENDATIONS}; do
pkginfo="`opkg-cl ${OPKG_ARGS} info $i`"
if [ ! -z "$pkginfo" ]; then
- echo "$pkginfo" | grep -e '^Package:' -e '^Architecture:' -e '^Version:' >> $STATUS
- echo "Status: deinstall hold not-installed" >> $STATUS
- echo >> $STATUS
+ # Take just the first package stanza as otherwise only
+ # the last one will have the right Status line.
+ echo "$pkginfo" | awk "/^Package:/ { print } \
+ /^Architecture:/ { print } \
+ /^Version:/ { print } \
+ /^$/ { exit } \
+ END { print \"Status: deinstall hold not-installed\n\" }" - >> $STATUS
else
echo "Requested ignored recommendation $i is not a package"
fi