123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 |
- #!/bin/sh
- if [ -e /etc/os-release ]; then
- . /etc/os-release
- elif [ -e /usr/lib/os-release ]; then
- . /usr/lib/os-release
- else
- echo "Unsupported Linux system"
- exit 2
- fi
- repo_base_url="https://download.opensuse.org/repositories/devel:/languages:/crystal/"
- repo_end_url="devel:languages:crystal.repo"
- apt_gpg_key="/usr/share/keyrings/crystal.gpg"
- apt_list_file="/etc/apt/sources.list.d/crystal.list"
- yum_repo_file="/etc/yum.repos.d/crystal.repo"
- make_repo_url() {
- echo "${repo_base_url}/${1}/${repo_end_url}"
- }
- install_apt() {
- repo="$1"
- echo "Adding Crystal repository"
- curl -fsSL "${repo_base_url}/${repo}/Release.key" \
- | gpg --dearmor \
- | sudo tee "${apt_gpg_key}" > /dev/null
- echo "deb [signed-by=${apt_gpg_key}] ${repo_base_url}/${repo}/ /" \
- | sudo tee "$apt_list_file"
- sudo apt-get update
- sudo apt-get install --yes --no-install-recommends \
- libssl-dev libxml2-dev libyaml-dev libgmp-dev libevent-dev \
- libpcre3-dev libreadline-dev libsqlite3-dev zlib1g-dev \
- crystal postgresql-13 git librsvg2-bin make
- }
- install_yum() {
- repo=$(make_repo_url "$1")
- echo "Adding Crystal repository"
- cat << END | sudo tee "${yum_repo_file}" > /dev/null
- [crystal]
- name=Crystal
- type=rpm-md
- baseurl=${repo}/
- gpgcheck=1
- gpgkey=${repo}/repodata/repomd.xml.key
- enabled=1
- END
- sudo yum -y install \
- openssl-devel libxml2-devel libyaml-devel gmp-devel \
- readline-devel sqlite-devel \
- crystal postgresql postgresql-server git librsvg2-tools make
- }
- install_pacman() {
-
- sudo pacman -S --no-confirm \
- base-devel librsvg postgresql crystal
- }
- install_zypper()
- {
- repo=$(make_repo_url "$1")
- echo "Adding Crystal repository"
- sudo zypper --non-interactive addrepo -f "$repo"
- sudo zypper --non-interactive --gpg-auto-import-keys install --no-recommends \
- libopenssl-devel libxml2-devel libyaml-devel gmp-devel libevent-devel \
- pcre-devel readline-devel sqlite3-devel zlib-devel \
- crystal postgresql postgresql-server git rsvg-convert make
- }
- case "$ID" in
- archlinux) install_pacman;;
- centos) install_dnf "CentOS_${VERSION_ID}";;
- debian)
- case "$VERSION_CODENAME" in
- sid) install_apt "Debian_Unstable";;
- bookworm) install_apt "Debian_Testing";;
- *) install_apt "Debian_${VERSION_ID}";;
- esac
- ;;
- fedora)
- if [ "$VERSION" == *"Prerelease"* ]; then
- install_dnf "Fedora_Rawhide"
- else
- install_dnf "Fedora_${VERSION}"
- fi
- ;;
- opensuse-leap) install_zypper "openSUSE_Leap_${VERSION}";;
- opensuse-tumbleweed) install_zypper "openSUSE_Tumbleweed";;
- rhel) install_dnf "RHEL_${VERSION_ID}";;
- ubuntu)
-
- case "$VERSION_ID" in
- 22.04) install_apt "xUbuntu_21.04";;
- *) install_apt "xUbuntu_${VERSION_ID}";;
- esac
- ;;
- *)
-
-
- case "$ID_LIKE" in
- archlinux) install_pacman;;
- centos) install_dnf "CentOS_${VERSION_ID}";;
- debian) install_apt "Debian_${VERSION_ID}";;
- *)
- echo "Error: distribution ${CODENAME} is not supported"
- echo "Please install dependencies manually"
- exit 2
- ;;
- esac
- ;;
- esac
|