Install the Microsoft SQL Server ODBC Driver when installing sqlsrv/pdo_sqlsrv

pull/265/head
Michele Locati 2021-01-20 10:53:51 +01:00
parent 66fa5885ac
commit 02517f0882
No known key found for this signature in database
GPG Key ID: 98B7CE2E7234E28B
2 changed files with 45 additions and 10 deletions

View File

@ -1,4 +1,6 @@
enchant !7.2-alpine3.12 !7.3-alpine3.12 !7.4-alpine3.12 enchant !7.2-alpine3.12 !7.3-alpine3.12 !7.4-alpine3.12
parallel zts parallel zts
pdo_sqlsrv !7.0-alpine3.7 !7.1-alpine3.7 !7.1-alpine3.8 !7.2-alpine3.7 !7.2-alpine3.8 !7.3-alpine3.8
pthreads zts pthreads zts
sqlsrv !7.0-alpine3.7 !7.1-alpine3.7 !7.1-alpine3.8 !7.1-alpine3.9 !7.1-alpine3.10 !7.2-alpine3.7 !7.2-alpine3.8 !7.3-alpine3.8
tdlib !alpine3.7 !jessie tdlib !alpine3.7 !jessie

View File

@ -667,14 +667,6 @@ buildRequiredPackageLists() {
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libpq5" buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libpq5"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libpq-dev" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libpq-dev"
;; ;;
pdo_sqlsrv@alpine)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libstdc++ unixodbc"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile unixodbc-dev"
;;
pdo_sqlsrv@debian)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libodbc1 odbcinst"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile unixodbc-dev"
;;
pgsql@alpine) pgsql@alpine)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent postgresql-libs" buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent postgresql-libs"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile postgresql-dev" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile postgresql-dev"
@ -772,13 +764,16 @@ buildRequiredPackageLists() {
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libcurl3-gnutls" buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libcurl3-gnutls"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libcurl4-gnutls-dev libxml2-dev" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libcurl4-gnutls-dev libxml2-dev"
;; ;;
sqlsrv@alpine) sqlsrv@alpine | pdo_sqlsrv@alpine)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libstdc++ unixodbc" buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libstdc++ unixodbc"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile unixodbc-dev" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile unixodbc-dev"
;; ;;
sqlsrv@debian) sqlsrv@debian | pdo_sqlsrv@debian)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent unixodbc" buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent unixodbc"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile unixodbc-dev" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile unixodbc-dev"
if ! isMicrosoftSqlServerODBCInstalled; then
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile gnupg apt-transport-https"
fi
;; ;;
ssh2@alpine) ssh2@alpine)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libssh2" buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libssh2"
@ -1170,6 +1165,41 @@ installOracleInstantClient() {
esac esac
} }
# Check if the Microsoft SQL Server ODBC Driver is installed
#
# Return:
# 0 (true): if the string is in the list
# 1 (false): if the string is not in the list
isMicrosoftSqlServerODBCInstalled() {
test -d /opt/microsoft/msodbcsql*/
}
# Install the Microsoft SQL Server ODBC Driver
installMicrosoftSqlServerODBC() {
printf 'Installing the Microsoft SQL Server ODBC Driver\n'
case "$DISTRO" in
alpine)
# https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server#alpine17
rm -rf /tmp/src/msodbcsql.apk
curl -sSLf -o /tmp/src/msodbcsql.apk https://download.microsoft.com/download/e/4/e/e4e67866-dffd-428c-aac7-8d28ddafb39b/msodbcsql17_17.6.1.1-1_amd64.apk
printf '\n' | apk add --allow-untrusted /tmp/src/msodbcsql.apk
rm -rf /tmp/src/msodbcsql.apk
;;
debian)
# https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server#debian17
printf -- '- installing the Microsoft APT key\n'
curl -sSLf https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
if ! test -f /etc/apt/sources.list.d/mssql-release.list; then
printf -- '- adding the Microsoft APT source list\n'
curl -sSLf https://packages.microsoft.com/config/debian/$DISTRO_VERSION_NUMBER/prod.list >/etc/apt/sources.list.d/mssql-release.list
DEBIAN_FRONTEND=noninteractive apt-get -q update
fi
printf -- '- installing the APT package\n'
DEBIAN_FRONTEND=noninteractive ACCEPT_EULA=Y apt-get -qy install '^msodbcsql[0-9]+$'
;;
esac
}
# Install Composer # Install Composer
installComposer() { installComposer() {
installComposer_version="$(getWantedPHPModuleVersion @composer)" installComposer_version="$(getWantedPHPModuleVersion @composer)"
@ -1681,6 +1711,9 @@ installRemoteModule() {
installRemoteModule_version=5.8.1 installRemoteModule_version=5.8.1
fi fi
fi fi
if ! isMicrosoftSqlServerODBCInstalled; then
installMicrosoftSqlServerODBC
fi
;; ;;
propro) propro)
if test -z "$installRemoteModule_version"; then if test -z "$installRemoteModule_version"; then