1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-13 23:03:35 +00:00

1. Updated linux-dbus to support querying if a service is present

2. Updated toaster, so it will check if org.freedesktop.Notification is installed
This commit is contained in:
Bryan Roe
2019-08-22 16:57:12 -07:00
parent e666a5f7b9
commit fbd67d2c9c
3 changed files with 29 additions and 4 deletions

View File

@@ -126,3 +126,12 @@ function dbus(address, uid)
}
module.exports = dbus;
module.exports.hasService = function hasService(name)
{
var child = require('child_process').execFile('/bin/sh', ['sh']);
child.stderr.str = ''; child.stderr.on('data', function (c) { this.str += c.toString(); });
child.stdout.str = ''; child.stdout.on('data', function (c) { this.str += c.toString(); });
child.stdin.write('cat /usr/share/dbus-1/services/*.service | grep "' + name + '" | awk -F= \'{ if( $2=="' + name + '" ) { print $2; } }\'\nexit\n');
child.waitExit();
return (child.stdout.str.trim() != '');
};