The package selection for Arch Linux is not optimal, especially when the
image is not bootable. The main issue is that a kernel is still
installed when the image is not bootable.
Optional packages from the `base` group that are required under specific
configurations are first deleted from the package selection and
explicitly re-added when required. For example, the `cryptsetup` and
`device-mapper` packages are included only if the image is bootable and
encrypted. Similarly, a kernel is included only if the image is
bootable or if the user selected one explicitly.
Sets are now better used in the package selection. The appropriate
operators and methods are directly used instead of relying on
intermediary sets.
The installation of the packages is split into two operations. The first
only installs the packages from the `base` group and the second installs
the packages selected by the user. This is necessary because some
packages (e.g. `git`) have an install script that depends on the `base`
group without listing those in their dependencies. If they are installed
before their implicit dependency, their install script will most likely
fail.