/[CCFs]/bin/getdeliveries
ViewVC logotype

Annotation of /bin/getdeliveries

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations)
Tue Feb 19 13:57:04 2002 UTC (22 years, 9 months ago) by ccflib
Branch: MAIN
Changes since 1.1: +5 -5 lines
*** empty log message ***

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

  ViewVC Help
Powered by ViewVC 1.1.27