Fix broken package installation script
Add magit to required packages
Refresh package list before trying to install