#!/bin/sh

set -e

if [ !  -z "$(update-alternatives --get-selections 2> /dev/null | grep  mpi-@DEB_HOST_MULTIARCH@)" ]; then
MPI=`update-alternatives --get-selections | grep mpi-@DEB_HOST_MULTIARCH@ | awk '{print $3}' | cut -f5 -d/ `
else
MPI=@DEFAULT_MPI@
fi

# Delete potential garbage from old bug #983888
(update-alternatives --remove-all python-3.9-adios-@MULTIARCH@ 2> /dev/null || true)

update-alternatives \
    --install /usr/lib/python3/dist-packages/adios_mpi/adios_mpi.@ABITAG@.so python3-adios-@DEB_HOST_MULTIARCH@ \
              /usr/lib/python3/dist-packages/adios_${MPI}/adios_mpi.@ABITAG@.so 50 

#DEBHELPER#
