checking the result of actions, etc.
Change the stub command for check for available packages for Arch Linux. Checking and changing the locale for correct error handling by the server controller. Introduction of direct checking of package installation results. Check which containerization application will be installed. Checking of docker installation results and service or socket status.
This commit is contained in:
parent
762603f0ad
commit
f39b4ecdc4
1 changed files with 31 additions and 19 deletions
|
|
@ -1,29 +1,41 @@
|
|||
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="podman-docker"; 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 [ "$LANG" != "en_US.UTF-8" ] && [ "$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;\
|
||||
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 --assumeno install --setopt=tsflags=test $docker_pkg 2>&1 | grep -c podman-docker);\
|
||||
check_moby=$(sudo $pm --assumeno install --setopt=tsflags=test $docker_pkg 2>&1 | grep -c moby-engine);\
|
||||
if [ "$check_moby" != "0" ]; then echo "Docker is not supported"; docker; exit 1;\
|
||||
if [ "$(sudo $pm $what_pkg $docker_pkg 2>&1 | grep -c 'moby-engine')" != "0" ]; then echo "Docker is not supported"; exit 1;\
|
||||
else sudo $pm $silent_inst $docker_pkg;\
|
||||
if ! command -v docker > /dev/null 2>&1; then docker; exit 1;\
|
||||
elif [ "$check_podman" != "0" ]; then \
|
||||
sleep 5; sudo systemctl enable --now podman.socket; sleep 5;\
|
||||
sudo touch /etc/containers/nodocker;\
|
||||
sudo sed -i 's/short-name-mode = "enforcing"/short-name-mode = "permissive"/g' /etc/containers/registries.conf;\
|
||||
else sleep 5; sudo systemctl enable --now docker; sleep 5; fi;\
|
||||
elif [ "$(docker --version | grep -c 'podman')" != "0" ]; then check_service="podman.socket";\
|
||||
else check_service="docker"; fi;\
|
||||
sleep 5; sudo systemctl enable --now $check_service; sleep 5;\
|
||||
fi;\
|
||||
fi;\
|
||||
if [ "$(systemctl is-active podman.socket)" != "active" ]; then \
|
||||
if [ "$(docker --version | grep -c 'moby-engine')" != "0" ]; then echo "Docker is not supported"; exit 1;\
|
||||
elif [ "$(docker --version | grep -c 'podman')" != "0" ]; then \
|
||||
check_service="podman.socket"; docker_pkg="podman-docker";\
|
||||
sudo sed -i 's/short-name-mode = "enforcing"/short-name-mode = "permissive"/g' /etc/containers/registries.conf;\
|
||||
if [ "$(docker --version 2>&1 | grep -c '/etc/containers/nodocker')" != "0" ]; then sudo touch /etc/containers/nodocker; fi;\
|
||||
else check_service="docker"; fi;\
|
||||
if [ "$(systemctl is-active $check_service)" != "active" ]; then \
|
||||
sudo $pm $check_pkgs; sudo $pm $silent_inst $docker_pkg;\
|
||||
sleep 5; sudo systemctl start docker; sleep 5;\
|
||||
sleep 5; sudo systemctl start $check_service; sleep 5;\
|
||||
if [ "$(systemctl is-active $check_service)" != "active" ]; then echo "Failed to status docker"; exit 1; fi;\
|
||||
fi;\
|
||||
if ! command -v sudo > /dev/null 2>&1; then echo "Failed to install sudo, command not found"; exit 1; fi;\
|
||||
docker --version
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue