Fix slightly dangerous rm fr.

Some small improvements to handle the module install from url a little safer. Moves downloaded file to cache path, makes install more idempotent and still removes cached file download safely

Tested this and it fixes the issue mentioned.