#!/bin/sh
# Place in /usr/lib/redhat/find-requires.d/
#
# Searches texlive packages for requires data
#
# Author: Ben Boeckel <MathStuf@gmail.com>
# Based on desktop-file.prov by Richard Hughes

OLD_IFS="$IFS"
while read instfile; do
    case "$instfile" in
    *.sty)
        requires=`cat $instfile | grep '\\RequirePackage' | sed -e 's/\\RequirePackage{\([a-zA-Z0-9,]+\)}/\\1/'`
        IFS=','
        for require in $requires; do
            echo 'texlive('$require')'
        done
    esac
done
IFS=$OLD_IFS
