1 |
ccflib |
1.1 |
#! /bin/bash |
2 |
|
|
# |
3 |
|
|
# Giuseppe Vacanti (cosine) September 2000 |
4 |
|
|
# |
5 |
|
|
. $HOME/bin/ccflib.cfg |
6 |
|
|
|
7 |
|
|
# run only if there is something new |
8 |
|
|
ls $ccfrepository/*.CCF | fgrep -v CALINDEX > $HOME/todaysccflist |
9 |
|
|
if ( cmp -s $HOME/todaysccflist $HOME/yesterdaysccflist ) then |
10 |
|
|
exit |
11 |
|
|
fi |
12 |
|
|
mv -f $HOME/todaysccflist $HOME/yesterdaysccflist |
13 |
|
|
|
14 |
|
|
|
15 |
|
|
sasexperiment > /dev/null |
16 |
|
|
|
17 |
|
|
if [ $# -eq 1 ] ; then |
18 |
|
|
next=$1 |
19 |
|
|
else |
20 |
|
|
list=`ls $ccfrepository/*CALINDEX*` |
21 |
|
|
if [ -z "$list" ] ; then |
22 |
|
|
next=1 |
23 |
|
|
else |
24 |
|
|
n=`for f in $ccfrepository/*CALINDEX* ; do |
25 |
|
|
basename $f | cut -d_ -f 3 | cut -d. -f 1 |
26 |
|
|
done | sort -n -r | head -1 | sed -e 's/^0\{1,3\}//g'` |
27 |
|
|
next=$[n + 1] |
28 |
|
|
fi |
29 |
|
|
fi |
30 |
|
|
next=`printf "%4.4d" $next` |
31 |
|
|
|
32 |
|
|
# remove old CALINDEX entries not to clog the system |
33 |
|
|
mv $ccfrepository/*CALINDEX* $ccfrepository/calindex |
34 |
|
|
|
35 |
|
|
export SAS_CCFPATH |
36 |
|
|
SAS_CCFPATH=$ccfrepository |
37 |
|
|
# build a new one |
38 |
|
|
cifbuild --fullpath=no --masterindex=yes --calindexset=$ccfrepository/XMM_CALINDEX_$next.CCF |
39 |
|
|
|
40 |
|
|
# this will contain the last CALINDEX as well |
41 |
|
|
cifbuild --fullpath=no --masterindex=yes --calindexset=$ccfrepository/ccf.mif |
42 |
|
|
|
43 |
|
|
# rename it |
44 |
|
|
mv $ccfrepository/ccf.mif $ccfrepository/XMM_CALINDEX_$next.CCF |
45 |
|
|
dssetattr --to=ccf_repository/XMM_CALINDEX_$next.CCF%ISSUE --type=int --value=$next |
46 |
|
|
dssetattr --to=ccf_repository/XMM_CALINDEX_$next.CCF%FILENAME --type=string --value=XMM_CALINDEX_$next.CCF |
47 |
|
|
|
48 |
|
|
# create one with full path for local use |
49 |
|
|
cifbuild --fullpath=yes --masterindex=yes --calindexset=$ccfrepository/ccf.mif |
50 |
|
|
|
51 |
|
|
# update latest CIFs |
52 |
|
|
latestcif |
53 |
|
|
|