#!/bin/bash
#
#  A tool for extracting various info from rpm spec files
#
#  Copyright (C) 2004, 2005 Sun Microsystems, Inc.
#
#  pkgbuild is free software; you can redistribute it and/or
#  modify it under the terms of the GNU General Public License 
#  version 2 published by the Free Software Foundation.
#
#  pkgbuild is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#  General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#  As a special exception to the GNU General Public License, if you
#  distribute this file as part of a program that contains a
#  configuration script generated by Autoconf, you may include it under
#  the same distribution terms that you use for the rest of that program.
#
#  Authors:  Laszlo Peter  <laca@sun.com>
#

pkgbuild_prefix="/usr"
pkgbuild_libdir="/usr/lib/pkgbuild-1.3.104"
pkgbuild_bindir="${pkgbuild_prefix}/bin"
pkgbuild_wrapper="${pkgbuild_bindir}/pkgbuild"
spectool_implementation="${pkgbuild_libdir}/spectool.pl"

if [ ! -d "${pkgbuild_prefix}" -o \
     ! -d "${pkgbuild_libdir}" -o \
     ! -d "${pkgbuild_bindir}" -o \
     ! -x "${pkgbuild_wrapper}" -o \
     ! -f "${spectool_implementation}" ]
then
    echo "${0}: FATAL ERROR - pkgbuild implementation not found." 1>&2
    exit 1
fi

# Pass in the full path to the pkgbuild wrapper as the first command line argument
exec "/usr/bin/perl" -I "${pkgbuild_libdir}" "${spectool_implementation}" "${pkgbuild_wrapper}" "${@}"
