install-msodbc-driver.sh 841 B

12345678910111213141516171819202122
  1. #!/usr/bin/env bash
  2. ## this script install msodbcsql17 and unixodbc-dev on ci environment
  3. ## specific to ubuntu 16.04, 18.04, 20.04, 22.04
  4. set -euo pipefail
  5. # install msodbcsql17
  6. VERSION=$(lsb_release -rs)
  7. if ! [[ "16.04 18.04 20.04 22.04" == *"$VERSION"* ]];
  8. then
  9. echo "Ubuntu $VERSION is not currently supported.";
  10. exit 1;
  11. fi
  12. curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && \
  13. curl https://packages.microsoft.com/config/ubuntu/"$VERSION"/prod.list > /etc/apt/sources.list.d/mssql-release.list && \
  14. ## TODO: upgrade builder image
  15. apt-get update && \
  16. ACCEPT_EULA=Y apt-get install -y msodbcsql17 unixodbc-dev mssql-tools && \
  17. ## and not needed to modify /etc/odbcinst.ini
  18. ## docker-compose will mount one in .ci/docker-compose-file/odbc
  19. sed -i 's/ODBC Driver 17 for SQL Server/ms-sql/g' /etc/odbcinst.ini