Skip to content

Commit

Permalink
refactor(sh): check docker if installed
Browse files Browse the repository at this point in the history
  • Loading branch information
szymonos committed Oct 2, 2023
1 parent 4fff514 commit 33a435f
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion .assets/provision/install_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,27 @@ fi

# determine system id
SYS_ID="$(sed -En '/^ID.*(alpine|arch|fedora|debian|ubuntu|opensuse).*/{s//\1/;p;q}' /etc/os-release)"

# check if package installed already using package manager
case $SYS_ID in
alpine)
exit 0
;;
arch)
pacman -Qqe docker &>/dev/null && exit 0 || true
;;
fedora)
rpm -q docker-ce &>/dev/null && exit 0 || true
;;
debian | ubuntu)
dpkg -s docker-ce &>/dev/null && exit 0 || true
;;
opensuse)
rpm -q docker &>/dev/null && exit 0 || true
;;
esac

# install docker
case $SYS_ID in
arch)
pacman -Sy --needed --noconfirm docker docker-compose
;;
Expand Down

0 comments on commit 33a435f

Please sign in to comment.