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:
@@ -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() != '');
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user