Show COElocal.pm.in syntax highlighted
package COElocal;
##############################################################################################
#
# File: COElocal.pm
# Description: Local stuff (no DB, just DBM files...)
# Author: Lee Mayes ( email leem@atl.hp.com )
# Created: Jan 31 2001 ( LinuxCOE System Designer )
# Language: perl
# Package: LinuxCOE
##############################################################################################
# © Copyright 2000-2006 Hewlett-Packard Development Company, L.P
#
# This program is free software; you can redistribute it and/or modify it under the terms of
# the GNU General Public License as published by the Free Software Foundation; either version
# 2 of the License, or (at your option) any later version.
#
# This program 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.
##############################################################################################
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(show_os);
use strict;
use vars qw (%DB %PASS $COE_VER);
sub show_os {
# This replicates COEdb.pm's mysql calls by poking around the %OSVEND array
#
# If called w/no args, return @array of OS's
# If called w/dist, ver, arch, return @array of methods we support
# If called w/dist, ver, arch, method, return waystations that support it
# If called w/everything, return PATH to bits
# OSVEND office.silicon.heaven RedHat 7.2 i386 HTTP /LinuxCOE/RedHat/7.2
my ($self,$indist,$inver,$inarch,$inmeth,$inway) = @_;
my (%OS);
my $caller = caller;
#print STDERR "show_os local: called with ($indist,$inver,$inmeth,$inway)\n";
foreach my $key (keys(%LinuxCOE::OSVEND)) {
# $OSVEND{"$dist:$ver:$arch:$method:$way"} = "$path";
# show_os local: called with (RedHat,9,NFS,office.silicon.heaven)
my ($dist,$ver,$arch,$meth,$way) = split(':',$key);
if ( $inmeth ) {
print STDERR " show_os: key = $key - looking for $inmeth\n";
# We know the method, need a list of servers vending or the actual path
if (($indist eq $dist) && ( $inver eq $ver ) && ($inmeth eq $meth) && ($inarch eq $arch)) {
my $path = $LinuxCOE::OSVEND{$key};
if ($inway) {
# Simply looking for the path for this dist/ver/arch/method/waystation
if (( $inway eq $way ) && ( $inarch eq $arch )) {
print STDERR "Returning $path!\n";
return($path)
}
} else {
#print STDERR " found $way vending $dist $ver $meth!\n";
# Build an array of waystations vending this dist/ver/arch/method
$OS{$way} = 1;
}
}
} elsif ( $indist ) {
# Build a list of valid install methods for this dist/ver/arch
if (($indist eq $dist) && ( $inver eq $ver ) && ($inarch eq $arch)) {
$OS{"$meth"} =1;
}
} else {
# Return a list of all avaialbe dist/ver/arch's
$OS{"$dist $ver - $arch"} =1;
}
}
my $string = join(',',keys(%OS));
#print STDERR "show_os, returning $string\n";
return(sort(keys(%OS)));
}
See more files for this project here