setup-php/src/scripts/extensions/couchbase.sh

44 lines
1.5 KiB
Bash
Raw Normal View History

2020-11-16 19:35:08 +07:00
# Function to install libraries required by couchbase
add_couchbase_libs() {
if [ "$(uname -s)" = "Linux" ]; then
trunk="https://github.com/couchbase/libcouchbase/releases"
if [[ ${version:?} =~ 5.[3-6]|7.[0-1] ]]; then
release="2.10.9"
2020-11-16 19:35:08 +07:00
else
release="$(curl -sL $trunk/latest | grep -Eo "libcouchbase-[0-9]+\.[0-9]+\.[0-9]+" | head -n 1 | cut -d'-' -f 2)"
2020-11-16 19:35:08 +07:00
fi
deb_url="$trunk/download/$release/libcouchbase-${release}_ubuntu${VERSION_ID/./}_${VERSION_CODENAME}_amd64.tar"
get -q -n /tmp/libcouchbase.tar "$deb_url"
sudo tar -xf /tmp/libcouchbase.tar -C /tmp
install_packages libev4 libevent-dev
sudo dpkg -i /tmp/libcouchbase-*/*.deb
2020-11-16 19:35:08 +07:00
else
if [[ ${version:?} =~ 5.[3-6]|7.[0-1] ]]; then
2020-11-16 19:35:08 +07:00
brew install libcouchbase@2
brew link --overwrite --force libcouchbase@2
else
brew install libcouchbase
fi
fi
}
# Function to add couchbase.
add_couchbase() {
add_couchbase_libs >/dev/null 2>&1
enable_extension "couchbase" "extension"
if check_extension "couchbase"; then
add_log "${tick:?}" "couchbase" "Enabled"
else
if [[ "${version:?}" =~ ${old_versions:?} ]]; then
pecl_install couchbase-2.2.3 >/dev/null 2>&1
elif [[ "${version:?}" =~ 5.6|7.[0-1] ]]; then
2020-11-16 19:35:08 +07:00
pecl_install couchbase-2.6.2 >/dev/null 2>&1
elif [[ "${version:?}" =~ 7.2 ]]; then
2020-12-17 17:59:01 +07:00
pecl_install couchbase-3.0.4 >/dev/null 2>&1
2020-11-16 19:35:08 +07:00
else
pecl_install couchbase >/dev/null 2>&1
fi
add_extension_log "couchbase" "Installed and enabled"
fi
}