fix for #319299. Now detects language and install profile correctly. Also fixed a missing variable_set when installing new sites using aegir.