📄 createbroker.in
字号:
#!@PERL@## CreateBroker - Generates a new Broker based on user input.## Usage: CreateBroker [skeleton-tree [destination]]## For example, CreateBroker /usr/local/harvest/brokers/skeleton## $Id: CreateBroker,v 2.4 2000/02/03 12:45:55 sxw Exp $################################################################################ Harvest Indexer http://harvest.sourceforge.net/# -----------------------------------------------## The Harvest Indexer is a continued development of code developed by# the Harvest Project. Development is carried out by numerous individuals# in the Internet community, and is not officially connected with the# original Harvest Project or its funding sources.## Please mail lee@arco.de if you are interested in participating# in the development effort.## 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.########################################################################## Copyright (c) 1994, 1995. All rights reserved.## The Harvest software was developed by the Internet Research Task# Force Research Group on Resource Discovery (IRTF-RD):## Mic Bowman of Transarc Corporation.# Peter Danzig of the University of Southern California.# Darren R. Hardy of the University of Colorado at Boulder.# Udi Manber of the University of Arizona.# Michael F. Schwartz of the University of Colorado at Boulder.# Duane Wessels of the University of Colorado at Boulder.## This copyright notice applies to software in the Harvest# ``src/'' directory only. Users should consult the individual# copyright notices in the ``components/'' subdirectories for# copyright information about other software bundled with the# Harvest source code distribution.## TERMS OF USE## The Harvest software may be used and re-distributed without# charge, provided that the software origin and research team are# cited in any use of the system. Most commonly this is# accomplished by including a link to the Harvest Home Page# (http://harvest.cs.colorado.edu/) from the query page of any# Broker you deploy, as well as in the query result pages. These# links are generated automatically by the standard Broker# software distribution.## The Harvest software is provided ``as is'', without express or# implied warranty, and with no support nor obligation to assist# in its use, correction, modification or enhancement. We assume# no liability with respect to the infringement of copyrights,# trade secrets, or any patents, and are not responsible for# consequential damages. Proper use of the Harvest software is# entirely the responsibility of the user.## DERIVATIVE WORKS## Users may make derivative works from the Harvest software, subject# to the following constraints:## - You must include the above copyright notice and these# accompanying paragraphs in all forms of derivative works,# and any documentation and other materials related to such# distribution and use acknowledge that the software was# developed at the above institutions.## - You must notify IRTF-RD regarding your distribution of# the derivative work.## - You must clearly notify users that your are distributing# a modified version and not the original Harvest software.## - Any derivative product is also subject to these copyright# and use restrictions.## Note that the Harvest software is NOT in the public domain. We# retain copyright, as specified above.## HISTORY OF FREE SOFTWARE STATUS## Originally we required sites to license the software in cases# where they were going to build commercial products/services# around Harvest. In June 1995 we changed this policy. We now# allow people to use the core Harvest software (the code found in# the Harvest ``src/'' directory) for free. We made this change# in the interest of encouraging the widest possible deployment of# the technology. The Harvest software is really a reference# implementation of a set of protocols and formats, some of which# we intend to standardize. We encourage commercial# re-implementations of code complying to this set of standards.##$ENV{'HARVEST_HOME'} = "@prefix@" if (!defined($ENV{'HARVEST_HOME'}));$ENV{'PATH'} = "$ENV{'HARVEST_HOME'}/bin" . ":" . "$ENV{'HARVEST_HOME'}/lib/broker". ":" . "$ENV{'HARVEST_HOME'}/lib" . ":" . "$ENV{'PATH'}";chop($this_person = `whoami`);chop($this_host = `hostname`);($this_host_full, @x) = gethostbyname($this_host);undef @x;print <<EOM; ---------------------------------------------------------------------- Welcome to Harvest! This program will create and configure a Harvest Broker. First, you will be asked a few questions about how you want this new Broker to look. Second, this program will create the Broker and configure it. Finally, this program will generate a script that can be used to run the new Broker. If you have any questions or problems, please refer to http://harvest.sourceforge.net/ ----------------------------------------------------------------------EOMwhile (1) { &init_vars(); &get_user_input(); &print_info(); $vals{"YorN"} = "yes"; &get_ans("Is this information correct?", "YorN"); last if ($vals{"YorN"} =~ /^y/io);}&build_broker();print <<EOM; Harvest Brokers can collect indexing information from Gatherers or other Brokers. The list of collection points for your Broker is in $vals{'Destination-Directory'}/admin/Collection.conf.EOM$vals{"YorN"} = "yes";while (1) { print "\n"; &get_ans("Would you like to add a collection point to the Broker now?", "YorN"); last if ($vals{"YorN"} =~ /^n/io); &add_collection_point("$vals{'Destination-Directory'}/admin/Collection.conf"); $vals{"YorN"} = "no";}print <<EOM; ---------------------------------------------------------------------- The new Broker was successfully built. To start the new Broker, run $vals{'Destination-Directory'}/RunBroker The new Broker's home page is: http://$vals{'HTTP-Host'}/Harvest/brokers/$vals{'Broker-Short-Name'}/query.html The new Broker's administrative interface is: http://$vals{'HTTP-Host'}/Harvest/cgi-bin/brokerAdmin.cgi ----------------------------------------------------------------------EOMexit 0; # END OF PROGRAMsub get_ans { local($prompt, $tag) = @_; $default_value = ""; $default_value = $vals{$tag} if (defined($vals{$tag})); print $prompt, " [$default_value]: "; $in = <STDIN>; chop($in); $vals{$tag} = $in if ($in !~ /^\s*$/io);}sub print_info { print<<EOM; ----------------------------------------------------------------------EOM foreach $key (sort keys %vals) { next if ($key eq "YorN"); next if ($key eq "Skeleton-Directory"); next if ($key =~ /glimpse/io && $INDEXER ne "glimpse"); next if ($key =~ /wais/io && $INDEXER ne "wais"); next if ($key =~ /swish/io && $INDEXER ne "swish"); printf "%21s: ", $key; if ($vals{$key} eq "No_Default") { print "none"; } else { print $vals{$key}; } print "\n"; } print<<EOM; ----------------------------------------------------------------------EOM print "\n";}sub init_vars { print <<EOM; CreateBroker will try to set the default answers as correctly as possible. Hold on a moment, trying to guess your configuration...EOM $vals{"Broker-Host"} = $this_host_full; $vals{"HTTP-Host"} = $vals{"Broker-Host"}; $vals{"Broker-Name"} = "No_Default"; $vals{"Broker-Short-Name"} = "No_Default"; $vals{"Broker-Port"} = "8501"; $vals{"Broker-Password"} = ""; $vals{"Contact-Email"} = "$this_person\@$this_host_full"; $vals{"Contact-Message"} = ""; $vals{"glimpse-Command"} = "$ENV{'HARVEST_HOME'}/lib/broker/glimpse"; $vals{"glimpseindex-Command"} = "$vals{'glimpse-Command'}index"; $vals{"glimpseserver-Command"} = "$vals{'glimpse-Command'}server"; $vals{"swish-Command"} = "$ENV{'HARVEST_HOME'}/lib/broker/swish"; $vals{'Broker-WAIS-Host'} = $vals{'Broker-Host'}; $vals{'Broker-WAIS-Port'} = $vals{'Broker-Port'} + 1; $vals{'Broker-Glimpse-Host'} = $vals{'Broker-Host'}; $vals{'Broker-Description-Tag'} = "description"; $vals{'Broker-Replicas'} = ""; $INDEXER = "glimpse"; srand(time); $vals{'Broker-Collect'} = sprintf("%02d:%02d", rand(8) % 9 , rand(59) % 60 ); foreach $key ("waisindex", "waissearch", "waisserver", "waisparse", "waislookup", "waisdelete") { $vals{"$key-Command"} = `which "$key" 2>/dev/null`; if ($vals{"$key-Command"} !~ /^\//o) { $vals{"$key-Command"} = "No_Default"; } else { chop $vals{"$key-Command"}; } } $vals{"Skeleton-Directory"} = "$ENV{'HARVEST_HOME'}/brokers/skeleton";}sub get_user_input {print "\n\n";&get_ans("Enter a one-line descriptive name for your Broker", "Broker-Name");&get_ans("Enter a one-word name for your Broker", "Broker-Short-Name");if ($vals{"Broker-Short-Name"} ne "No_Default") { $vals{"Destination-Directory"} = "$ENV{'HARVEST_HOME'}/brokers/" . $vals{"Broker-Short-Name"};}&get_ans("Enter the hostname on which the broker will run", "Broker-Host");&get_ans("Enter the port number on which the broker will run", "Broker-Port");$line = &check_brokers_cf ($vals{'Broker-Short-Name'}, $vals{'Broker-Host'}, $vals{'Broker-Port'});print <<EOM if ($line ne '');=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=WARNING: This broker seems to conflict with another. The following linewas found in $ENV{'HARVEST_HOME'}/brokers/Brokers.cf:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -