-if grep '^Package: firmware$' /var/lib/dpkg/status >/dev/null; then
- cat /var/lib/dpkg/status | while read -r line; do
- if [[ ${line} == 'Package: firmware' ]]; then
- firmware=
- elif [[ ${line} == '' ]]; then
+cat /var/lib/dpkg/status | {
+
+while IFS= read -r line; do
+ #echo "#${firmware+@}/${blank+@} ${line}" 1>&2
+
+ if [[ ${line} == '' && "${blank+@}" ]]; then
+ continue
+ else
+ unset blank
+ fi
+
+ if [[ ${line} == "Package: "@(firmware|gsc.*) ]]; then
+ firmware=
+ elif [[ ${line} == '' ]]; then
+ blank=
+ fi
+
+ if [[ "${firmware+@}" ]]; then
+ if [[ "${blank+@}" ]]; then