1 |
#!/usr/local/bin/bash |
#!/bin/bash |
|
# |
|
|
# Giuseppe Vacanti, January 2000 |
|
2 |
# |
# |
3 |
# + fetch CCF deliveries from the ftp site |
# + fetch CCF deliveries from the ftp site |
4 |
# + perform basic checks on the packages |
# + perform basic checks on the packages |
7 |
# Exit codes (<0 informational) |
# Exit codes (<0 informational) |
8 |
# -1 (255): no new CCF deliveries |
# -1 (255): no new CCF deliveries |
9 |
# |
# |
10 |
# $Id: getdeliveries,v 1.3 2003/11/26 10:51:05 ccflib Exp $ |
# $Id: getdeliveries,v 1.5 2014/12/02 14:47:48 ccflib Exp $ |
11 |
|
|
12 |
set -e |
#set -e (if set it will not produce any output) |
13 |
|
|
14 |
cleanup () { |
cleanup () { |
15 |
cd ~ |
cd ~ |
17 |
} |
} |
18 |
|
|
19 |
me=`basename $0` |
me=`basename $0` |
|
##echo $me running at `date` |
|
20 |
|
|
21 |
# uploaddir=/ccf/private/incoming |
echo |
22 |
|
echo "-> $me running at "`date` |
23 |
|
echo |
24 |
|
|
25 |
uploaddir=~/incoming |
uploaddir=~/incoming |
26 |
pkgdir=~/deliveries/packages |
pkgdir=~/deliveries/packages |
27 |
builtdir=~/deliveries/built |
builtdir=~/deliveries/built |
32 |
trap cleanup EXIT |
trap cleanup EXIT |
33 |
|
|
34 |
mkdir -p $tmpdir $pkgdir $rejdir |
mkdir -p $tmpdir $pkgdir $rejdir |
35 |
|
|
36 |
cd $pkgdir |
cd $pkgdir |
37 |
|
|
38 |
DATE=`date '+%Y%m%d'` |
DATE=`date '+%Y%m%d'` |
39 |
|
|
40 |
cp $uploaddir/* $tmpdir/ 2> /dev/null |
cp $uploaddir/* $tmpdir/ 2> /dev/null |
42 |
cd $tmpdir |
cd $tmpdir |
43 |
|
|
44 |
flist=`ls *.tgz 2> /dev/null` |
flist=`ls *.tgz 2> /dev/null` |
45 |
|
|
46 |
if [ -z "$flist" ] ; then |
if [ -z "$flist" ] ; then |
47 |
## echo No new CCF deliveries. |
echo "$me: No new CCF deliveries." |
48 |
|
echo |
49 |
exit -1 |
exit -1 |
50 |
fi |
fi |
51 |
|
|