#!/bin/tcsh -f 
# STO 4/24/01
# modified from original to backup in a CVS environment
# use /. syntax because 'telescope' is a link

# come off of current folder unless our source code isn't there.

if(! -d telescope/GUI) then
	cd $HOME
endif


set dirs = (telescope/.)
set date = `date +%Y%m%d`
# but DO put backup in home directory
set fn = $HOME/telbu.$date.tar.gz

onintr cleanup

set wantgifs = "-name rootwin.gif -o -name logo.gif -o -name jupitermap.gif"
set wantfits = "-name moon.fts -o -name horsehead.fts -o -name marsmap.fts"
set wantbins = "-size -25 -o -name icc12 -o -name icpp -o -name iccom12 -o -name ias6812 -o -name ilink"
set wantsos = "-name libXm.so.2.1"
set wantsrcs = "-perm +222"


# save enough from embedded that `make loadall' works w/o needing compiler
# save the .o and .a files from ICC

(find $dirs/CSIMC/embedded -path '*/CVS' -prune -o -print \! -type d -print ; \
 find $dirs/CSIMC/icc -path '*/CVS' -prune -o -print \! -type d -print ; \
 find $dirs \
   	-path '*/CVS' -prune -o -print \
	\! -type d \
	\! -type p \
	\! -name "*.Z" \
	\! -name "*.a" \
	\! -name "*.edb" \
	\! -name "*.fits" \
	\! -name "*.fth" \
	\! -name "*.ftz" \
	\! -name "*.gz" \
	\! -name "*.ln" \
	\! -name "*.lis" \
	\! -name "*.lst" \
	\! -name "*.map" \
	\! -name "*.mp" \
	\! -name "*.s19" \
	\! -name "*.o" \
	\! -name "*.ps" \
	\! -name "*.sls" \
	\! -name "*.tar" \
	\! -name "*.tex" \
	\! -name "x.*" \
	\! -name ".*.swp" \
	\! -name '*core*' \
	\! -name "ppm.xe" \
	\! -name "tags" \
	\! -name L \
	\! -name LOG \
	\! -name M \
	\! -name a.out \
	\! -name mon.out \
	\( \! -name "*.so.*" -o \( $wantsos  \) \) \
	\( \! -name "*.gif"  -o \( $wantgifs \) \) \
	\( \! -name "*.fts"  -o \( $wantfits \) \) \
	\( \! -perm -0100    -o \( $wantbins \) \) \
	$wantsrcs \
	-print \
) | sort -u | cpio -oH ustar | gzip -9 > $fn

    exit 0

cleanup:
rm -f $fn

# For CVS Only -- Do Not Edit
# $Id: telbu,v 1.1.1.1 2003/04/15 20:47:55 lostairman Exp $  
