public void RunBashScript(string script, User user = null) { if (!MachineIsRunning) Open(); if (user != null) { Console.WriteLine("... Login user: {0}", user.UserName); VM.LoginInGuest(user.UserName, user.Password); } RunBashScript(script); if (user != null && user.Logout) { Console.WriteLine("... Logout: {0}", user.UserName); VM.LogoutFromGuest(Timeout); } }
public void UpdateUbuntu(User user) { var script = "#!/bin/bash" + "\n" + "touch /tmp/my_generated.txt" + "\n" + "echo starting update as root >> /tmp/my_generated.txt" + "\n" + "aptitude -y update >> /tmp/my_generated.txt" + "\n" + "aptitude -y full-upgrade >> /tmp/my_generated.txt" + "\n" + "echo done upgrading >> /tmp/my_generated.txt" + "\n"; GuestResultFile = "/tmp/my_generated.txt"; RunBashScript(script, user); }