/[CCFs]/bin/getdeliveries
ViewVC logotype

Annotation of /bin/getdeliveries

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (hide annotations)
Wed Nov 26 13:22:15 2003 UTC (21 years ago) by ccflib
Branch: MAIN
Changes since 1.3: +2 -2 lines
/ccf/private/incoming does not exists and uploaddir is defined twice - removed

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.4 # $Id: getdeliveries,v 1.3 2003/11/26 10:51:05 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.4 # uploaddir=/ccf/private/incoming
25 ccflib 1.3 uploaddir=~/incoming
26 ccflib 1.1 pkgdir=~/deliveries/packages
27     builtdir=~/deliveries/built
28     rejdir=~/deliveries/rejected
29     tmpdir=~/tmp/tmp$$
30     logfile=~/deliveries/DELIVERY_LOG
31    
32     trap cleanup EXIT
33    
34     mkdir -p $tmpdir $pkgdir $rejdir
35     cd $pkgdir
36     DATE=`date '+%Y%m%d'`
37    
38 ccflib 1.2 cp $uploaddir/* $tmpdir/ 2> /dev/null
39 ccflib 1.1
40     cd $tmpdir
41    
42     flist=`ls *.tgz 2> /dev/null`
43     if [ -z "$flist" ] ; then
44     ## echo No new CCF deliveries.
45     exit -1
46     fi
47    
48     for p in *.tgz
49     do
50     echo New CCF delivery $p
51    
52     trouble=0
53     discard=1
54    
55     pack_name=`basename $p | sed -e 's/-[^-]*\.tgz//'`
56     pack_vers=`basename $p | sed -e 's/^.*-//' -e 's/\.tgz//'`
57     pack_md5=`md5sum $p | awk '{print $1}'`
58    
59     if [ -e $pkgdir/$p -o -e $builtdir/$p ] ; then
60     echo ERROR: $p - already delivered
61     trouble=1
62     else
63    
64     tar xzf $p
65     if [ $? -ne 0 ] ; then
66     echo ERROR: $p ignored - may still be uploading
67     discard=0
68     else
69     echo Package $pack_name $pack_vers
70    
71     cd $pack_name
72    
73     version=`cat VERSION` || discard=1
74     cd ..
75     rm -fr $pack_name
76     fi
77     fi
78    
79     if [ $trouble -ne 0 ] ; then
80     echo ERROR: $p is rejected
81     mv -f $p $rejdir
82     echo $pack_md5 $DATE $p " - REJECTED" >> $logfile
83     else
84     echo $p is accepted
85     mv -f $p $pkgdir
86     echo $pack_md5 $DATE $p >> $logfile
87     fi
88    
89     if [ $discard -eq 1 ] ; then
90     echo $p removed from upload area
91 ccflib 1.2 rm -f $uploaddir/$p
92 ccflib 1.1 fi
93    
94     done

  ViewVC Help
Powered by ViewVC 1.1.27