1) is pretty easy to fix, the packages states, selection states and flags just need to be updated from the dpkg man page.
To solve 2) I would suggest to use dpkg-query directly to select the field that we need.
1) is pretty easy to fix, the packages states, selection states and flags just need to be updated from the dpkg man page.
To solve 2) I would suggest to use dpkg-query directly to select the field that we need.