Repair uninstall undo.

Fixes #1898
Don't overwrite scripts with dependencies that have the same name.

Fixes #1906.
Always fire the script installation callback asynchronously.

This fixes scripts being injected twice when all @requires are removed.