Skip to content

Instantly share code, notes, and snippets.

@unhammer
Created November 21, 2019 13:35
Show Gist options
  • Save unhammer/6bff7adabb98e581508c042dc1fb9914 to your computer and use it in GitHub Desktop.
Save unhammer/6bff7adabb98e581508c042dc1fb9914 to your computer and use it in GitHub Desktop.
Fix mssql package for Ubuntu 19.10
#!/bin/bash
# https://askubuntu.com/a/1033956/25639
set -e -u
wget -qO- https://packages.microsoft.com/keys/microsoft.asc \
| sudo apt-key add -
echo 'deb [arch=amd64] https://packages.microsoft.com/ubuntu/16.04/mssql-server-2017 xenial main' \
| sudo tee /etc/apt/sources.list.d/mssql-server.list
tmpd="$(mktemp -d -t mssql-linux.XXXXXXXXXXX)"
echo "Putting tmp files in ${tmpd}"
cd "${tmpd}"
apt download mssql-server
# Since we made a tmpdir, this should expand to only one file:
ar x mssql-server*.deb
gunzip control.tar.gz
tar -f control.tar './control' --extract -O \
| sed 's/libjemalloc1/libjemalloc2/g' > ./control
tar -f control.tar './control' --delete
tar -f control.tar './control' --update --owner=root --group=root
rm -f ./control
gzip control.tar
# Note: order of arguments matters here:
ar rcs mssql-server-fixed.deb debian-binary control.tar.gz data.tar.xz
sudo apt install -y libsss-nss-idmap0 libjemalloc2 libc++1
sudo apt-mark auto libsss-nss-idmap0 libjemalloc2 libc++1
sudo dpkg -i mssql-server-fixed.deb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment