#!/bin/sh
##
##  rpmx.sh -- RPM eXtension (Shell Wrapper)
##  Copyright (c) 2001-2002 Ralf S. Engelschall <rse@engelschall.com>
##

#   root directory of RPM hierarchy
root="@l_prefix@"

#   search for Perl interpreter
perl=""
for d in `IFS=:; echo $root/bin:$PATH`; do
    if [ -f "$d/perl" ]; then
        perl="$d/perl"
        break
    fi
done

#   we can only operate if Perl is available
if [ ".$perl" = . ]; then
    echo "rpm: This functionality requires the Perl interpreter." 1>&2
    echo "rpm: Either place a vendor-supplied Perl interpreter into your" 1>&2
    echo "rpm: \$PATH or install the OpenPKG \"perl\" package, first." 1>&2
    exit 1
fi

#   transfer control to the real program
exec $perl $root/lib/openpkg/rpmx.pl $root ${1+"$@"}

