Fix sort order by using "version sort" (sort -V)

- linux-image-2.6.38-8-generic was assumed to be the newest kernel, though
  linux-image-2.6.38-16-generic was already installed.
Also remove header files (no need for additional apt-get autoremove)
Format list of to-removed packages
Use 'dpkg -l "linux-image-*"' instead of 'dpkg -l | grep linux-image-'
Use variables to store list of packages instead of producing them all the time