/[CCFs]/bin/getdeliveries
ViewVC logotype

Annotation of /bin/getdeliveries

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (hide annotations)
Tue Dec 2 14:47:48 2014 UTC (9 years, 11 months ago) by ccflib
Branch: MAIN
Changes since 1.4: +2 -4 lines
Adapted to sasbld01

1 ccflib 1.5 #!/bin/bash
2 ccflib 1.1 #
3     # + fetch CCF deliveries from the ftp site
4     # + perform basic checks on the packages
5     # + move them to accept/reject directory
6     #
7     # Exit codes (<0 informational)
8     # -1 (255): no new CCF deliveries
9     #
10 ccflib 1.5 # $Id: getdeliveries,v 1.4 2003/11/26 13:22:15 ccflib Exp $
11 ccflib 1.1
12 ccflib 1.2 set -e
13 ccflib 1.1
14     cleanup () {
15     cd ~
16     /bin/rm -fr $tmpdir
17     }
18    
19     me=`basename $0`
20     ##echo $me running at `date`
21    
22 ccflib 1.4 # uploaddir=/ccf/private/incoming
23 ccflib 1.3 uploaddir=~/incoming
24 ccflib 1.1 pkgdir=~/deliveries/packages
25     builtdir=~/deliveries/built
26     rejdir=~/deliveries/rejected
27     tmpdir=~/tmp/tmp$$
28     logfile=~/deliveries/DELIVERY_LOG
29    
30     trap cleanup EXIT
31    
32     mkdir -p $tmpdir $pkgdir $rejdir
33     cd $pkgdir
34     DATE=`date '+%Y%m%d'`
35    
36 ccflib 1.2 cp $uploaddir/* $tmpdir/ 2> /dev/null
37 ccflib 1.1
38     cd $tmpdir
39    
40     flist=`ls *.tgz 2> /dev/null`
41     if [ -z "$flist" ] ; then
42     ## echo No new CCF deliveries.
43     exit -1
44     fi
45    
46     for p in *.tgz
47     do
48     echo New CCF delivery $p
49    
50     trouble=0
51     discard=1
52    
53     pack_name=`basename $p | sed -e 's/-[^-]*\.tgz//'`
54     pack_vers=`basename $p | sed -e 's/^.*-//' -e 's/\.tgz//'`
55     pack_md5=`md5sum $p | awk '{print $1}'`
56    
57     if [ -e $pkgdir/$p -o -e $builtdir/$p ] ; then
58     echo ERROR: $p - already delivered
59     trouble=1
60     else
61    
62     tar xzf $p
63     if [ $? -ne 0 ] ; then
64     echo ERROR: $p ignored - may still be uploading
65     discard=0
66     else
67     echo Package $pack_name $pack_vers
68    
69     cd $pack_name
70    
71     version=`cat VERSION` || discard=1
72     cd ..
73     rm -fr $pack_name
74     fi
75     fi
76    
77     if [ $trouble -ne 0 ] ; then
78     echo ERROR: $p is rejected
79     mv -f $p $rejdir
80     echo $pack_md5 $DATE $p " - REJECTED" >> $logfile
81     else
82     echo $p is accepted
83     mv -f $p $pkgdir
84     echo $pack_md5 $DATE $p >> $logfile
85     fi
86    
87     if [ $discard -eq 1 ] ; then
88     echo $p removed from upload area
89 ccflib 1.2 rm -f $uploaddir/$p
90 ccflib 1.1 fi
91    
92     done

  ViewVC Help
Powered by ViewVC 1.1.27