public void InstallAll(string packages) { Console.WriteLine("Performing apt-get install..."); Console.WriteLine(" Packages: " + packages); Starter.Start("sudo apt-get install -y " + packages); //Console.WriteLine(Starter.Output); if (Starter.Output.ToLower().IndexOf("permission denied") > -1) { throw new Exception("Error: Permission denied. Do you need to run with sudo?"); } }
public void Download(string url, string destination) { Console.WriteLine(" Downloading file..."); Console.WriteLine(" URL: " + url); Console.WriteLine(" Destination: " + destination); try { WebClient webClient = new WebClient(); webClient.DownloadFile(url, destination); } catch (Exception ex) { var starter = new ProcessStarter(); starter.Start("wget -q " + url + " -O " + destination); } }
public void ExecuteBash(string command) { Console.WriteLine("Executing bash: " + command); Starter.Start(command); }