MFC r256646, r256767, r257038:
  When installing updates, install new directories first and remove old
  directories last.

  Allow ~ in file names so libtool droppings in contrib don't break updates.
  It has happened twice now, and is likely to happen again.

  Be more selective when filtering for lib*.so.N files.  These are deleted
  at the end of the upgrade process, after warning users to upgrade any
  3rd party software (e.g., from the ports tree) which might link to the
  libraries being removed.

Errata Notice:  FreeBSD-EN-13:04.freebsd-update
Approved by:	so