#!/usr/local/bin/perl
# Harrie Hazewinkel, nov 1, 2000
# This generates the install and uninstall scripts for scotty.
#

if ($#ARGV != 0) {
    print "usage: configure.pl <directory of MIB modules>";
}

@mibmodules=("COVALENT-GENERIC-MIB",
		"COVALENT-APACHE-MODULES-MIB",
		"COVALENT-APACHE-CONFIG-MIB",
		"COVALENT-APACHE-STATUS-MIB",
		"COVALENT-WWW-RESP-NOTIFY-MIB",
		"WWW-MIB",
		"SYSAPPL-MIB",
		"NETWORK-SERVICES-MIB");


open(INSTDEF, "<install.sh-def") or die "Could not read from install.sh-def";
open(INST, ">install.sh") or die "Could not write to install.sh";
while (<INSTDEF>) {
    $line = $_;
    $line =~ s/\@\@MIBSRC\@\@/$ARGV[0]/;
    if ($line =~ /MIBMODULESDEF/) {
        print INST "MIBMODULES=\"";
        foreach (@mibmodules) {
            print INST "$_ ";
        }
        print INST "\"\n";
    } else {
        print INST $line;
    }
}
close(INSTDEF);
close(INST);

open(UNINSTDEF, "<uninstall.sh-def") or die "Could not read from uninstall.sh-def";
open(UNINST, ">uninstall.sh") or die "Could not write to uninstall.sh";
while (<UNINSTDEF>) {
    $line = $_;
    if ($line =~ /MIBMODULESDEF/) {
        print UNINST "MIBMODULES=\"";
        foreach (@mibmodules) {
            print UNINST "$_ ";
        }
        print UNINST "\"\n";
    } else {
        print UNINST $line;
    }
}
close(UNINSTDEF);
close(UNINST);
