installSnappInstallerOnRemote method
Future<bool>
installSnappInstallerOnRemote(
- String username,
- InternetAddress ip, {
- bool addHostToKnownHosts = true,
install snapp_installer in the remote machine using ssh connection
we will use snapp_installerhttps://github.com/Snapp-X/snapp_installer
to install flutter in the remote machine
with this method you can first install snapp_installer
returns true if snapp_installer installed successfully otherwise returns false
Implementation
Future<bool> installSnappInstallerOnRemote(
String username,
InternetAddress ip, {
bool addHostToKnownHosts = true,
}) async {
final RunResult result;
try {
result = await processRunner.runWithOutput(
hostPlatform.sshCommand(
ipv6: ip.isIpv6,
sshTarget: ip.sshTarget(username),
lastCommand: true,
command:
'bash <(curl -fSL https://raw.githubusercontent.com/Snapp-X/snapp_installer/main/installer.sh)',
addHostToKnownHosts: addHostToKnownHosts,
),
processManager: processManager,
logger: logger,
);
} catch (e, s) {
logger.detail(
'Something went wrong while trying to find snapp_installer. \n $e \n $s',
);
return false;
} finally {
logger.spaces();
}
if (result.exitCode != 0) {
logger.info('Snapp Installer ExitCode: ${result.exitCode}');
logger.info('Snapp Installer Stdout: ${result.stdout.trim()}');
logger.info('Snapp Installer Stderr: ${result.stderr}');
}
return result.exitCode == 0;
}