Another way to check the service status.

This commit is contained in:
lunardunno
2026-04-26 03:42:25 +04:00
committed by GitHub
parent 848e4d7c6f
commit dfc615c36a
+3 -2
View File
@@ -3,7 +3,8 @@ elif which dnf > /dev/null 2>&1; then pm=$(which dnf); silent_inst="-yq install"
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 zypper > /dev/null 2>&1; then pm=$(which zypper); silent_inst="-nq install"; check_pkgs="-nq refresh"; docker_pkg="docker"; dist="opensuse";\
elif which pacman > /dev/null 2>&1; then pm=$(which pacman); silent_inst="-S --noconfirm --noprogressbar --quiet"; check_pkgs="-Sup"; docker_pkg="docker"; dist="archlinux";\
elif which apk > /dev/null 2>&1; then pm=$(which apk); silent_inst="add --no-cache"; check_pkgs="update"; docker_pkg="docker dockerd"; dist="alpine";\
elif which apk > /dev/null 2>&1; then pm=$(which apk); silent_inst="add"; check_pkgs="update"; docker_pkg="docker dockerd"; dist="alpine";\
elif which opkg > /dev/null 2>&1; then pm=$(which opkg); silent_inst="install"; check_pkgs="update"; docker_pkg="docker dockerd"; dist="entware";\
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;\
@@ -17,7 +18,7 @@ fi;\
if [ "$(cat /sys/module/apparmor/parameters/enabled 2>/dev/null)" = "Y" ]; then \
if ! command -v apparmor_parser > /dev/null 2>&1; then sudo $pm $check_pkgs; sudo $pm $silent_inst apparmor; fi;\
fi;\
if [ "$(systemctl is-active docker)" != "active" ]; then \
if [ "$(ls /var/run/docker.sock)" != "/var/run/docker.sock" ]; then \
sudo $pm $check_pkgs; sudo $pm $silent_inst $docker_pkg;\
sleep 5; sudo systemctl start docker; sleep 5;\
fi;\