#!/bin/csh -f # jtb 030124 # Rebuild the bulk file with the files located in a new top dir. # This is called by makebulk. # This script is a simple (and inelegant) solution to the thorny # problem of putting a large website that resides in one dir into # a zip file such that when it's unzipped the files reside in a # new root dir. # # For example, a file in the bulk file that previously was # canon/anguttara/index.html # becomes # website/html/canon/anguttara/index.html # # The basic idea: create a new dir; unzip it there; re-zip it. # # Remember -- We must always keep two big zipfiles on hand: # the "raw" zip file (which is updated with each call to makebulk) # and the one with a new root (the one that's created from scratch here) set me=$0:t # the name of this program set bulkDir = $BULK_DIR # where the original bulk file lives set rawFile = bulk.zip # the original bulk file set topDir = ati_website # the unzipped website name set htmlDir = html # the new dir where the website files hide set startFile = start.html # the start-up file for launching the website set tidyFile = atibulk.zip # the end result cd $bulkDir mkdir $topDir ; cd $topDir # create and enter the new dir mkdir $htmlDir ; cd $htmlDir # create and enter the new dir echo -n "${me}: unzipping the archive..." unzip -q $bulkDir/$rawFile # unzip the old file here cd $bulkDir # go back up # Create the redirecting index file. (User clicks on this file # to enter the website.) cat << END_INPUT > $topDir/$startFile END_INPUT # now zip 'em up (-m deletes the files as we go) echo -n "re-zipping..." zip -mrq -b /tmp $tidyFile $topDir chmod a+r $tidyFile echo "done."