1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-22 19:23:31 +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 & 1) == 1) { buttons.unshift('Connect'); }
if ((msh.InstallFlags & 2) == 2) 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 (s)
{ {
if (process.platform == 'darwin' || require('message-box').kdialog) if (process.platform == 'darwin' || require('message-box').kdialog)
{ {
buttons.unshift('Setup'); buttons.unshift("Setup");
} }
else else
{ {
@@ -135,6 +141,11 @@ limitations under the License.
process.exit(); 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) if (!s)
{ {