From 1028f6998f25066f04b182929e8b711886d260e4 Mon Sep 17 00:00:00 2001 From: lunardunno <126363523+lunardunno@users.noreply.github.com> Date: Mon, 12 Feb 2024 06:18:59 +0400 Subject: [PATCH 1/7] docker-ce support Implementation of docker-ce support, for Fedora and CentOS --- client/server_scripts/install_docker.sh | 28 +++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/client/server_scripts/install_docker.sh b/client/server_scripts/install_docker.sh index 6fed78c0d..f479c14ae 100644 --- a/client/server_scripts/install_docker.sh +++ b/client/server_scripts/install_docker.sh @@ -8,12 +8,32 @@ 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;\ if ! command -v lsof > /dev/null 2>&1; then sudo $pm $check_pkgs; sudo $pm $silent_inst lsof; fi;\ -if ! command -v docker > /dev/null 2>&1; then \ - sudo $pm $check_pkgs; sudo $pm $silent_inst $docker_pkg;\ +if ! command -v docker > /dev/null 2>&1; then sudo $pm $check_pkgs;\ + if [ "$dist" != "fedora" ]; then sudo $pm $silent_inst $docker_pkg;\ + else \ + check_podman=$(sudo $pm --assumeno install $docker_pkg 2>&1 | grep -c podman-docker);\ + check_moby=$(sudo $pm --assumeno install $docker_pkg 2>&1 | grep -c moby-engine);\ + if [ "$check_podman" != "0" ]; then \ + sudo $pm $silent_inst yum-utils;\ + sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo;\ + sudo $pm $silent_inst docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin;\ + elif [ "$check_moby" != "0" ]; then \ + sudo $pm $silent_inst dnf-plugins-core;\ + sudo $pm config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo;\ + sudo $pm $silent_inst docker-ce docker-ce-cli containerd.io;\ + sudo $pm $silent_inst docker-compose-plugin;\ + sudo $pm $silent_inst docker-buildx-plugin;\ + else sudo $pm $silent_inst $docker_pkg; fi;\ + fi;\ sleep 5; sudo systemctl enable --now docker; sleep 5;\ fi;\ -if [ "$(systemctl is-active docker)" != "active" ]; then \ - sudo $pm $check_pkgs; sudo $pm $silent_inst $docker_pkg;\ +if [ "$(systemctl is-active docker)" != "active" ]; then sudo $pm $check_pkgs;\ + if [ "$dist" != "fedora" ]; then sudo $pm $silent_inst $docker_pkg;\ + else \ + check_podman=$(sudo $pm --assumeno install $docker_pkg 2>&1 | grep -c podman-docker);\ + check_moby=$(sudo $pm --assumeno install $docker_pkg 2>&1 | grep -c moby-engine);\ + if [ "$check_podman" = "0" ] && [ "$check_moby" = "0" ]; then sudo $pm $silent_inst $docker_pkg; fi;\ + fi;\ sleep 5; sudo systemctl start docker; sleep 5;\ fi;\ if ! command -v sudo > /dev/null 2>&1; then echo "Failed to install sudo, command not found"; exit 1; fi;\ From 1226d1b287a853f0ffc410cdbd84bb215d647ea8 Mon Sep 17 00:00:00 2001 From: lunardunno <126363523+lunardunno@users.noreply.github.com> Date: Tue, 13 Feb 2024 17:25:36 +0400 Subject: [PATCH 2/7] Check moby and podman --- client/server_scripts/install_docker.sh | 41 ++++++++----------------- 1 file changed, 12 insertions(+), 29 deletions(-) diff --git a/client/server_scripts/install_docker.sh b/client/server_scripts/install_docker.sh index f479c14ae..4be5f863a 100644 --- a/client/server_scripts/install_docker.sh +++ b/client/server_scripts/install_docker.sh @@ -1,40 +1,23 @@ -if which apt-get > /dev/null 2>&1; then pm=$(which apt-get); silent_inst="-yq install"; check_pkgs="-yq update"; docker_pkg="docker.io"; dist="debian";\ -elif which dnf > /dev/null 2>&1; then pm=$(which dnf); silent_inst="-yq install"; check_pkgs="-yq check-update"; docker_pkg="docker"; dist="fedora";\ -elif which yum > /dev/null 2>&1; then pm=$(which yum); silent_inst="-y -q install"; check_pkgs="-y -q check-update"; docker_pkg="docker"; dist="centos";\ -elif which pacman > /dev/null 2>&1; then pm=$(which pacman); silent_inst="-S --noconfirm --noprogressbar --quiet"; check_pkgs="> /dev/null 2>&1"; docker_pkg="docker"; dist="archlinux";\ +if which apt-get > /dev/null 2>&1; then pm=$(which apt-get); silent_inst="-yq install"; check_pkgs="-yq update"; what_pkg="-s install"; docker_pkg="docker.io"; dist="debian";\ +elif which dnf > /dev/null 2>&1; then pm=$(which dnf); silent_inst="-yq install"; check_pkgs="-yq check-update"; what_pkg="--assumeno install --setopt=tsflags=test"; docker_pkg="docker"; dist="fedora";\ +elif which yum > /dev/null 2>&1; then pm=$(which yum); silent_inst="-y -q install"; check_pkgs="-y -q check-update"; what_pkg="--assumeno install --setopt=tsflags=test"; docker_pkg="docker"; dist="centos";\ +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, Docker pkg: $docker_pkg";\ +echo "Dist: $dist, Packet manager: $pm, Install command: $silent_inst, Check pkgs command: $check_pkgs, What pkg command: $what_pkg, Docker pkg: $docker_pkg";\ 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;\ if ! command -v lsof > /dev/null 2>&1; then sudo $pm $check_pkgs; sudo $pm $silent_inst lsof; fi;\ if ! command -v docker > /dev/null 2>&1; then sudo $pm $check_pkgs;\ - if [ "$dist" != "fedora" ]; then sudo $pm $silent_inst $docker_pkg;\ - else \ - check_podman=$(sudo $pm --assumeno install $docker_pkg 2>&1 | grep -c podman-docker);\ - check_moby=$(sudo $pm --assumeno install $docker_pkg 2>&1 | grep -c moby-engine);\ - if [ "$check_podman" != "0" ]; then \ - sudo $pm $silent_inst yum-utils;\ - sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo;\ - sudo $pm $silent_inst docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin;\ - elif [ "$check_moby" != "0" ]; then \ - sudo $pm $silent_inst dnf-plugins-core;\ - sudo $pm config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo;\ - sudo $pm $silent_inst docker-ce docker-ce-cli containerd.io;\ - sudo $pm $silent_inst docker-compose-plugin;\ - sudo $pm $silent_inst docker-buildx-plugin;\ - else sudo $pm $silent_inst $docker_pkg; fi;\ - fi;\ + check_podman=$(sudo $pm $what_pkg $docker_pkg 2>&1 | grep -c podman-docker);\ + check_moby=$(sudo $pm $what_pkg $docker_pkg 2>&1 | grep -c moby-engine);\ + if [ "$check_podman" != "0" ] | [ "$check_moby" != "0" ]; then echo "Container is not supported"; exit 1;\ + else sudo $pm $silent_inst $docker_pkg; fi;\ sleep 5; sudo systemctl enable --now docker; sleep 5;\ fi;\ -if [ "$(systemctl is-active docker)" != "active" ]; then sudo $pm $check_pkgs;\ - if [ "$dist" != "fedora" ]; then sudo $pm $silent_inst $docker_pkg;\ - else \ - check_podman=$(sudo $pm --assumeno install $docker_pkg 2>&1 | grep -c podman-docker);\ - check_moby=$(sudo $pm --assumeno install $docker_pkg 2>&1 | grep -c moby-engine);\ - if [ "$check_podman" = "0" ] && [ "$check_moby" = "0" ]; then sudo $pm $silent_inst $docker_pkg; fi;\ - fi;\ +if [ "$(systemctl is-active docker)" != "active" ]; then \ + sudo $pm $check_pkgs; sudo $pm $silent_inst $docker_pkg;\ sleep 5; sudo systemctl start docker; sleep 5;\ fi;\ -if ! command -v sudo > /dev/null 2>&1; then echo "Failed to install sudo, command not found"; exit 1; fi;\ +if ! command -v docker > /dev/null 2>&1; then echo "Failed to install docker, command not found"; exit 1; fi;\ docker --version From 11fef3c6538bcdbdc2d93f54a6643c60d03d7745 Mon Sep 17 00:00:00 2001 From: lunardunno <126363523+lunardunno@users.noreply.github.com> Date: Wed, 14 Feb 2024 03:39:07 +0400 Subject: [PATCH 3/7] checking of docker installation results --- client/server_scripts/install_docker.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/client/server_scripts/install_docker.sh b/client/server_scripts/install_docker.sh index 4be5f863a..77187997e 100644 --- a/client/server_scripts/install_docker.sh +++ b/client/server_scripts/install_docker.sh @@ -11,9 +11,11 @@ if ! command -v lsof > /dev/null 2>&1; then sudo $pm $check_pkgs; sudo $pm $sile if ! command -v docker > /dev/null 2>&1; then sudo $pm $check_pkgs;\ check_podman=$(sudo $pm $what_pkg $docker_pkg 2>&1 | grep -c podman-docker);\ check_moby=$(sudo $pm $what_pkg $docker_pkg 2>&1 | grep -c moby-engine);\ - if [ "$check_podman" != "0" ] | [ "$check_moby" != "0" ]; then echo "Container is not supported"; exit 1;\ - else sudo $pm $silent_inst $docker_pkg; fi;\ - sleep 5; sudo systemctl enable --now docker; sleep 5;\ + if [ "$check_podman" != "0" ] || [ "$check_moby" != "0" ]; then echo "Container is not supported"; exit 1;\ + else sudo $pm $silent_inst $docker_pkg;\ + if ! command -v docker > /dev/null 2>&1; then docker; exit 1;\ + else sleep 5; sudo systemctl enable --now docker; sleep 5; fi;\ + fi;\ fi;\ if [ "$(systemctl is-active docker)" != "active" ]; then \ sudo $pm $check_pkgs; sudo $pm $silent_inst $docker_pkg;\ From fc0a9fd74f9526f442ac8480ca15b5d445826b70 Mon Sep 17 00:00:00 2001 From: lunardunno <126363523+lunardunno@users.noreply.github.com> Date: Wed, 14 Feb 2024 03:46:03 +0400 Subject: [PATCH 4/7] check and change locale Checking and changing the locale for correct error handling by the server controller. --- client/server_scripts/install_docker.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/client/server_scripts/install_docker.sh b/client/server_scripts/install_docker.sh index 6fed78c0d..0e52d8fae 100644 --- a/client/server_scripts/install_docker.sh +++ b/client/server_scripts/install_docker.sh @@ -5,6 +5,18 @@ elif which pacman > /dev/null 2>&1; then pm=$(which pacman); silent_inst="-S --n else echo "Packet manager not found"; exit 1; fi;\ echo "Dist: $dist, Packet manager: $pm, Install command: $silent_inst, Check pkgs command: $check_pkgs, Docker pkg: $docker_pkg";\ if [ "$dist" = "debian" ]; then export DEBIAN_FRONTEND=noninteractive; fi;\ +CHECK_LOCALE=$(locale | grep -c 'LANG=en_US.UTF-8');\ +if [ "$CHECK_LOCALE" = "0" ]; then \ + CHECK_LOCALE=$(locale | grep -c 'LANG=C.UTF-8');\ + if [ "$CHECK_LOCALE" = "0" ]; then \ + CHECK_LOCALE=$(locale -a | grep -c 'en_US.utf8');\ + if [ "$CHECK_LOCALE" != "0" ]; then export LC_ALL=en_US.UTF-8;\ + else \ + CHECK_LOCALE=$(locale -a | grep 'C.utf8');\ + if [ "$CHECK_LOCALE" != "0" ]; then export LC_ALL=C.UTF-8; fi;\ + fi;\ + fi;\ +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;\ if ! command -v lsof > /dev/null 2>&1; then sudo $pm $check_pkgs; sudo $pm $silent_inst lsof; fi;\ From 03b5f84574ab1acd66395ed507850b23a61b4d51 Mon Sep 17 00:00:00 2001 From: lunardunno <126363523+lunardunno@users.noreply.github.com> Date: Wed, 14 Feb 2024 07:53:21 +0400 Subject: [PATCH 5/7] Introduction of direct checking of package installation results. (#591) Introduction of direct checking of package installation results. --- client/server_scripts/install_docker.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/client/server_scripts/install_docker.sh b/client/server_scripts/install_docker.sh index efad2167f..91ad02588 100644 --- a/client/server_scripts/install_docker.sh +++ b/client/server_scripts/install_docker.sh @@ -17,9 +17,15 @@ if [ "$CHECK_LOCALE" = "0" ]; then \ fi;\ fi;\ 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;\ -if ! command -v lsof > /dev/null 2>&1; then sudo $pm $check_pkgs; sudo $pm $silent_inst lsof; fi;\ +if ! command -v sudo > /dev/null 2>&1; then $pm $check_pkgs; $pm $silent_inst sudo;\ + if ! command -v sudo > /dev/null 2>&1; then sudo; exit 1; fi;\ +fi;\ +if ! command -v fuser > /dev/null 2>&1; then sudo $pm $check_pkgs; sudo $pm $silent_inst psmisc;\ + if ! command -v fuser > /dev/null 2>&1; then fuser; exit 1; fi;\ +fi;\ +if ! command -v lsof > /dev/null 2>&1; then sudo $pm $check_pkgs; sudo $pm $silent_inst lsof;\ + if ! command -v lsof > /dev/null 2>&1; then lsof; exit 1; fi;\ +fi;\ if ! command -v docker > /dev/null 2>&1; then sudo $pm $check_pkgs;\ check_podman=$(sudo $pm $what_pkg $docker_pkg 2>&1 | grep -c podman-docker);\ check_moby=$(sudo $pm $what_pkg $docker_pkg 2>&1 | grep -c moby-engine);\ From cc8ce440a890c73c4b288a5fdfa94ba29a01d962 Mon Sep 17 00:00:00 2001 From: lunardunno <126363523+lunardunno@users.noreply.github.com> Date: Wed, 14 Feb 2024 09:45:46 +0400 Subject: [PATCH 6/7] locale check simplified --- client/server_scripts/install_docker.sh | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/client/server_scripts/install_docker.sh b/client/server_scripts/install_docker.sh index 91ad02588..225ca2b3f 100644 --- a/client/server_scripts/install_docker.sh +++ b/client/server_scripts/install_docker.sh @@ -5,16 +5,12 @@ elif which pacman > /dev/null 2>&1; then pm=$(which pacman); silent_inst="-S --n 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";\ if [ "$dist" = "debian" ]; then export DEBIAN_FRONTEND=noninteractive; fi;\ -CHECK_LOCALE=$(locale | grep -c 'LANG=en_US.UTF-8');\ -if [ "$CHECK_LOCALE" = "0" ]; then \ - CHECK_LOCALE=$(locale | grep -c 'LANG=C.UTF-8');\ - if [ "$CHECK_LOCALE" = "0" ]; then \ - CHECK_LOCALE=$(locale -a | grep -c 'en_US.utf8');\ - if [ "$CHECK_LOCALE" != "0" ]; then export LC_ALL=en_US.UTF-8;\ - else \ - CHECK_LOCALE=$(locale -a | grep 'C.utf8');\ - if [ "$CHECK_LOCALE" != "0" ]; then export LC_ALL=C.UTF-8; fi;\ - fi;\ +if [ "$(echo $LANG)" != "en_US.UTF-8" ] || [ "$(echo $LANG)" != "C.UTF-8" ]; then \ + CHECK_LOCALES=$(locale -a | grep -c 'en_US.utf8');\ + if [ "$CHECK_LOCALES" != "0" ]; then export LC_ALL=en_US.UTF-8;\ + else \ + CHECK_LOCALES=$(locale -a | grep 'C.utf8');\ + if [ "$CHECK_LOCALES" != "0" ]; then export LC_ALL=C.UTF-8; fi;\ fi;\ fi;\ if ! command -v sudo > /dev/null 2>&1; then $pm $check_pkgs; $pm $silent_inst sudo;\ From 6dceb3df5423e1e2076905b7c4ee1483df600952 Mon Sep 17 00:00:00 2001 From: lunardunno <126363523+lunardunno@users.noreply.github.com> Date: Thu, 15 Feb 2024 01:22:15 +0400 Subject: [PATCH 7/7] force C.UTF-8 assignment Force C.UTF-8 if the system language is other than en_US. Temporary simplification of script stopping for moby and podman. Stop script execution if Docker is not active. --- client/server_scripts/install_docker.sh | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/client/server_scripts/install_docker.sh b/client/server_scripts/install_docker.sh index 225ca2b3f..c19b853f2 100644 --- a/client/server_scripts/install_docker.sh +++ b/client/server_scripts/install_docker.sh @@ -5,13 +5,9 @@ elif which pacman > /dev/null 2>&1; then pm=$(which pacman); silent_inst="-S --n 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";\ if [ "$dist" = "debian" ]; then export DEBIAN_FRONTEND=noninteractive; fi;\ -if [ "$(echo $LANG)" != "en_US.UTF-8" ] || [ "$(echo $LANG)" != "C.UTF-8" ]; then \ - CHECK_LOCALES=$(locale -a | grep -c 'en_US.utf8');\ - if [ "$CHECK_LOCALES" != "0" ]; then export LC_ALL=en_US.UTF-8;\ - else \ - CHECK_LOCALES=$(locale -a | grep 'C.utf8');\ - if [ "$CHECK_LOCALES" != "0" ]; then export LC_ALL=C.UTF-8; fi;\ - fi;\ +if [ "$(echo $LANG)" != "en_US.UTF-8" ] && [ "$(echo $LANG)" != "C.UTF-8" ]; then \ + if [ "$(locale -a | grep -c 'en_US.utf8')" != "0" ]; then export LC_ALL=en_US.UTF-8;\ + else export LC_ALL=C.UTF-8; fi;\ fi;\ if ! command -v sudo > /dev/null 2>&1; then $pm $check_pkgs; $pm $silent_inst sudo;\ if ! command -v sudo > /dev/null 2>&1; then sudo; exit 1; fi;\ @@ -25,7 +21,7 @@ fi;\ if ! command -v docker > /dev/null 2>&1; then sudo $pm $check_pkgs;\ check_podman=$(sudo $pm $what_pkg $docker_pkg 2>&1 | grep -c podman-docker);\ check_moby=$(sudo $pm $what_pkg $docker_pkg 2>&1 | grep -c moby-engine);\ - if [ "$check_podman" != "0" ] || [ "$check_moby" != "0" ]; then echo "Container is not supported"; exit 1;\ + if [ "$check_podman" != "0" ] || [ "$check_moby" != "0" ]; then echo "Docker is not supported"; docker; exit 1;\ else sudo $pm $silent_inst $docker_pkg;\ if ! command -v docker > /dev/null 2>&1; then docker; exit 1;\ else sleep 5; sudo systemctl enable --now docker; sleep 5; fi;\ @@ -34,6 +30,6 @@ fi;\ if [ "$(systemctl is-active docker)" != "active" ]; then \ sudo $pm $check_pkgs; sudo $pm $silent_inst $docker_pkg;\ sleep 5; sudo systemctl start docker; sleep 5;\ + if [ "$(systemctl is-active docker)" != "active" ]; then echo "Failed to status docker, command not found"; fi;\ fi;\ -if ! command -v docker > /dev/null 2>&1; then echo "Failed to install docker, command not found"; exit 1; fi;\ docker --version