reboot method
Reboots the Liquid Galaxy system. We used to write sudo reboot in the terminal, but we need a way to add the password and the LG number too here
Implementation
Future<void> reboot() async {
final pw = _sshData.passwordOrKey;
final result = await getScreenAmount();
if (result != null) {
screenAmount = int.parse(result);
}
for (var i = screenAmount; i > 1; i--) {
try {
await _sshData
.execute('sshpass -p $pw ssh -t lg$i "echo $pw | sudo -S reboot"');
} catch (e) {
// ignore: avoid_print
print(e);
}
}
try {
await _sshData
.execute('sshpass -p $pw ssh -t lg1 "echo $pw | sudo -S reboot"');
} catch (e) {
// ignore: avoid_print
print(e);
}
}