public void UpdateSshdConfig(string sshdExecutable) { const string changeService = "sc config sshd binpath= "; string sshd_config_fullpath = Path.Combine(baseDir, sshd_config_filename); string SSHD_CONFIG_LOCATION = " -f \\\"" + sshd_config_fullpath + "\\\"\""; if (string.IsNullOrEmpty(sshdExecutable)) { sshdExecutable = OpenSshController.LocateSshdExecutable(); } if (!string.IsNullOrEmpty(sshdExecutable)) { string output = ExecuteCmd(changeService + sshdExecutable + SSHD_CONFIG_LOCATION); // TODO: check the output to make sure the command is successful } }
private void FindOrInstallOpenSshLocation() { ConnectButton.IsEnabled = false; LogLine("Looking for OpenSSH Installation..."); Task.Run(() => { string sshLocation = OpenSshController.LocateSshdExecutable(); Application.Current.Dispatcher.Invoke((Action)(() => { if (sshLocation == null) { OpenSshExecutableLocationTextBox.IsReadOnly = true; DataBinding.OpenSshInstallLocation = DEFAULT_OPENSSH_LOCATION; LogLine("OpenSSH is not currently installed. Flingr will install it in the following location: " + DEFAULT_OPENSSH_LOCATION); } else { OpenSshExecutableLocationTextBox.IsReadOnly = false; DataBinding.OpenSshInstallLocation = sshLocation; LogLine("OpenSSH is currently installed. This is where Flingr thinks it lives on the device: " + sshLocation); } })); if (System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable()) { bool installationSuccess = OpenSshController.InstallOpenSshd(); LogLine("OpenSSH Installed: " + installationSuccess); if (installationSuccess) { Application.Current.Dispatcher.Invoke((Action)(() => { ConnectButton.IsEnabled = true; })); } } else { LogLine("Could not install OpenSSH because network is not available"); } }); }