#!/bin/bash
# This script is for emergencies only. It copies the HTML version of
# a book made locally in doc/o/cogent-set to the published bookset on
# andrewgate. It should be run from the doc/o directory.
# This function gets the names of all the HTML and GIF files from the
# book's directory, and then tars up the desired files from the
# cogent-set/html directory.
Copy() {
declare -a names
cd ${1}-book/html
ls -1 *.html *.gif | \
sed -e '/ln[0-9]*.html/D' > ../../files.txt
cd -
cat files.txt
typeset -i cnt=0
while read line
do
names[$cnt]=$line
((cnt = cnt + 1))
done < files.txt
echo "${names[@]}"
cd cogent-set/html
tar -cf ../../newfiles.tar ${names[@]}
cd -
}
Install() {
echo 'Making a temporary directory on andrewgate (/home/robert/w/tmp/)'
ssh andrewgate "mkdir -p /home/robert/w/tmp/; exit"
echo ' '
echo 'Copying new book html files to andrewgate:/home/robert/w/tmp/...'
scp newfiles.tar andrewgate:/home/robert/w/tmp
tar -xf newfiles.tar
echo 'Replacing existing book HTML and GIF files with new files.'
ssh andrewgate "cp /home/robert/w/tmp/* /home/robert/w/tmp2;
rm -fr /home/robert/w/tmp/; exit"
echo ' '
}
# This function finds the number of the index file and all pages in
# the docs that use that number. Those pages have to be edited
# manually on andrewgate, using vi.
Index() {
bk=${1};
cd cogent-set/html/
inum=`grep -m 1 "book${bk}.html" i*.html | sed -e 's/\.html.*//g'`
if [ -n "${inum}" ]; then
echo "
1. You must ssh to andrewgate, cd to /cogent/web/cogentdocs, and edit
the existing index number (innnn) to ${inum} in the following files:
"
grep ${inum} *-*.html
echo "
Use vi to edit as follows:
Open the file to edit: vi <filename>
Find innnnn, which appears below the word "Index" in the first file: /Index
Replace the old numbers with the new one: :%s/<old_num>/<new_num>/
Save and quit: ZZ"
else
echo "1. book${bk} has no index. No files to edit."
fi
cd -
}
checkdir.sh o
if [ -z ${1} ]; then
echo "Please enter a book prefix, like cc or drdn"
exit 1
fi
# Copy and tar up the necessary files.
Copy ${1}
# Copy the tarball to andrewgate and install it in the book set.
Install
# Find and print the lines of HTML that refer to the index page.
# These must be hand-edited.
echo "----------------- THREE MANUAL STEPS ------------------"
Index ${1}
# Print a reminder to do the PDF file manually.
echo "
2. Next make up and copy the PDF file to
andrewgate:/cogent/web/docdistrib
3. Finally, update the web site by running the appropriate script
from https://developers.cogentrts.com/admin/admin_scripts.html
"
Copyright © 1995-2004 by Cogent Real-Time Systems, Inc. All rights reserved.