#! /usr/bin/bash

# ltex replaced by ltex-plus
versionLTexPlus=18.5.1
# TBD: this must ge generalized 
platformLTex=x64
mkdir -p /usr/share/ltex 
pushd /usr/share/ltex
#https://github.com/ltex-plus/ltex-ls-plus/releases/latest 
# exists but did not find a way to 
wget -nc https://github.com/ltex-plus/ltex-ls-plus/releases/download/18.5.1/ltex-ls-plus-$versionLTexPlus-linux-$platformLTex.tar.gz
gunzip --force --keep ltex-ls-plus-*.tar.gz # keep to avoid further download 
tar --no-overwrite-dir --no-same-owner --no-same-permissions -xf ltex-ls-plus-*.tar
cd /usr/bin
#cd ./ltex-ls-plus-$versionLTexPlus/bin/
ln -fs ../share/ltex/ltex-ls-plus-$versionLTexPlus/bin/ltex-ls-plus  ltex-ls
ln -fs ../share/ltex/ltex-ls-plus-$versionLTexPlus/bin/ltex-cli-plus ltex-cli
popd