Package installation failures leaves package installed
When a package cannot be installed, such as missing binaries or binaries that cannot be fetched for any reason, the package install fails, but the pkg's XML is added to the config so the package shows as installed though it actually isn't.
Ticket #950. Correctly handle failures while installing packages which might leave stale information behind. Also do not try to startup services twice. Rename uninstall_package_from_name to uninstall_package because the operation on packages is only done through package names.
- Use pkg_info -E pkgname* for testing if a package is installed.
- Do not call eval if we cannot include an .inc file since that will make the whole script fail.
- Keep the log from the start to the end without overwriting. This makes debugging and problem reporting easy and explains what is done during installation.
- Check retrun value of download_with_progress_bar to make it possible catching errors during download.
- Lots of improvements in between
Related to Ticket #950