easyrsa fix
This commit is contained in:
parent
fe6f89c551
commit
dd526959eb
4 changed files with 351 additions and 290 deletions
|
@ -15,9 +15,7 @@ QString OpenVpnConfigurator::getEasyRsaShPath()
|
|||
{
|
||||
#ifdef Q_OS_WIN
|
||||
// easyrsa sh path should looks like
|
||||
// "/Program Files (x86)/AmneziaVPN/easyrsa/easyrsa"
|
||||
QString easyRsaShPath = QDir::toNativeSeparators(QApplication::applicationDirPath()) + "\\easyrsa\\easyrsa";
|
||||
easyRsaShPath = "\"" + easyRsaShPath + "\"";
|
||||
qDebug().noquote() << "EasyRsa sh path" << easyRsaShPath;
|
||||
|
||||
return easyRsaShPath;
|
||||
|
@ -34,7 +32,7 @@ QProcessEnvironment OpenVpnConfigurator::prepareEnv()
|
|||
#ifdef Q_OS_WIN
|
||||
pathEnvVar.clear();
|
||||
pathEnvVar.prepend(QDir::toNativeSeparators(QApplication::applicationDirPath()) + "\\cygwin;");
|
||||
pathEnvVar.prepend(QDir::toNativeSeparators(QApplication::applicationDirPath()) + "\\openvpn\\i386;");
|
||||
pathEnvVar.prepend(QDir::toNativeSeparators(QApplication::applicationDirPath()) + "\\openvpn;");
|
||||
#else
|
||||
pathEnvVar.prepend(QDir::toNativeSeparators(QApplication::applicationDirPath()) + "/Contents/MacOS");
|
||||
#endif
|
||||
|
@ -52,7 +50,7 @@ ErrorCode OpenVpnConfigurator::initPKI(const QString &path)
|
|||
#ifdef Q_OS_WIN
|
||||
p.setProcessEnvironment(prepareEnv());
|
||||
p.setProgram("cmd.exe");
|
||||
p.setNativeArguments(QString("/C \"ash.exe %1\"").arg(getEasyRsaShPath() + " init-pki"));
|
||||
p.setNativeArguments(QString("/C \"ash.exe \"%1\" %2\"").arg(getEasyRsaShPath()).arg("init-pki"));
|
||||
qDebug().noquote() << "EasyRsa tmp path" << path;
|
||||
qDebug().noquote() << "EasyRsa args" << p.nativeArguments();
|
||||
#else
|
||||
|
@ -81,7 +79,10 @@ ErrorCode OpenVpnConfigurator::genReq(const QString &path, const QString &client
|
|||
#ifdef Q_OS_WIN
|
||||
p.setProcessEnvironment(prepareEnv());
|
||||
p.setProgram("cmd.exe");
|
||||
p.setNativeArguments(QString("/C \"ash.exe %1\"").arg(getEasyRsaShPath() + " gen-req " + clientId + " nopass"));
|
||||
p.setNativeArguments(QString("/C \"ash.exe \"%1\" %2 %3 %4\"")
|
||||
.arg(getEasyRsaShPath())
|
||||
.arg("gen-req").arg(clientId).arg("nopass"));
|
||||
|
||||
qDebug().noquote() << "EasyRsa args" << p.nativeArguments();
|
||||
#else
|
||||
p.setArguments(QStringList() << "gen-req" << clientId << "nopass");
|
||||
|
|
Binary file not shown.
File diff suppressed because it is too large
Load diff
|
@ -1,18 +1,14 @@
|
|||
var requestToQuitFromApp = false;
|
||||
var updaterCompleted = 0;
|
||||
var desktopAppProcessRunning = false;
|
||||
var desktopAppProcessRunning = false;
|
||||
var appInstalledUninstallerPath;
|
||||
var appInstalledUninstallerPath_x86;
|
||||
|
||||
function appName()
|
||||
{
|
||||
return installer.value("Name");
|
||||
}
|
||||
|
||||
function appAlreadyInstalled()
|
||||
{
|
||||
return installer.fileExists(appInstalledUninstallerPath);
|
||||
}
|
||||
|
||||
function appExecutableFileName()
|
||||
{
|
||||
if (runningOnWindows()) {
|
||||
|
@ -25,12 +21,13 @@ function appExecutableFileName()
|
|||
function appInstalled()
|
||||
{
|
||||
if (runningOnWindows()) {
|
||||
appInstalledUninstallerPath = installer.value("TargetDir") + "\\maintenancetool.exe";
|
||||
appInstalledUninstallerPath = installer.value("RootDir") + "Program Files/AmneziaVPN/maintenancetool.exe";
|
||||
appInstalledUninstallerPath_x86 = installer.value("RootDir") + "Program Files (x86)/AmneziaVPN/maintenancetool.exe";
|
||||
} else if (runningOnMacOS()){
|
||||
appInstalledUninstallerPath = "/Applications/" + appName() + ".app/maintenancetool.app/Contents/MacOS/maintenancetool";
|
||||
}
|
||||
|
||||
return appAlreadyInstalled();
|
||||
return installer.fileExists(appInstalledUninstallerPath) || installer.fileExists(appInstalledUninstallerPath_x86);
|
||||
}
|
||||
|
||||
function endsWith(str, suffix)
|
||||
|
@ -249,14 +246,25 @@ function Controller () {
|
|||
installer.setMessageBoxAutomaticAnswer("OverwriteTargetDirectory", QMessageBox.Yes);
|
||||
}
|
||||
|
||||
if (appAlreadyInstalled()) {
|
||||
if (appInstalled()) {
|
||||
if (QMessageBox.Ok === QMessageBox.information("os.information", appName(),
|
||||
qsTr("The application is already installed.") + " " +
|
||||
qsTr("We need to remove the old installation first. Do you wish to proceed?"),
|
||||
QMessageBox.Ok | QMessageBox.Cancel)) {
|
||||
|
||||
if (appAlreadyInstalled()) {
|
||||
var resultArray = installer.execute(appInstalledUninstallerPath);
|
||||
|
||||
if (appInstalled()) {
|
||||
var resultArray = [];
|
||||
|
||||
if (installer.fileExists(appInstalledUninstallerPath_x86)) {
|
||||
console.log("Starting uninstallation " + appInstalledUninstallerPath_x86);
|
||||
resultArray = installer.execute(appInstalledUninstallerPath_x86);
|
||||
}
|
||||
|
||||
if (installer.fileExists(appInstalledUninstallerPath)) {
|
||||
console.log("Starting uninstallation " + appInstalledUninstallerPath);
|
||||
resultArray = installer.execute(appInstalledUninstallerPath);
|
||||
}
|
||||
|
||||
console.log("Uninstaller finished with code: " + resultArray[1])
|
||||
|
||||
|
@ -265,7 +273,7 @@ function Controller () {
|
|||
installer.setCancelled();
|
||||
return;
|
||||
} else {
|
||||
for (var i = 0; i < 100; i++) {
|
||||
for (var i = 0; i < 300; i++) {
|
||||
sleep(100);
|
||||
if (!installer.fileExists(appInstalledUninstallerPath)) {
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue