~louis/ubuntu/trusty/clamav/lp799623_fix_logrotate

« back to all changes in this revision

Viewing changes to contrib/split-tarball.sh

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2010-03-12 11:30:04 UTC
  • mfrom: (0.41.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20100312113004-b0fop4bkycszdd0z
Tags: 0.96~rc1+dfsg-0ubuntu1
* New upstream RC - FFE (LP: #537636):
  - Add OfficialDatabaseOnly option to clamav-base.postinst.in
  - Add LocalSocketGroup option to clamav-base.postinst.in
  - Add LocalSocketMode option to clamav-base.postinst.in
  - Add CrossFilesystems option to clamav-base.postinst.in
  - Add ClamukoScannerCount option to clamav-base.postinst.in
  - Add BytecodeSecurity opiton to clamav-base.postinst.in
  - Add DetectionStatsHostID option to clamav-freshclam.postinst.in
  - Add Bytecode option to clamav-freshclam.postinst.in
  - Add MilterSocketGroup option to clamav-milter.postinst.in
  - Add MilterSocketMode option to clamav-milter.postinst.in
  - Add ReportHostname option to clamav-milter.postinst.in
  - Bump libclamav SO version to 6.1.0 in libclamav6.install
  - Drop clamdmon from clamav.examples (no longer shipped by upstream)
  - Drop libclamav.a from libclamav-dev.install (not built by upstream)
  - Update SO version for lintian override for libclamav6
  - Add new Bytecode Testing Tool, usr/bin/clambc, to clamav.install
  - Add build-depends on python and python-setuptools for new test suite
  - Update debian/copyright for the embedded copy of llvm (using the system
    llvm is not currently feasible)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/bash
2
 
# Split an upstream tarball into +dfsg, and libclamunrar.
3
 
if test $# -ne 2; then
4
 
    echo -e "Usage: $0 <PATH> <VERSION>\n\t<PATH> - directory that contains clamav-<VERSION>.tar.gz";
5
 
    exit 1;
6
 
fi
7
 
 
8
 
test -d $1 || { echo "Directory $1 doesn't exist"; exit 2; }
9
 
TARBALL="$PWD/$1/clamav-$2.tar.gz"
10
 
test -f $TARBALL || { echo "Tarball $TARBALL doesn't exist"; exit 3; }
11
 
 
12
 
TEMP=`mktemp -d __splitXXXXXX` || { echo "Cannot create temporary directory"; exit 2; }
13
 
echo "Temporary directory is $TEMP"
14
 
cd $TEMP || exit 3;
15
 
echo "Extracting $TARBALL";
16
 
tar -xzf $TARBALL || { echo "Failed to extract $TARBALL"; exit 4; }
17
 
 
18
 
UNRARPKG=libclamunrar_$2.orig.tar.gz
19
 
DFSGPKG=clamav_$2+dfsg.orig.tar.gz
20
 
UNRARDIR="libclamunrar-$2"
21
 
MAKEFLAGS=-j4
22
 
 
23
 
set -e
24
 
 
25
 
mv clamav-$2 clamav-$2+dfsg
26
 
mkdir $UNRARDIR
27
 
UNRARDIR="$PWD/$UNRARDIR"
28
 
echo "Preparing dfsg package"
29
 
cd clamav-$2+dfsg
30
 
cp -R libclamunrar_iface $UNRARDIR
31
 
mv libclamunrar $UNRARDIR
32
 
cp -R m4/ $UNRARDIR
33
 
cp -R config/ $UNRARDIR
34
 
cp configure.in $UNRARDIR
35
 
cp COPYING{,.unrar,.LGPL} $UNRARDIR
36
 
cd ../
37
 
tar -czf $DFSGPKG clamav-$2+dfsg/
38
 
cd $UNRARDIR
39
 
echo "Preparing unrar package"
40
 
sed -i '/AC_OUTPUT/,/])/ {
41
 
/^AC_OUTPUT/p
42
 
s/^libclamav\/Makefile/libclamunrar_iface\/Makefile/p
43
 
/^Makefile/p
44
 
/^])/p
45
 
d
46
 
}
47
 
/LTDL/d
48
 
/ltdl/d
49
 
s/clamscan\/clamscan.c/libclamunrar_iface\/unrar_iface.c/
50
 
' configure.in
51
 
cat <<EOF >Makefile.am &&
52
 
ACLOCAL_AMFLAGS=-I m4
53
 
DISTCLEANFILES = target.h
54
 
SUBDIRS = libclamunrar_iface
55
 
EOF
56
 
autoreconf
57
 
cd ..
58
 
tar -czf $UNRARPKG libclamunrar-$2/
59
 
 
60
 
printf "Test archives?"
61
 
read yes
62
 
if [ x$yes != xy ] ; then
63
 
    echo "Copying tarballs to current directory"
64
 
    mv $UNRARPKG ../ &&
65
 
    mv $DFSGPKG ../ &&
66
 
    echo "Ready (untested): $UNRARPKG $DFSGPKG" &&
67
 
    rm -rf $TEMP &&
68
 
    echo "Removed temporary directory $TEMP" &&
69
 
    exit 0
70
 
    exit 30
71
 
fi
72
 
 
73
 
mkdir testpfx || { echo "Failed to create testpfx"; exit 5; }
74
 
TESTPFX="$PWD/testpfx"
75
 
mkdir buildtest && cd buildtest
76
 
echo "Running build-test for $DFSGPKG"
77
 
tar -xzf ../$DFSGPKG && cd clamav-$2+dfsg
78
 
echo "Configuring"
79
 
./configure --disable-clamav --disable-unrar --enable-milter --prefix=$TESTPFX >makelog
80
 
echo "Building"
81
 
make $MAKEFLAGS >>makelog
82
 
echo "Checking"
83
 
make $MAKEFLAGS check >>makelog 2>&1
84
 
make $MAKEFLAGS install >>makelog
85
 
make $MAKFELAGS installcheck >>makelog
86
 
echo "OK"
87
 
cd ..
88
 
echo "Running build-test for $UNRARPKG"
89
 
tar -xzf ../$UNRARPKG && cd libclamunrar-$2
90
 
echo "Configuring"
91
 
./configure --disable-clamav --prefix=$TESTPFX >makelog
92
 
echo "Building"
93
 
make $MAKEFLAGS >>makelog
94
 
make $MAKEFLAGS install >>makelog
95
 
make $MAKEFLAGS installcheck >>makelog
96
 
echo "OK"
97
 
cd ../..
98
 
echo "Testing whether unrar functionality works"
99
 
cat <<EOF >test.hdb
100
 
aa15bcf478d165efd2065190eb473bcb:544:ClamAV-Test-File
101
 
EOF
102
 
 
103
 
if test $? -ne 0; then
104
 
    tail makelog
105
 
    echo
106
 
    echo "Failed"
107
 
    exit 50;
108
 
fi
109
 
# clamscan will exit with exitcode 1 on success (virus found)
110
 
set +e
111
 
$TESTPFX/bin/clamscan buildtest/clamav-$2+dfsg/test/clam-v*.rar -dtest.hdb >clamscanlog
112
 
if test $? -ne 1; then
113
 
    echo "Test failed";
114
 
    cat clamscanlog
115
 
    exit 10;
116
 
fi
117
 
NDET=`grep FOUND clamscanlog | wc -l`
118
 
if test "0$NDET" -eq "2"; then
119
 
    echo "All testfiles detected"
120
 
    echo "Copying tarballs to current directory"
121
 
    mv $UNRARPKG ../ &&
122
 
    mv $DFSGPKG ../ &&
123
 
    echo "Ready: $UNRARPKG $DFSGPKG" &&
124
 
    rm -rf $TEMP &&
125
 
    echo "Removed temporary directory $TEMP" &&
126
 
    exit 0
127
 
    exit 30
128
 
fi
129
 
echo "Test failed"
130
 
cat clamscanlog
131
 
exit 100