2020-11-16 19:35:08 +07:00
|
|
|
# Function to install libraries required by couchbase
|
|
|
|
add_couchbase_libs() {
|
|
|
|
if [ "$(uname -s)" = "Linux" ]; then
|
2021-02-22 20:10:19 +07:00
|
|
|
if [[ ${version:?} =~ 5.[3-6]|7.[0-1] ]]; then
|
2021-03-06 04:18:36 +07:00
|
|
|
release="2.10.9"
|
|
|
|
trunk="https://github.com/couchbase/libcouchbase/releases/download"
|
|
|
|
package="libcouchbase-${release}_ubuntu${DISTRIB_RELEASE/./}_${DISTRIB_CODENAME}_amd64.tar"
|
|
|
|
get -q -n /tmp/libcouchbase.tar "$trunk/$release/$package"
|
|
|
|
sudo tar -xf /tmp/libcouchbase.tar -C /tmp
|
|
|
|
install_packages libev4
|
|
|
|
sudo dpkg -i /tmp/libcouchbase-*/*.deb
|
2020-11-16 19:35:08 +07:00
|
|
|
else
|
|
|
|
trunk="http://packages.couchbase.com/clients/c/repos/deb"
|
|
|
|
list="deb $trunk/ubuntu${DISTRIB_RELEASE/./} ${DISTRIB_CODENAME:?} ${DISTRIB_CODENAME:?}/main"
|
2021-03-06 04:18:36 +07:00
|
|
|
get -s -n "" "$trunk/couchbase.key" | sudo apt-key add
|
|
|
|
echo "$list" | sudo tee /etc/apt/sources.list.d/couchbase.list
|
|
|
|
sudo apt-get update
|
2020-11-16 19:35:08 +07:00
|
|
|
fi
|
|
|
|
${apt_install:?} libcouchbase-dev
|
|
|
|
else
|
2021-02-22 20:10:19 +07:00
|
|
|
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
|
2021-02-22 20:10:19 +07:00
|
|
|
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
|
2021-02-22 20:10:19 +07:00
|
|
|
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
|
|
|
|
}
|