Checking docker status
Checking Docker activity. Checking and changing locale. Changing "command not found" handling for sh compatibility.
This commit is contained in:
parent
8331b9ea52
commit
5c494fa743
4 changed files with 9 additions and 2 deletions
|
@ -411,7 +411,9 @@ ErrorCode ServerController::installDockerWorker(const ServerCredentials &credent
|
|||
return ErrorCode::ServerPacketManagerError;
|
||||
if (stdOut.contains("Podman is not supported"))
|
||||
return ErrorCode::ServerPodmanIsNotSupported;
|
||||
if (stdOut.contains("command not found"))
|
||||
if (stdOut.contains("Status Docker is not active"))
|
||||
return ErrorCode::ServerDockerStatusIsNotActive;
|
||||
if (stdOut.contains("sudo:") && stdOut.contains("not found"))
|
||||
return ErrorCode::ServerDockerFailedError;
|
||||
|
||||
return error;
|
||||
|
|
|
@ -59,6 +59,7 @@ namespace amnezia
|
|||
ServerUserNotAllowedInSudoers = 209,
|
||||
ServerUserPasswordRequired = 210,
|
||||
ServerPodmanIsNotSupported = 211,
|
||||
ServerDockerStatusIsNotActive = 212,
|
||||
|
||||
// Ssh connection errors
|
||||
SshRequestDeniedError = 300,
|
||||
|
|
|
@ -27,6 +27,7 @@ QString errorString(ErrorCode code) {
|
|||
case(ErrorCode::ServerUserNotAllowedInSudoers): errorMessage = QObject::tr("Action not allowed in sudoers"); break;
|
||||
case(ErrorCode::ServerUserPasswordRequired): errorMessage = QObject::tr("The user's password is required"); break;
|
||||
case(ErrorCode::ServerPodmanIsNotSupported): errorMessage = QObject::tr("Server error: podman-docker is not supported"); break;
|
||||
case(ErrorCode::ServerDockerStatusIsNotActive): errorMessage = QObject::tr("Server error: Docker status is not active"); break;
|
||||
|
||||
// Libssh errors
|
||||
case(ErrorCode::SshRequestDeniedError): errorMessage = QObject::tr("SSH request was denied"); break;
|
||||
|
|
|
@ -4,6 +4,7 @@ elif which yum > /dev/null 2>&1; then pm=$(which yum); silent_inst="-y -q instal
|
|||
elif which pacman > /dev/null 2>&1; then pm=$(which pacman); silent_inst="-S --noconfirm --noprogressbar --quiet"; check_pkgs="-Sup"; what_pkg="-Sp"; docker_pkg="docker"; dist="archlinux";\
|
||||
else echo "Packet manager not found"; exit 1; fi;\
|
||||
echo "Dist: $dist, Packet manager: $pm, Install command: $silent_inst, Check pkgs command: $check_pkgs, What pkg command: $what_pkg, Docker pkg: $docker_pkg";\
|
||||
echo $LANG | grep -qE '^(en_US.UTF-8|C.UTF-8|C)$' || export LC_ALL=C;\
|
||||
if [ "$dist" = "debian" ]; then export DEBIAN_FRONTEND=noninteractive; fi;\
|
||||
if ! command -v sudo > /dev/null 2>&1; then $pm $check_pkgs; $pm $silent_inst sudo; fi;\
|
||||
if ! command -v fuser > /dev/null 2>&1; then sudo $pm $check_pkgs; sudo $pm $silent_inst psmisc; fi;\
|
||||
|
@ -27,8 +28,10 @@ if [ "$(systemctl is-active docker)" != "active" ]; then \
|
|||
then sudo $pm $silent_inst $docker_pkg;\
|
||||
fi;\
|
||||
sleep 5; sudo systemctl start docker; sleep 5;\
|
||||
if [ "$(systemctl is-active docker)" != "active" ];\
|
||||
then echo "Status Docker is not active";\
|
||||
fi;\
|
||||
else echo "Podman is not supported";\
|
||||
fi;\
|
||||
fi;\
|
||||
if ! command -v sudo > /dev/null 2>&1; then echo "Failed to install sudo, command not found"; exit 1; fi;\
|
||||
sudo docker --version
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue