#!/bin/csh
### --- The University of Birmingham 1999. --------------------------------
### $poplocal/local/ftp/bin/insert.copyright
# Aaron Sloman Mon Aug 30 10:58:48 BST 1999

# assume this is invoked in the ftp directory with gzipped
# tar files in format: file.tar.gz

set ftp = /bham/ftp/pub/dist/poplog

set bakdir = /bham/ftp/pub/dist/poplog.bak

set tarfiledir = $ftp/new

set tempdir = $bakdir/temp.$1.dir

echo creating $tempdir

mkdir $tempdir

echo "expanding $1"

cd $tempdir
time zcat $tarfiledir/$1 | tar xf -

echo "expanded"

echo moving original file to $bakdir/$1.bak
mv $tarfiledir/$1 $bakdir/$1.bak

ls -l $bakdir/$1.bak

echo "expanded $1. Adding installation notes"

cd $tempdir
rm -f INSTALL.TXT
cp -p $tarfiledir/install.txt  .

touch This.is.from.$1

ln -s install.txt COPYRIGHT

echo "installing bugfixes"

cd $tempdir

cp -rp $ftp/bugfixes/pop .

echo "bugfixes installed"

echo "compressing"

cd $tempdir

time tar cf - * | gzip > $tarfiledir/$1

echo compressed

cd $tarfiledir

ls -l $1*

echo "removing temporarily expanded files in $tempdir"

time rm -rf $tempdir

echo "rebuilding $1 done"
