1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-27 00:57:50 +00:00

autosense localization from env vars

always put site cache locally
This commit is contained in:
Andrey A. Chernov 1998-11-04 04:17:03 +00:00
parent 3c0102cafd
commit 0a1257cfcd
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=14344
6 changed files with 119 additions and 44 deletions

View File

@ -4,7 +4,7 @@
# Date created: 2 Nov 1998
# Whom: ache
#
# $Id: Makefile,v 1.9 1998/10/07 10:15:19 ache Exp $
# $Id: Makefile,v 1.2 1998/11/02 20:04:22 ache Exp $
#
DISTNAME= webglimpse-1.6.src
@ -29,8 +29,6 @@ pre-configure:
do-install:
cd ${WRKSRC}; ./wginstall
${INSTALL} -o nobody -m 644 /dev/null \
${PREFIX}/www/webglimpse/.sitecache
${INSTALL} -d -o ${SHAREOWN} -g ${SHAREGRP} -m 755 \
${PREFIX}/share/doc/webglimpse
cd ${WRKSRC}/docs && ${INSTALL_DATA} * ${PREFIX}/share/doc/webglimpse

View File

@ -1,5 +1,5 @@
--- makenh.orig Tue Jul 28 03:21:30 1998
+++ makenh Mon Nov 2 19:55:02 1998
+++ makenh Wed Nov 4 07:05:47 1998
@@ -68,6 +68,7 @@
$SITE_RE = '[^:]+:\/\/([^\/]+)\/.*';
$NumLocalCollected = 0;
@ -8,7 +8,15 @@
# LOGFILE, ERRFILE -- files for logging
### *TO CHANGE TRAVERSAL*
@@ -187,22 +188,22 @@
@@ -105,6 +106,7 @@
$LOGFILENAME = ".wg_log";
# $STARTFILE = ".wgstart";
$WGADDSEARCH = ".wgfilter-box";
+$SITECACHE = ".wgsitecache";
$ROBOTNAME = "HTTPGET";
@@ -187,22 +189,22 @@
# Initialize variables to avoid warnings
($title, $urlpath, $traverse_type, $explicit_only, $numhops,
@ -36,7 +44,24 @@
print LOGFILE " $item: $value\n";
}
print LOGFILE " urllist: @urllist\n\n";
@@ -398,7 +399,7 @@
@@ -231,6 +233,7 @@
$MAPFILE = "$archivepwd/$MAPFILE";
$TEMPROBOTFILE = "$archivepwd/$TEMPROBOTFILE";
$WGADDSEARCH = "$archivepwd/$WGADDSEARCH";
+$SITECACHE = "$archivepwd/$SITECACHE";
($archiveprot, $archivehost, $archiveport, $archivepath) =
&url::parse_url($archiveurl);
@@ -252,7 +255,7 @@
# read in the site configuration
&siteconf::ReadConf($vhost);
-&siteconf::LoadCache();
+&siteconf::LoadCache("$SITECACHE");
###############
### PHASE 1 ###
@@ -398,7 +401,7 @@
&close_logs();
# remove the robots file
@ -45,7 +70,7 @@
#----------------------
#change the dir back
@@ -751,7 +752,7 @@
@@ -751,7 +754,7 @@
my($prot, $host, $port, $path) = &url::parse_url($url);
# if the protocol isn't http, assume it's good
@ -54,7 +79,7 @@
return 1;
}
@@ -800,6 +801,7 @@
@@ -800,6 +803,7 @@
my($output);
my($olddata, $newdata);
my($newprot, $newhost, $newport, $newpath, $url);
@ -62,7 +87,7 @@
# make the $url
$url = "http://$host:$port/robots.txt";
@@ -815,6 +817,7 @@
@@ -815,6 +819,7 @@
while($output ne ""){
# more for error?
if($output=~/^error/i){
@ -70,7 +95,7 @@
print ERRFILE "Error with getting $url\n";
# print LOGFILE "Error with getting $url\n";
last;
@@ -822,7 +825,13 @@
@@ -822,7 +827,13 @@
# look at output for redirect -- store redirects in file, too
if($output=~/^Redirect: (.*)$/){
@ -85,7 +110,7 @@
# see if we have the redirected server
($newprot, $newhost, $newport, $newpath) = &url::parse_url($1);
@@ -843,6 +852,7 @@
@@ -843,6 +854,7 @@
}
}else{
# we've got it, or there's an error...
@ -93,7 +118,7 @@
last;
}
}
@@ -894,6 +904,7 @@
@@ -894,6 +906,7 @@
sub geturl2file{
my($url) = @_;
my($output, $link, $file, $oldfile, @aliases);
@ -101,7 +126,7 @@
# check if we have that in stock (we know it's not local)
if (defined($URL2FILE{$url})) {
@@ -930,6 +941,7 @@
@@ -930,6 +943,7 @@
while($output ne ""){
# more for error?
if($output=~/^error/i){
@ -109,7 +134,7 @@
print ERRFILE "Error with getting $url: $output\n";
# print LOGFILE "Error with getting $url\n";
last;
@@ -937,6 +949,12 @@
@@ -937,6 +951,12 @@
# look at output for redirect -- store redirects in file, too
if($output=~/^Redirect: (.*)$/){
@ -122,7 +147,7 @@
&ungetnewname(); # rewind the name counter
# The next get will overwrite the unnecessary file
@@ -970,6 +988,7 @@
@@ -970,6 +990,7 @@
}
}else{
# we've got it, or there's an error...
@ -130,7 +155,7 @@
last;
}
}
@@ -1159,6 +1178,15 @@
@@ -1159,6 +1180,15 @@
($prot, $host, $port, $path) = &url::parse_url($url);
#print "URL after parsing: $prot://$host:$port$path\n";
@ -146,7 +171,7 @@
# make sure the path has a preceding /
$path = "/$path" if $path!~/^\//;
@@ -1177,7 +1205,7 @@
@@ -1177,7 +1207,7 @@
# $host = "$a.$b.$c.$d";
# }

View File

@ -1,11 +1,57 @@
--- lib/siteconf.pl.bak Thu Jul 23 01:44:21 1998
+++ lib/siteconf.pl Mon Nov 2 13:58:29 1998
@@ -28,7 +28,7 @@
--- lib/siteconf.pl.orig Thu Jul 23 01:44:21 1998
+++ lib/siteconf.pl Wed Nov 4 07:06:48 1998
@@ -9,6 +9,7 @@
# If can't write to preferred cache file, use alternate
if (!open(F,">$FCacheFile")) {
local($DirectoryIndex, $UserDir, $DocumentRoot, $Port, $Server, $ServerAddress);
local(@AliasList,@ScriptAliasList,@ServerCache);
+local($FCacheFile);
$DirectoryIndex="";
$UserDir="";
@@ -24,21 +25,6 @@
$NUM_IP_ADDR_RE = '(\d+)\.(\d+)\.(\d+)\.(\d+)';
-$FCacheFile = "$WEBGLIMPSE_HOME/.sitecache";
-
-# If can't write to preferred cache file, use alternate
-if (!open(F,">$FCacheFile")) {
- $FCacheFile = "/tmp/.sitecache";
+ $FCacheFile = ".sitecache";
if (!open(F,">$FCacheFile")) {
print "Error, cannot find a usable cache file!\n";
$FCacheFile = '';
- if (!open(F,">$FCacheFile")) {
- print "Error, cannot find a usable cache file!\n";
- $FCacheFile = '';
- } else {
- close(F);
- }
-} else {
- close(F);
-}
-
########################################################################
# Read [vhost].wgsiteconf file settings
sub ReadConf {
@@ -327,10 +313,9 @@
return "";
}
-# NO GUARANTEE THAT THE USER RUNNING confarc CAN WRITE TO $WEBGLIMPSE_HOME!!!
-# Changed fixed filename to $FCacheFile, tested at beginning of package. --GB 7/6/98
sub SaveCache {
- open (FCACHE, ">$FCacheFile");
+ open (FCACHE, ">$FCacheFile") ||
+ die "Error, can't write to $FCacheFile: ";
foreach $host (keys %ServerCache) {
my($a, $b, $c, $d) = unpack('C4', $ServerCache{$host});
print FCACHE "$host $a $b $c $d\n";
@@ -340,7 +325,10 @@
}
sub LoadCache {
- open (FCACHE, $FCacheFile);
+ $FCacheFile = shift;
+ return if (! -e $FCacheFile);
+ open (FCACHE, $FCacheFile) ||
+ die "Error, can't read from $FCacheFile: ";
while (<FCACHE>) {
my($host, $a, $b, $c, $d) = split(' ');
$ServerCache{$host} = pack('C4', $a, $b, $c, $d);

View File

@ -1,5 +1,5 @@
--- confarc.orig Mon Jul 27 21:30:54 1998
+++ confarc Mon Nov 2 18:56:11 1998
+++ confarc Wed Nov 4 06:03:42 1998
@@ -75,6 +75,8 @@
elsif (/^-l/) { $nu_list = &get_option("-list"); }
elsif (/^-T/) { $nu_title = &get_option("-Title"); }
@ -27,31 +27,43 @@
}
# If we had a virtual host on the command line, revert to that.
@@ -423,6 +427,23 @@
@@ -423,6 +427,35 @@
}
}
+if ($nu_locale) {
+ $locale = $nu_locale;
+} elsif (! $nu_quiet) {
+ $locale = $nu_locale;
+} else {
+ if ($locale eq '') {
+ $locale = $ENV{LANG} if defined($ENV{LANG});
+ $locale = $ENV{LC_ALL} if defined($ENV{LC_ALL});
+ $locale = $ENV{LC_CTYPE} if defined($ENV{LC_CTYPE});
+ }
+ if (! $nu_quiet) {
+ $oldlocale=$locale;
+
+ $locale = &prompt("System locale (press return to leave it as is or * to cancel old one)\n",$oldlocale);
+ $locale = '' if ($locale eq "*");
+ }
+}
+
+if ($nu_charset) {
+ $charset = $nu_charset;
+} elsif (! $nu_quiet) {
+ $charset = $nu_charset;
+} else {
+ if ($charset eq '') {
+ $charset = $ENV{MM_CHARSET} if defined($ENV{MM_CHARSET});
+ }
+ if (! $nu_quiet) {
+ $oldcharset=$charset;
+
+ $charset = &prompt("Charset for CGI (press return to leave it as is or * to cancel old one)\n",$oldcharset);
+ $charset = '' if ($charset eq "*");
+ }
+}
# generate the comment
if ($found_archive) {
@@ -452,6 +473,8 @@
@@ -452,6 +485,8 @@
# vhost Hostname = name of virtual host to use for this index
# usemaxmem 0 = 0 to NOT use maximum available memory
# = 1 to use maximum memory to speed up indexing
@ -60,7 +72,7 @@
# urllist Url1,Url2,.. = List of starting URL's or Directories to index
# ";
}
@@ -473,7 +496,7 @@
@@ -473,7 +508,7 @@
# save the configuration
if(&SaveConfig($indexdir, $topcomment,
$title,$url,$traverse_type,$explicit_only,$numhops,$nhhops,
@ -69,7 +81,7 @@
print "Error saving configuration to file!\n";
exit 3;
}
@@ -483,7 +506,7 @@
@@ -483,7 +518,7 @@
&copy_files($indexdir);
# construct the cron file

View File

@ -1,6 +1,6 @@
--- dist/wgfilter-index.orig Tue Jun 16 02:16:17 1998
+++ dist/wgfilter-index Tue Nov 3 09:41:31 1998
@@ -1,26 +1,60 @@
+++ dist/wgfilter-index Wed Nov 4 07:09:04 1998
@@ -1,17 +1,49 @@
Deny \.gif$
Deny \.jpeg$
Deny \.mpeg$
@ -50,12 +50,7 @@
Deny (^|/)wgindex\.html$
Deny \.wg
Deny \.glimpse_
Deny (^|/)indexing-in-progress$
Deny (^|/)wgreindex$
+Deny (^|/).sitecache$
Deny (^|/)archive.cfg$
Deny (^|/)\.nh\.
Deny \?
@@ -23,4 +55,5 @@
Deny ~$
Deny (^|/)_vti
Deny (^|/)\.htpasswd$

View File

@ -5,7 +5,6 @@ www/cgi-bin/mfs
www/cgi-bin/webglimpse
www/cgi-bin/webglimpse-fullsearch
www/webglimpse/.archives
www/webglimpse/.sitecache
www/webglimpse/.wgsiteconf
www/webglimpse/Makefile
www/webglimpse/addsearch