|
@@ -66,6 +66,38 @@ function install_docker() {
|
|
fi
|
|
fi
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+function update_docker() {
|
|
|
|
+ local os="${1}"
|
|
|
|
+ echo "Updating Docker for os ${os}" >/dev/tty
|
|
|
|
+
|
|
|
|
+ if [[ "${os}" == "debian" ]]; then
|
|
|
|
+ sudo apt-get update
|
|
|
|
+ sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
|
|
|
|
+ return 0
|
|
|
|
+ elif [[ "${os}" == "ubuntu" || "${os}" == "pop" ]]; then
|
|
|
|
+ sudo apt-get update
|
|
|
|
+ sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
|
|
|
|
+ return 0
|
|
|
|
+ elif [[ "${os}" == "centos" ]]; then
|
|
|
|
+ sudo yum install -y --allowerasing docker-ce docker-ce-cli containerd.io docker-compose-plugin
|
|
|
|
+ return 0
|
|
|
|
+ elif [[ "${os}" == "fedora" ]]; then
|
|
|
|
+ sudo dnf -y install docker-ce docker-ce-cli containerd.io docker-compose-plugin
|
|
|
|
+ return 0
|
|
|
|
+ elif [[ "${os}" == "arch" ]]; then
|
|
|
|
+ sudo pacman -Sy --noconfirm docker docker-compose
|
|
|
|
+
|
|
|
|
+ if ! command -v crontab >/dev/null; then
|
|
|
|
+ sudo pacman -Sy --noconfirm cronie
|
|
|
|
+ systemctl enable --now cronie.service
|
|
|
|
+ fi
|
|
|
|
+
|
|
|
|
+ return 0
|
|
|
|
+ else
|
|
|
|
+ return 1
|
|
|
|
+ fi
|
|
|
|
+}
|
|
|
|
+
|
|
function install_jq() {
|
|
function install_jq() {
|
|
local os="${1}"
|
|
local os="${1}"
|
|
echo "Installing jq for os ${os}" >/dev/tty
|
|
echo "Installing jq for os ${os}" >/dev/tty
|
|
@@ -92,20 +124,37 @@ OS="$(cat /etc/[A-Za-z]*[_-][rv]e[lr]* | grep "^ID=" | cut -d= -f2 | uniq | tr '
|
|
SUB_OS="$(cat /etc/[A-Za-z]*[_-][rv]e[lr]* | grep "^ID_LIKE=" | cut -d= -f2 | uniq | tr '[:upper:]' '[:lower:]' | tr -d '"')"
|
|
SUB_OS="$(cat /etc/[A-Za-z]*[_-][rv]e[lr]* | grep "^ID_LIKE=" | cut -d= -f2 | uniq | tr '[:upper:]' '[:lower:]' | tr -d '"')"
|
|
|
|
|
|
if command -v docker >/dev/null; then
|
|
if command -v docker >/dev/null; then
|
|
- echo "Docker is already installed"
|
|
|
|
|
|
+ echo "Docker is already installed, ensuring Docker is fully up to date"
|
|
|
|
+
|
|
|
|
+ update_docker "${OS}"
|
|
|
|
+ docker_result=$?
|
|
|
|
+
|
|
|
|
+ if [[ docker_result -eq 0 ]]; then
|
|
|
|
+ echo "Docker is fully up to date"
|
|
|
|
+ else
|
|
|
|
+ echo "Your system ${OS} is not supported trying with sub_os ${SUB_OS}"
|
|
|
|
+ install_docker "${SUB_OS}"
|
|
|
|
+ docker_sub_result=$?
|
|
|
|
+
|
|
|
|
+ if [[ docker_sub_result -eq 0 ]]; then
|
|
|
|
+ echo "Docker is fully up to date"
|
|
|
|
+ else
|
|
|
|
+ echo "Your system ${SUB_OS} is not supported please update Docker manually"
|
|
|
|
+ exit 1
|
|
|
|
+ fi
|
|
else
|
|
else
|
|
install_docker "${OS}"
|
|
install_docker "${OS}"
|
|
docker_result=$?
|
|
docker_result=$?
|
|
|
|
|
|
if [[ docker_result -eq 0 ]]; then
|
|
if [[ docker_result -eq 0 ]]; then
|
|
- echo "docker installed"
|
|
|
|
|
|
+ echo "Docker installed"
|
|
else
|
|
else
|
|
echo "Your system ${OS} is not supported trying with sub_os ${SUB_OS}"
|
|
echo "Your system ${OS} is not supported trying with sub_os ${SUB_OS}"
|
|
install_docker "${SUB_OS}"
|
|
install_docker "${SUB_OS}"
|
|
docker_sub_result=$?
|
|
docker_sub_result=$?
|
|
|
|
|
|
if [[ docker_sub_result -eq 0 ]]; then
|
|
if [[ docker_sub_result -eq 0 ]]; then
|
|
- echo "docker installed"
|
|
|
|
|
|
+ echo "Docker installed"
|
|
else
|
|
else
|
|
echo "Your system ${SUB_OS} is not supported please install docker manually"
|
|
echo "Your system ${SUB_OS} is not supported please install docker manually"
|
|
exit 1
|
|
exit 1
|
|
@@ -113,11 +162,6 @@ else
|
|
fi
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
|
|
-if ! command -v docker-compose >/dev/null; then
|
|
|
|
- sudo curl -L "https://github.com/docker/compose/releases/download/v2.3.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
|
|
|
|
- sudo chmod +x /usr/local/bin/docker-compose
|
|
|
|
-fi
|
|
|
|
-
|
|
|
|
if ! command -v jq >/dev/null; then
|
|
if ! command -v jq >/dev/null; then
|
|
install_jq "${OS}"
|
|
install_jq "${OS}"
|
|
jq_result=$?
|
|
jq_result=$?
|