#!/bin/sh -x
# This shell script creates a Gopher directory structure containing all
# the WAIS sources files kept at quake.think.com. Since the number of
# sources now exceeds 200, the sources are organized alphabetically.
#
# AUTHOR:
[email protected]
# MODIFIED: 7/6/92
# User is used as the password when ftping into think.com.
# Please change this to your sites administrator's userid.
user="cwis_administrator@domain"
# Where to place the WAIS files (you will need to change this)
# NOTE: First command line argument overrides default
to=${1-"/nfs/cwis/usr/wais"}
# At Brown, .cap directories are called property directories
# (This is a Novell NFS accomodation)
# capdir=".cap"
capdir="property"
# Create tmp directory to work in
tmp=/tmp/gopher-wais-load
rm -fr ${tmp}
mkdir ${tmp}
cd ${tmp}
# Get list of WAIS sources
ftp -n quake.think.com <<!
user anonymous ${user}
binary
cd wais
get wais-sources.tar.Z
bye
!
# Unpack them
zcat wais-sources.tar.Z | tar -xf -
# Make all the directories
rm -r ${to}
mkdir ${to}
mkdir ${to}/${capdir}
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 ${to}/${dir}
done
# Distribute WAIS sources
cd ${tmp}/wais-sources
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
# Move the file
mv $file ${to}/${dir}/
done
# Create entry for directory of servers
cp ${to}/d/directory-of-servers.src ${to}/.
cat >${to}/${capdir}/directory-of-servers.src <<!
Name=Directory of WAIS servers
Numb=1
!
# Clean up
rm -rf ${tmp}
# Done
exit 0