]> git.sur5r.net Git - bacula/bacula/blob - regress/scripts/cleanup
9f5fbbb53f65c1db30bd4ac8f1a9d021b0ebb541
[bacula/bacula] / regress / scripts / cleanup
1 #!/bin/sh
2 #
3 # Copyright (C) 2000-2016 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
5 #
6 # Cleanup left over files -- both before and after test run
7 #
8 . scripts/functions
9
10 cwd=`pwd`
11 chmod -R u+rwx ${tmp}
12 rm -rf ${tmp}/FileVolume*
13 rm -rf ${tmp}/TestVolume001 ${tmp}bacula-restores ${tmp}/Small*
14 rm -rf ${tmp}/sed_tmp ${tmp}/file-list
15 rm -rf ${tmp}/*
16 rm -rf ${working}/log ${tmp}/TEST-*
17 rm -rf ${working}/log ${tmp}/Backup-*
18 rm -rf ${working}/*.bsr ${working}/log*.sd
19 rm -rf ${working}/*.trace ${working}/*.traceback ${working}/*.state
20 rm -rf ${working}/@*
21 rm -rf ${working}/*
22 rm -rf ${tmp}disk-changer
23 rm -f ${cwd}/bin/plugins/test-plugin-fd.so
24 rm -rf ${cwd}/mnt
25 find . -name "gigaslam.gif" -exec rm -f {} \;
26
27
28 # bin directory does not always exist
29 if [ -d ${bin} ] ; then
30   if [ -f ${bin}/bacula ] ; then
31      ${bin}/bacula stop -KILL 2>&1 >/dev/null
32   fi
33 fi
34
35 cd ${scripts}
36 ./drop_bacula_tables      >/dev/null 2>&1
37 ./make_bacula_tables      >/dev/null 2>&1
38 ./grant_bacula_privileges >/dev/null 2>&1
39 cd ${cwd}
40
41 if [ x$USE_VTAPE = xyes ]; then
42    rm -rf ${working}/ach
43 fi
44
45 if [ x$FORCE_DEDUP = xyes ]; then
46    rm -rf ${working}/dde
47    rm -rf ${working}/ddefd
48 fi
49
50 # Remove cloud test volumes
51 if [ x$FORCE_CLOUD = xyes ]; then
52    drv=`echo $CLOUD_DRIVER | tr 'A-Z' 'a-z'`
53    if [ "${drv}" = s3 -o "${drv}" = fakes3 ]; then
54       if [ x${CLOUD_HOSTNAME} != x ]; then
55          if [ x${CLOUD_PROTOCOL} = xHTTPS ]; then
56             endpoint=""
57          else
58             endpoint="--endpoint-url=http://${CLOUD_HOSTNAME}"
59          fi
60       fi
61       if [ x${CLOUD_REGION} != x ]; then
62          region="--region ${CLOUD_REGION}"
63       else
64          region=""
65       fi
66       aws configure set default.s3.signature_version s3v4
67       aws s3 rm s3://${CLOUD_BUCKETNAME} $endpoint --recursive --include 'TestVol*' --include 'Vol*' $region 2>/dev/null >/dev/null
68    fi
69 fi