Blob Blame History Raw
#! /bin/bash
# Author: Till Maas <opensource@till.name>
#
# Use this script as follows in your spec to get versioned 
# ghc requires for post and preun:
#
# %{expand:%(/usr/lib/ghc-script-requires.sh ghc post preun)}

ghc_num_ver=$(ghc --numeric-version)

PKG=$1 ; shift

# rpm will run this script once before the BuildRequires are installed
# then it has to report nothing to avoid rpm complainng about the empty version
# after the "ghc ="
if [ -n "${ghc_num_ver}" ]; then
  echo "Requires: $PKG = ${ghc_num_ver}"
  for script in "$@"; do
    echo "Requires(${script}): $PKG = ${ghc_num_ver}"
  done
fi