updated linux build
This commit is contained in:
parent
26524dd93a
commit
9997fa8f3e
24 changed files with 3257 additions and 7 deletions
|
|
@ -19,6 +19,7 @@ QString OpenVpnConfigurator::getEasyRsaShPath()
|
|||
qDebug().noquote() << "EasyRsa sh path" << easyRsaShPath;
|
||||
|
||||
return easyRsaShPath;
|
||||
|
||||
#else
|
||||
return QDir::toNativeSeparators(QApplication::applicationDirPath()) + "/easyrsa";
|
||||
#endif
|
||||
|
|
@ -29,12 +30,14 @@ QProcessEnvironment OpenVpnConfigurator::prepareEnv()
|
|||
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
||||
QString pathEnvVar = env.value("PATH");
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#if defined Q_OS_WIN
|
||||
pathEnvVar.clear();
|
||||
pathEnvVar.prepend(QDir::toNativeSeparators(QApplication::applicationDirPath()) + "\\cygwin;");
|
||||
pathEnvVar.prepend(QDir::toNativeSeparators(QApplication::applicationDirPath()) + "\\openvpn;");
|
||||
#else
|
||||
#elif defined Q_OS_MAC
|
||||
pathEnvVar.prepend(QDir::toNativeSeparators(QApplication::applicationDirPath()) + "/Contents/MacOS");
|
||||
#elif defined Q_OS_LINUX
|
||||
pathEnvVar.prepend(QDir::toNativeSeparators(QApplication::applicationDirPath()) + "/openvpn");
|
||||
#endif
|
||||
|
||||
env.insert("PATH", pathEnvVar);
|
||||
|
|
@ -213,7 +216,7 @@ QString OpenVpnConfigurator::genOpenVpnConfig(const ServerCredentials &credentia
|
|||
config.replace("</tls-auth>", "");
|
||||
}
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
#if defined Q_OS_MAC || defined(Q_OS_LINUX)
|
||||
config.replace("block-outside-dns", "");
|
||||
#endif
|
||||
|
||||
|
|
@ -236,7 +239,7 @@ QString OpenVpnConfigurator::processConfigWithLocalSettings(QString config)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
#if defined Q_OS_MAC || defined(Q_OS_LINUX)
|
||||
config.replace("block-outside-dns", "");
|
||||
QString dnsConf = QString(
|
||||
"\nscript-security 2\n"
|
||||
|
|
@ -259,7 +262,7 @@ QString OpenVpnConfigurator::processConfigWithExportSettings(QString config)
|
|||
config.append("redirect-gateway def1 bypass-dhcp\n");
|
||||
}
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
#if defined Q_OS_MAC || defined(Q_OS_LINUX)
|
||||
config.replace("block-outside-dns", "");
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -142,6 +142,8 @@ QString OpenVpnProtocol::openVpnExecPath() const
|
|||
{
|
||||
#ifdef Q_OS_WIN
|
||||
return Utils::executable("openvpn/openvpn", true);
|
||||
#elif defined Q_OS_LINUX
|
||||
return Utils::usrExecutable("openvpn");
|
||||
#else
|
||||
return Utils::executable("/openvpn", true);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -36,8 +36,12 @@ ErrorCode ShadowSocksVpnProtocol::start()
|
|||
m_shadowSocksCfgFile.write(QJsonDocument(m_shadowSocksConfig).toJson());
|
||||
m_shadowSocksCfgFile.close();
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
QStringList args = QStringList() << "-c" << m_shadowSocksCfgFile.fileName();
|
||||
#else
|
||||
QStringList args = QStringList() << "-c" << m_shadowSocksCfgFile.fileName()
|
||||
<< "--no-delay";
|
||||
#endif
|
||||
|
||||
qDebug().noquote() << "ShadowSocksVpnProtocol::start()"
|
||||
<< shadowSocksExecPath() << args.join(" ");
|
||||
|
|
@ -91,6 +95,8 @@ QString ShadowSocksVpnProtocol::shadowSocksExecPath()
|
|||
{
|
||||
#ifdef Q_OS_WIN
|
||||
return Utils::executable(QString("ss/ss-local"), true);
|
||||
#elif defined Q_OS_LINUX
|
||||
return Utils::usrExecutable(QString("ss-local"));
|
||||
#else
|
||||
return Utils::executable(QString("/ss-local"), true);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -122,6 +122,8 @@ QString WireguardProtocol::wireguardExecPath() const
|
|||
{
|
||||
#ifdef Q_OS_WIN
|
||||
return Utils::executable("wireguard/wireguard", true);
|
||||
#elif defined Q_OS_LINUX
|
||||
return Utils::usrExecutable("wg");
|
||||
#else
|
||||
return Utils::executable("/wireguard", true);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -68,6 +68,14 @@ QString Utils::executable(const QString& baseName, bool absPath)
|
|||
return QCoreApplication::applicationDirPath() + "/" + fileName;
|
||||
}
|
||||
|
||||
QString Utils::usrExecutable(const QString& baseName)
|
||||
{
|
||||
if (QFileInfo::exists("/usr/sbin/" + baseName))
|
||||
return ("/usr/sbin/" + baseName);
|
||||
else
|
||||
return ("/usr/bin/" + baseName);
|
||||
}
|
||||
|
||||
bool Utils::processIsRunning(const QString& fileName)
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ public:
|
|||
static QString getRandomString(int len);
|
||||
|
||||
static QString executable(const QString& baseName, bool absPath);
|
||||
static QString usrExecutable(const QString& baseName);
|
||||
static QString systemLogPath();
|
||||
static bool createEmptyFile(const QString& path);
|
||||
static bool initializePath(const QString& path);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue