#!/bin/tcsh -f set me=$0:t # the name of this program goto Start ###################################################################### Usage: cat << EOT $me VERSION Performs the preliminaries of creating a CD version of the ATI site. EOT exit ###################################################################### Start: # Abort if the required env variables aren't set if (! ${?HTML_DIR}) then echo "${me}: HTML_DIR environment variable not set\!" exit endif else if (! ${?DATE_FORMAT_ATI_VERSION}) then echo ${me}: DATE_FORMAT_ATI_VERSION environment variable not set\! exit endif if ($# != 1) then goto Usage endif set theVersion = $1 set theHTMLdir = $HTML_DIR #source directory of website files set theVersionLabel = "CD-ROM version $theVersion" set theVersionDate = `date "+${DATE_FORMAT_ATI_VERSION}"` set theVersionFile = "_aticd.${theVersion}.${theVersionDate}.txt" set theCDdir = ~/Sites/ati_CD # set discardDirs = (cgi extras news rss) #directories to exclude from the CD set theStartFile = start.html # a handy browser redirector set theSiteFolderName = site # where the website files are kept set theSiteFolderPath = ${theCDdir}/${theSiteFolderName} set locale_Master = locale.css # name of locale css file set locale_CD = locale-cd.css # name of the css file for the cd echo "Prepping files for ${theVersionLabel}:" # recursively copy the entire source directory to the CD directory echo -n " checking for directory (${theCDdir})..." if (! -e $theCDdir) then mkdir $theCDdir echo "created" else echo "exists (OK)" endif echo -n " checking site directory (${theSiteFolderPath})..." if (! -e $theSiteFolderPath) then echo "not found (OK)" echo -n " copying files..." cp -R $theHTMLdir $theSiteFolderPath echo "done" else echo "site directory exists (OK). Skipping copy." endif # localize the CSS for the CD echo -n " CSS localization..." cd $theSiteFolderPath/css if (! -e $locale_CD) then echo "Can't find ${locale_CD}. I give up." exit endif if (! -e $locale_Master) then echo "Can't find ${locale_Master}. I give up." exit endif cp $locale_CD $locale_Master echo "done" cd $theSiteFolderPath touch $theVersionFile #localize the index.html file set theTag="LOCALE" stamp "LOCALE" "$theVersionLabel" index.html stamp_rev-date index.html # apply a time stamp, while we're at it foreach dir (${discardDirs}) echo -n " deleting directory '${dir}'..." rm -fR $dir echo "done" end echo -n " deleting bulk file tag..." rm _atibulk* >& /dev/null echo "done" cd $theCDdir echo -n " creating the redirector..." cat << END_INPUT > $theStartFile
END_INPUT echo "done" echo -n " deleting invisible files..." find . -type f -name .\* -exec rm {} \; echo "done" echo -n " deleting invisible dirs..." find . -type d -name .\* \! \( -name . -o -name .. \) -exec rm -fr {} \; echo "done" echo echo "Files for ${theVersionLabel} now ready for link- and syntax-checking."