changed using fuser to lsof to determine if dpkg is busy
This commit is contained in:
parent
298e1e2e72
commit
02881c4409
2 changed files with 6 additions and 5 deletions
|
|
@ -539,7 +539,7 @@ ErrorCode ServerController::installDockerWorker(const ServerCredentials &credent
|
|||
QFutureWatcher<ErrorCode> watcher;
|
||||
|
||||
QFuture<ErrorCode> future = QtConcurrent::run([this, &stdOut, &cbReadStdOut, &cbReadStdErr, &credentials]() {
|
||||
do {
|
||||
while (true) {
|
||||
if (m_cancelInstallation) {
|
||||
return ErrorCode::ServerCancelInstallation;
|
||||
}
|
||||
|
|
@ -547,12 +547,13 @@ ErrorCode ServerController::installDockerWorker(const ServerCredentials &credent
|
|||
runScript(credentials,
|
||||
replaceVars(amnezia::scriptData(SharedScriptType::check_server_is_busy),
|
||||
genVarsForScript(credentials)), cbReadStdOut, cbReadStdErr);
|
||||
if (!stdOut.isEmpty() || stdOut.contains("Unable to acquire the dpkg frontend lock")) {
|
||||
if (stdOut.contains("/var/lib/dpkg/lock-frontend")) {
|
||||
emit serverIsBusy(true);
|
||||
QThread::msleep(1000);
|
||||
}
|
||||
} while (!stdOut.isEmpty());
|
||||
} else {
|
||||
return ErrorCode::NoError;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
QEventLoop wait;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
pm_apt="/usr/bin/apt-get";\
|
||||
if [[ -f "$pm_apt" ]]; then pm=$pm_apt; else exit; fi;\
|
||||
if [[ ! -f "/usr/bin/sudo" ]]; then $pm update -y -q; $pm install -y -q sudo; fi;\
|
||||
sudo fuser /var/lib/dpkg/lock-frontend
|
||||
sudo lsof /var/lib/dpkg/lock-frontend
|
||||
Loading…
Add table
Add a link
Reference in a new issue