👌 IMPORVE(SCRIPT/INSTALL): Support Archlinux

This commit is contained in:
= 2024-02-16 01:56:16 +03:00
parent 6ddff8fae1
commit e3e8fe7895

View File

@ -11,7 +11,13 @@ DOCKER_VERSION="24.0"
CDN="https://cdn.coollabs.io/coolify" CDN="https://cdn.coollabs.io/coolify"
OS_TYPE=$(grep -w "ID" /etc/os-release | cut -d "=" -f 2 | tr -d '"') OS_TYPE=$(grep -w "ID" /etc/os-release | cut -d "=" -f 2 | tr -d '"')
OS_VERSION=$(grep -w "VERSION_ID" /etc/os-release | cut -d "=" -f 2 | tr -d '"')
if [ "$OS_TYPE" = "arch" ]; then
OS_VERSION="rolling"
else
OS_VERSION=$(grep -w "VERSION_ID" /etc/os-release | cut -d "=" -f 2 | tr -d '"')
fi
LATEST_VERSION=$(curl --silent $CDN/versions.json | grep -i version | sed -n '2p' | xargs | awk '{print $2}' | tr -d ',') LATEST_VERSION=$(curl --silent $CDN/versions.json | grep -i version | sed -n '2p' | xargs | awk '{print $2}' | tr -d ',')
DATE=$(date +"%Y%m%d-%H%M%S") DATE=$(date +"%Y%m%d-%H%M%S")
@ -21,11 +27,11 @@ if [ $EUID != 0 ]; then
fi fi
case "$OS_TYPE" in case "$OS_TYPE" in
ubuntu | debian | raspbian | centos | fedora | rhel | ol | rocky | sles | opensuse-leap | opensuse-tumbleweed) ;; arch | ubuntu | debian | raspbian | centos | fedora | rhel | ol | rocky | sles | opensuse-leap | opensuse-tumbleweed) ;;
*) *)
echo "This script only supports Debian, Redhat or Sles based operating systems for now." echo "This script only supports Debian, Redhat, Arch Linux, or SLES based operating systems for now."
exit exit
;; ;;
esac esac
# Overwrite LATEST_VERSION if user pass a version number # Overwrite LATEST_VERSION if user pass a version number
@ -48,21 +54,27 @@ echo -e "-------------"
echo "Installing required packages..." echo "Installing required packages..."
case "$OS_TYPE" in case "$OS_TYPE" in
ubuntu | debian | raspbian) arch)
apt update -y >/dev/null 2>&1 pacman -Sy >/dev/null 2>&1 || true
apt install -y curl wget git jq >/dev/null 2>&1 if ! pacman -Q curl wget git jq >/dev/null 2>&1; then
;; pacman -S --noconfirm curl wget git jq >/dev/null 2>&1 || true
centos | fedora | rhel | ol | rocky) fi
dnf install -y curl wget git jq >/dev/null 2>&1 ;;
;; ubuntu | debian | raspbian)
sles | opensuse-leap | opensuse-tumbleweed) apt update -y >/dev/null 2>&1
zypper refresh >/dev/null 2>&1 apt install -y curl wget git jq >/dev/null 2>&1
zypper install -y curl wget git jq >/dev/null 2>&1 ;;
;; centos | fedora | rhel | ol | rocky)
*) dnf install -y curl wget git jq >/dev/null 2>&1
echo "This script only supports Debian, Redhat or Sles based operating systems for now." ;;
exit sles | opensuse-leap | opensuse-tumbleweed)
;; zypper refresh >/dev/null 2>&1
zypper install -y curl wget git jq >/dev/null 2>&1
;;
*)
echo "This script only supports Debian, Redhat, Arch Linux, or SLES based operating systems for now."
exit
;;
esac esac
# Detect OpenSSH server # Detect OpenSSH server
@ -105,22 +117,35 @@ fi
if ! [ -x "$(command -v docker)" ]; then if ! [ -x "$(command -v docker)" ]; then
echo "Docker is not installed. Installing Docker." echo "Docker is not installed. Installing Docker."
curl https://releases.rancher.com/install-docker/${DOCKER_VERSION}.sh | sh if [ "$OS_TYPE" = "arch" ]; then
if [ -x "$(command -v docker)" ]; then pacman -Sy docker docker-compose --noconfirm
echo "Docker installed successfully." systemctl enable docker.service
else
echo "Docker installation failed with Rancher script. Trying with official script."
curl https://get.docker.com | sh -s -- --version ${DOCKER_VERSION}
if [ -x "$(command -v docker)" ]; then if [ -x "$(command -v docker)" ]; then
echo "Docker installed successfully." echo "Docker installed successfully."
else else
echo "Docker installation failed with official script." echo "Failed to install Docker with Rancher script. Trying to install with AUR."
echo "Maybe your OS is not supported." echo "Please visit https://wiki.archlinux.org/title/docker for more information."
echo "Please visit https://docs.docker.com/engine/install/ and install Docker manually to continue." exit
exit 1 fi
else
curl https://releases.rancher.com/install-docker/${DOCKER_VERSION}.sh | sh
if [ -x "$(command -v docker)" ]; then
echo "Docker installed successfully."
else
echo "Docker installation failed with Rancher script. Trying with official script."
curl https://get.docker.com | sh -s -- --version ${DOCKER_VERSION}
if [ -x "$(command -v docker)" ]; then
echo "Docker installed successfully."
else
echo "Docker installation failed with official script."
echo "Maybe your OS is not supported."
echo "Please visit https://docs.docker.com/engine/install/ and install Docker manually to continue."
exit 1
fi
fi fi
fi fi
fi fi
echo -e "-------------" echo -e "-------------"
echo -e "Check Docker Configuration..." echo -e "Check Docker Configuration..."
mkdir -p /etc/docker mkdir -p /etc/docker