#!/bin/bash

set -e

# left-hand term originates from ENABLE_LDCONFIG = ON/OFF at package build
rm_ldconfig() {
  if [ "@ENABLE_LDCONFIG@" == "ON" ]; then
    rm -f /@CMAKE_INSTALL_SYSCONFDIR@/ld.so.conf.d/x86_64-libhsakmt.conf && ldconfig
  fi
}

case "$1" in
  ( remove | upgrade )
    rm_ldconfig
  ;;
  ( purge )
  ;;
  ( * )
    exit 0
  ;;
esac
