#!/bin/sh -vx
# This shell script creates a Gopher directory structure containing
# all the WAIS sources files kept at quake.think.com. Since the
# number of sources is now many hundreds the sources are organized
# alphabetically.
#
# Review and if where necessary change the following variables
#
# host
# port
# admin
# tmpdir
# gopherdir
# waisdir
#
# AUTHOR:
[email protected]
# MODIFIED: 93-06
# Host and Port of your Gopher server
host="gopher.brown.edu"
port=70
# User is used as the password when ftping WAIS source files
# from think.com. Please change this to your sites
# administrator's userid.
admin="
[email protected]"
# Where is the tmp directory
tmpdir=/tmp
# The root Gopher data directory
gopherdir=/nfs/cwis
# The WAIS directory relative to the Gopher directory
waisdir=usr/wais
# Location for sources and index
sourcedir=${waisdir}/.waissources
indexdir=${waisdir}/.waisindex
# If necessary get the list of WAIS sources
waissources=wais-sources.tar.Z
if [ ! -r ${tmpdir}/${waissources} ]
then
ftp -n quake.think.com <<!
user anonymous ${admin}
binary
cd wais
get ${waissources} ${tmpdir}/${waissources}
bye
!
fi
# Create the root directory
rm -rf ${gopherdir}/${waisdir}
mkdir ${gopherdir}/${waisdir}
# Unpack the WAIS sources
cd ${gopherdir}/${waisdir}
zcat ${tmpdir}/${waissources} | tar -xf -
mv wais-sources ${gopherdir}/${sourcedir}
rm ${tmpdir}/${waissources}
# Make all the directories
cd ${gopherdir}/${waisdir}
for dir in a b c d e f g h i j k l m n o p q r s t u v w x y z
do
mkdir ${gopherdir}/${waisdir}/${dir}
done
# Link WAIS sources
cd ${gopherdir}/${sourcedir}
for file in `ls`
do
# Where to put the file?
case $file in
A*|a*) dir=a ;;
B*|b*) dir=b ;;
C*|c*) dir=c ;;
D*|d*) dir=d ;;
E*|e*) dir=e ;;
F*|f*) dir=f ;;
G*|g*) dir=g ;;
H*|h*) dir=h ;;
I*|i*) dir=i ;;
J*|j*) dir=j ;;
K*|k*) dir=k ;;
L*|l*) dir=l ;;
M*|m*) dir=m ;;
N*|n*) dir=n ;;
O*|o*) dir=o ;;
P*|p*) dir=p ;;
Q*|q*) dir=q ;;
R*|r*) dir=r ;;
S*|s*) dir=s ;;
T*|t*) dir=t ;;
U*|u*) dir=u ;;
V*|v*) dir=v ;;
W*|w*) dir=w ;;
X*|x*) dir=x ;;
Y*|y*) dir=y ;;
Z*|z*) dir=z ;;
*) dir=other ;;
esac
# Link the file
ln $file ${gopherdir}/${waisdir}/${dir}/
done
# Index servers
mkdir ${gopherdir}/${indexdir}
waisindex \
-d ${gopherdir}/${indexdir}/index \
-t server \
-r ${gopherdir}/${sourcedir} \
2>/dev/null
# Create link file for the server index
cat >${gopherdir}/${waisdir}/link <<!
Name=Search WAIS database descriptions
Numb=1
Type=7
Path=7/${indexdir}/index
Host=${host}
Port=${port}
Name=All WAIS databases
Numb=2
Type=1
Path=1/${sourcedir}
Host=${host}
Port=${port}
!
# Done
exit 0