parent
f8b55eb017
commit
4c690dd3c6
6 changed files with 38 additions and 19 deletions
|
@ -238,11 +238,6 @@ ErrorCode ServerController::setupContainer(const ServerCredentials &credentials,
|
|||
e = isUserInSudo(credentials, container);
|
||||
if (e) return e;
|
||||
|
||||
if (!isUpdate) {
|
||||
e = isServerPortBusy(credentials, container, config);
|
||||
if (e) return e;
|
||||
}
|
||||
|
||||
e = isServerDpkgBusy(credentials, container);
|
||||
if (e) return e;
|
||||
|
||||
|
@ -250,6 +245,11 @@ ErrorCode ServerController::setupContainer(const ServerCredentials &credentials,
|
|||
if (e) return e;
|
||||
qDebug().noquote() << "ServerController::setupContainer installDockerWorker finished";
|
||||
|
||||
if (!isUpdate) {
|
||||
e = isServerPortBusy(credentials, container, config);
|
||||
if (e) return e;
|
||||
}
|
||||
|
||||
e = prepareHostWorker(credentials, container, config);
|
||||
if (e) return e;
|
||||
qDebug().noquote() << "ServerController::setupContainer prepareHostWorker finished";
|
||||
|
@ -368,6 +368,7 @@ ErrorCode ServerController::installDockerWorker(const ServerCredentials &credent
|
|||
replaceVars(amnezia::scriptData(SharedScriptType::install_docker),
|
||||
genVarsForScript(credentials)), cbReadStdOut, cbReadStdErr);
|
||||
|
||||
qDebug().noquote() << "ServerController::installDockerWorker" << stdOut;
|
||||
if (stdOut.contains("command not found")) return ErrorCode::ServerDockerFailedError;
|
||||
|
||||
return error;
|
||||
|
@ -635,7 +636,7 @@ ErrorCode ServerController::isServerPortBusy(const ServerCredentials &credential
|
|||
QString defaultTransportProto = ProtocolProps::transportProtoToString(ProtocolProps::defaultTransportProto(protocol), protocol);
|
||||
QString transportProto = containerConfig.value(config_key::transport_proto).toString(defaultTransportProto);
|
||||
|
||||
QString script = QString("sudo lsof -i -P -n | grep -E ':%1 ").arg(port);
|
||||
QString script = QString("which lsof &>/dev/null || true && sudo lsof -i -P -n | grep -E ':%1 ").arg(port);
|
||||
for (auto &port : fixedPorts) {
|
||||
script = script.append("|:%1").arg(port);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue