#!/bin/sh -e

# Run configure scripts of a package
# Christoph Lameter <clameter@debian.org>, Feb 9 ,1997

for i in $*; do
        if expr "$i" : ".*\.deb" >/dev/null; then
                if [ -f $i ]; then 
                        mkdir /tmp/$$
                        dpkg-deb --control $i /tmp/$$
                        if [ -x /tmp/$$/configure ]; then
                                /tmp/$$/configure
                        else
                                echo "Package $i has no configure file"
                                exit 1
                        fi
                        rm -rf /tmp/$$
                        exit 0
                else
                        echo "Package $i not found"
                        exit 1
                fi
        else
                F=/var/lib/dpkg/info/$i.configure
                if [ -x $F ]; then
                        $F        
                else
                        echo "Package $i did not come with a configuration script"
                        exit 1
                fi
        fi
done
