Refactor auto-install-packages.el.