Add pre-{install,purge} support for base image