/** * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ namespace Yggtk { public class YggdrasilServiceOpenRC : Object, YggdrasilService { public bool get_status () throws SpawnError { string cmd_stdout, cmd_stderr; int cmd_status = -1; Process.spawn_command_line_sync ("rc-service yggdrasil status", out cmd_stdout, out cmd_stderr, out cmd_status); if (cmd_status != 0 || cmd_stderr.length > 0 || cmd_stdout.contains ("stopped")) { return false; } return true; } public void start () throws SpawnError { Process.spawn_command_line_sync ("pkexec rc-service yggdrasil start"); } public void stop () throws SpawnError { Process.spawn_command_line_sync ("pkexec rc-service yggdrasil stop"); } } }