1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-15 15:53:55 +00:00

Added root check for service install/uninstall

This commit is contained in:
Bryan Roe
2020-08-03 11:06:45 -07:00
parent 584c967ac9
commit f0fa377395

View File

@@ -108,11 +108,17 @@ limitations under the License.
if ((msh.InstallFlags & 1) == 1) { buttons.unshift('Connect'); }
if ((msh.InstallFlags & 2) == 2)
{
if (!require('user-sessions').isRoot())
{
console.log('\n' + "Elevated permissions is required to install/uninstall the agent.");
console.log("Please try again with sudo.");
process.exit();
}
if (s)
{
if (process.platform == 'darwin' || require('message-box').kdialog)
{
buttons.unshift('Setup');
buttons.unshift("Setup");
}
else
{
@@ -135,6 +141,11 @@ limitations under the License.
process.exit();
}
}
else
{
if (!require('user-sessions').isRoot()) { console.log('\n' + "This utility requires elevated permissions. Please try again with sudo."); process.exit(); }
}
if (!s)
{