Fix SystemD, update ReadMe.md, Debian based support
Support with Tolstoevsky
This commit is contained in:
parent
27a9393534
commit
6e2cb4444b
11
README.md
11
README.md
@ -1,2 +1,13 @@
|
||||
# Yggtk
|
||||
|
||||
Now support Arch and Debian based Linux (OpenRC and SystemD).
|
||||
|
||||
### Build and run
|
||||
|
||||
```
|
||||
git clone https://git.macaw.me:3000/plant_1312/Yggtk.git
|
||||
valac Yggtk/main.vala --pkg gtk+-3.0 --pkg json-glib-1.0
|
||||
cp Yggtk/main.ui .
|
||||
rm -R Yggtk
|
||||
./main
|
||||
```
|
||||
|
36
main.vala
36
main.vala
@ -29,7 +29,7 @@ int main (string[] args) {
|
||||
|
||||
browse.clicked.connect (() => {
|
||||
|
||||
browse.label = "clicked";
|
||||
browse.label = "Soon";
|
||||
|
||||
});
|
||||
|
||||
@ -43,7 +43,7 @@ int main (string[] args) {
|
||||
|
||||
var status = builder.get_object ("status") as Switch;
|
||||
|
||||
check_status(status);
|
||||
check_status (status);
|
||||
|
||||
status.notify["active"].connect (() => {
|
||||
|
||||
@ -88,10 +88,14 @@ int download () {
|
||||
|
||||
try {
|
||||
|
||||
string yggconf;
|
||||
Process.spawn_command_line_sync ("pkexec pacman -S yggdrasil --noconfirm");
|
||||
Process.spawn_command_line_sync ("yggdrasil -genconf -json", out yggconf);
|
||||
parse (yggconf);
|
||||
string pm = Process.spawn_command_line_sync ("pkexec pacman -S yggdrasil --noconfirm");
|
||||
|
||||
if (pm = "bash: pacman: command not found\n") {
|
||||
|
||||
Process.spawn_command_line_sync ("wget https://2375-115685026-gh.circle-artifacts.com/0/yggdrasil-0.3.12-amd64.deb");
|
||||
Process.spawn_command_line_sync ("dpkg -i yggdrasil-0.3.12-amd64.deb");
|
||||
|
||||
}
|
||||
|
||||
} catch (Error e) {
|
||||
|
||||
@ -134,7 +138,7 @@ int stop () {
|
||||
try {
|
||||
|
||||
Process.spawn_command_line_sync ("pkexec rc-service yggdrasil stop");
|
||||
Process.spawn_command_line_sync ("pkexec systemctl stop yggdrasil");
|
||||
Process.spawn_command_line_sync ("systemctl stop yggdrasil");
|
||||
|
||||
} catch (Error e) {
|
||||
|
||||
@ -153,7 +157,7 @@ int start () {
|
||||
try {
|
||||
|
||||
Process.spawn_command_line_sync ("pkexec rc-service yggdrasil start");
|
||||
Process.spawn_command_line_sync ("pkexec systemctl start yggdrasil");
|
||||
Process.spawn_command_line_sync ("systemctl start yggdrasil");
|
||||
|
||||
} catch (Error e) {
|
||||
|
||||
@ -185,17 +189,27 @@ int check_status (Switch status) {
|
||||
|
||||
if (yggstatus == "bash: rc-service: command not found\n") {
|
||||
|
||||
print ("systemd\n");
|
||||
Process.spawn_command_line_sync ("systemctl status yggdrasil | grep running -c", out yggstatus);
|
||||
|
||||
if (yggstatus == "0") {
|
||||
|
||||
status.state_set (false);
|
||||
|
||||
} else {
|
||||
|
||||
status.state_set (true);
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if (yggstatus == " * status: stopped\n") {
|
||||
|
||||
status.state_set(false);
|
||||
status.state_set (false);
|
||||
|
||||
} else {
|
||||
|
||||
status.state_set(true);
|
||||
status.state_set (true);
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user