mirror of
https://github.com/Mahdi-zarei/nekoray.git
synced 2025-12-31 06:59:04 +08:00
improve linux root request process
This commit is contained in:
parent
e55e5bd81c
commit
aec4968f44
@ -803,21 +803,22 @@ bool MainWindow::get_elevated_permissions(int reason) {
|
||||
}
|
||||
auto n = QMessageBox::warning(GetMessageBoxParent(), software_name, tr("Please give the core root privileges"), QMessageBox::Yes | QMessageBox::No);
|
||||
if (n == QMessageBox::Yes) {
|
||||
auto chownArgs = QString("root:root " + NekoGui::FindNekoBoxCoreRealPath());
|
||||
auto ret = Linux_Run_Command("chown", chownArgs);
|
||||
if (ret != 0) {
|
||||
MW_show_log(QString("Failed to run chown %1 code is %2").arg(chownArgs).arg(ret));
|
||||
return false;
|
||||
}
|
||||
auto chmodArgs = QString("u+s " + NekoGui::FindNekoBoxCoreRealPath());
|
||||
ret = Linux_Run_Command("chmod", chmodArgs);
|
||||
if (ret == 0) {
|
||||
StopVPNProcess();
|
||||
return true;
|
||||
} else {
|
||||
MW_show_log(QString("Failed to run chmod %1").arg(chmodArgs));
|
||||
return false;
|
||||
}
|
||||
runOnNewThread([=]
|
||||
{
|
||||
auto chownArgs = QString("root:root " + NekoGui::FindNekoBoxCoreRealPath());
|
||||
auto ret = Linux_Run_Command("chown", chownArgs);
|
||||
if (ret != 0) {
|
||||
MW_show_log(QString("Failed to run chown %1 code is %2").arg(chownArgs).arg(ret));
|
||||
}
|
||||
auto chmodArgs = QString("u+s " + NekoGui::FindNekoBoxCoreRealPath());
|
||||
ret = Linux_Run_Command("chmod", chmodArgs);
|
||||
if (ret == 0) {
|
||||
StopVPNProcess();
|
||||
} else {
|
||||
MW_show_log(QString("Failed to run chmod %1").arg(chmodArgs));
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
#ifdef Q_OS_WIN
|
||||
|
||||
Loading…
Reference in New Issue
Block a user