I'm trying to make a oneliner to be able to list all locked (forbidden to upgrade) packages in FreeBSD.
Normally, you issue this command:
pkg info -ak
It outputs list of all packages in system including locked and unlocked which isn't working for me as I only want locked ones. If I grep 'yes' it does exactly what I want:
pkg info -ak | grep yes
It outputs following:
nginx-devel-1.5.10 yes php5-extensions-1.7 yes php55-5.5.8 yes
Now, what I want is to be able to edit that output a little bit by changing string 'yes' for following (adding package name w/ version omitted):
nginx-devel-1.5.10 locked, run: sudo pkg unlock nginx-devel php5-extensions-1.7 locked, run: sudo pkg unlock php5-extensions php55-5.5.8 locked, run: sudo pkg unlock php55
I tried following unsuccessfully:
pkg info -ak | grep yes | sed s/yes/"locked - run: sudo pkg unlock $(pkg info -ak | grep yes | cut -d - f1-2)"/
While what I've tried isn't working I posted it just for you to get the idea what I'm trying to achieve.