Merge branch 'dev' of github.com:amnezia-vpn/amnezia-client into feature/new-gui
This commit is contained in:
commit
3964bffce4
6 changed files with 37 additions and 17 deletions
|
@ -6,7 +6,7 @@ project(${PROJECT} VERSION 4.0.1.1
|
||||||
DESCRIPTION "AmneziaVPN"
|
DESCRIPTION "AmneziaVPN"
|
||||||
HOMEPAGE_URL "https://amnezia.org/"
|
HOMEPAGE_URL "https://amnezia.org/"
|
||||||
)
|
)
|
||||||
set(RELEASE_DATE "2023-08-10")
|
set(RELEASE_DATE "2023-08-16")
|
||||||
set(APP_MAJOR_VERSION ${CMAKE_PROJECT_VERSION_MAJOR}.${CMAKE_PROJECT_VERSION_MINOR}.${CMAKE_PROJECT_VERSION_PATCH})
|
set(APP_MAJOR_VERSION ${CMAKE_PROJECT_VERSION_MAJOR}.${CMAKE_PROJECT_VERSION_MINOR}.${CMAKE_PROJECT_VERSION_PATCH})
|
||||||
|
|
||||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||||
|
|
|
@ -37,7 +37,7 @@ AmneziaApplication::AmneziaApplication(int &argc, char *argv[], bool allowSecond
|
||||||
setQuitOnLastWindowClosed(false);
|
setQuitOnLastWindowClosed(false);
|
||||||
|
|
||||||
// Fix config file permissions
|
// Fix config file permissions
|
||||||
#if defined Q_OS_LINUX && !defined(Q_OS_ANDROID)
|
#if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)
|
||||||
{
|
{
|
||||||
QSettings s(ORGANIZATION_NAME, APPLICATION_NAME);
|
QSettings s(ORGANIZATION_NAME, APPLICATION_NAME);
|
||||||
s.setValue("permFixed", true);
|
s.setValue("permFixed", true);
|
||||||
|
|
|
@ -138,7 +138,7 @@ android {
|
||||||
resConfig "en"
|
resConfig "en"
|
||||||
minSdkVersion = 24
|
minSdkVersion = 24
|
||||||
targetSdkVersion = 34
|
targetSdkVersion = 34
|
||||||
versionCode 31 // Change to a higher number
|
versionCode 32 // Change to a higher number
|
||||||
versionName "3.0.9" // Change to a higher number
|
versionName "3.0.9" // Change to a higher number
|
||||||
|
|
||||||
javaCompileOptions.annotationProcessorOptions.arguments = [
|
javaCompileOptions.annotationProcessorOptions.arguments = [
|
||||||
|
|
|
@ -33,6 +33,7 @@ enum ErrorCode
|
||||||
ServerDockerFailedError,
|
ServerDockerFailedError,
|
||||||
ServerCancelInstallation,
|
ServerCancelInstallation,
|
||||||
ServerUserNotInSudo,
|
ServerUserNotInSudo,
|
||||||
|
ServerPacketManagerError,
|
||||||
|
|
||||||
// Ssh connection errors
|
// Ssh connection errors
|
||||||
SshRequsetDeniedError, SshInterruptedError, SshInternalError,
|
SshRequsetDeniedError, SshInterruptedError, SshInternalError,
|
||||||
|
|
|
@ -210,7 +210,8 @@ ErrorCode ServerController::uploadFileToHost(const ServerCredentials &credential
|
||||||
localFile.write(data);
|
localFile.write(data);
|
||||||
localFile.close();
|
localFile.close();
|
||||||
|
|
||||||
error = m_sshClient.sftpFileCopy(overwriteMode, localFile.fileName().toStdString(), remotePath.toStdString(), "non_desc");
|
error = m_sshClient.sftpFileCopy(overwriteMode, localFile.fileName().toStdString(), remotePath.toStdString(),
|
||||||
|
"non_desc");
|
||||||
if (error != ErrorCode::NoError) {
|
if (error != ErrorCode::NoError) {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
@ -236,7 +237,8 @@ ErrorCode ServerController::setupContainer(const ServerCredentials &credentials,
|
||||||
ErrorCode e = ErrorCode::NoError;
|
ErrorCode e = ErrorCode::NoError;
|
||||||
|
|
||||||
e = isUserInSudo(credentials, container);
|
e = isUserInSudo(credentials, container);
|
||||||
if (e) return e;
|
if (e)
|
||||||
|
return e;
|
||||||
|
|
||||||
e = isServerDpkgBusy(credentials, container);
|
e = isServerDpkgBusy(credentials, container);
|
||||||
if (e)
|
if (e)
|
||||||
|
@ -249,12 +251,14 @@ ErrorCode ServerController::setupContainer(const ServerCredentials &credentials,
|
||||||
|
|
||||||
if (!isUpdate) {
|
if (!isUpdate) {
|
||||||
e = isServerPortBusy(credentials, container, config);
|
e = isServerPortBusy(credentials, container, config);
|
||||||
if (e) return e;
|
if (e)
|
||||||
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isUpdate) {
|
if (!isUpdate) {
|
||||||
e = isServerPortBusy(credentials, container, config);
|
e = isServerPortBusy(credentials, container, config);
|
||||||
if (e) return e;
|
if (e)
|
||||||
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
e = prepareHostWorker(credentials, container, config);
|
e = prepareHostWorker(credentials, container, config);
|
||||||
|
@ -360,7 +364,10 @@ ErrorCode ServerController::installDockerWorker(const ServerCredentials &credent
|
||||||
cbReadStdOut, cbReadStdErr);
|
cbReadStdOut, cbReadStdErr);
|
||||||
|
|
||||||
qDebug().noquote() << "ServerController::installDockerWorker" << stdOut;
|
qDebug().noquote() << "ServerController::installDockerWorker" << stdOut;
|
||||||
if (stdOut.contains("command not found")) return ErrorCode::ServerDockerFailedError;
|
if (stdOut.contains("lock"))
|
||||||
|
return ErrorCode::ServerPacketManagerError;
|
||||||
|
if (stdOut.contains("command not found"))
|
||||||
|
return ErrorCode::ServerDockerFailedError;
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
@ -721,7 +728,8 @@ ErrorCode ServerController::isServerDpkgBusy(const ServerCredentials &credential
|
||||||
QFutureWatcher<ErrorCode> watcher;
|
QFutureWatcher<ErrorCode> watcher;
|
||||||
|
|
||||||
QFuture<ErrorCode> future = QtConcurrent::run([this, &stdOut, &cbReadStdOut, &cbReadStdErr, &credentials]() {
|
QFuture<ErrorCode> future = QtConcurrent::run([this, &stdOut, &cbReadStdOut, &cbReadStdErr, &credentials]() {
|
||||||
do {
|
// max 100 attempts
|
||||||
|
for (int i = 0; i < 100; ++i) {
|
||||||
if (m_cancelInstallation) {
|
if (m_cancelInstallation) {
|
||||||
return ErrorCode::ServerCancelInstallation;
|
return ErrorCode::ServerCancelInstallation;
|
||||||
}
|
}
|
||||||
|
@ -730,12 +738,22 @@ ErrorCode ServerController::isServerDpkgBusy(const ServerCredentials &credential
|
||||||
replaceVars(amnezia::scriptData(SharedScriptType::check_server_is_busy),
|
replaceVars(amnezia::scriptData(SharedScriptType::check_server_is_busy),
|
||||||
genVarsForScript(credentials)),
|
genVarsForScript(credentials)),
|
||||||
cbReadStdOut, cbReadStdErr);
|
cbReadStdOut, cbReadStdErr);
|
||||||
if (!stdOut.isEmpty() || stdOut.contains("Unable to acquire the dpkg frontend lock")) {
|
|
||||||
emit serverIsBusy(true);
|
// if 'fuser' is not installed, skip check
|
||||||
QThread::msleep(1000);
|
if (stdOut.contains("Not installed"))
|
||||||
}
|
|
||||||
} while (!stdOut.isEmpty());
|
|
||||||
return ErrorCode::NoError;
|
return ErrorCode::NoError;
|
||||||
|
|
||||||
|
if (stdOut.isEmpty()) {
|
||||||
|
return ErrorCode::NoError;
|
||||||
|
} else {
|
||||||
|
#ifdef MZ_DEBUG
|
||||||
|
qDebug().noquote() << stdOut;
|
||||||
|
#endif
|
||||||
|
emit serverIsBusy(true);
|
||||||
|
QThread::msleep(5000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ErrorCode::ServerPacketManagerError;
|
||||||
});
|
});
|
||||||
|
|
||||||
QEventLoop wait;
|
QEventLoop wait;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
pm_apt="/usr/bin/apt-get";\
|
if which apt-get > /dev/null 2>&1; then LOCK_FILE="/var/lib/dpkg/lock-frontend";\
|
||||||
if [[ -f "$pm_apt" ]]; then pm=$pm_apt; else exit; fi;\
|
elif which dnf > /dev/null 2>&1; then LOCK_FILE="/var/run/dnf.pid";\
|
||||||
if [[ ! -f "/usr/bin/sudo" ]]; then $pm update -y -q; $pm install -y -q sudo; fi;\
|
elif which yum > /dev/null 2>&1; then LOCK_FILE="/var/run/yum.pid";\
|
||||||
sudo fuser /var/lib/dpkg/lock-frontend
|
else echo "Packet manager not found"; echo "Internal error"; exit 1; fi;\
|
||||||
|
if command -v fuser > /dev/null 2>&1; then sudo fuser $LOCK_FILE; else echo "Not installed"; fi
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue