]> git.sur5r.net Git - bacula/bacula/blob - regress/scripts/cleanup
Make out of freespace non-fatal for removable devices -- i.e. behaves like tape
[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    if [ x${CLOUD_BUCKETNAME} != x ]; then
70       args="${args} -n ${CLOUD_BUCKETNAME}"
71    fi
72    if [ x${CLOUD_ACCESSKEY} != x ]; then
73       args="${args} -a ${CLOUD_ACCESSKEY}"
74    fi
75    if [ x${CLOUD_SECRETKEY} != x ]; then
76       args="${args} -s ${CLOUD_SECRETKEY}"
77    fi
78    if [ x${CLOUD_PROTOCOL} != x ]; then
79       args="${args} -p ${CLOUD_PROTOCOL}"
80    fi
81    if [ x${CLOUD_REGION} != x ]; then
82       args="${args} -r ${CLOUD_REGION}"
83    fi
84    if [ x${CLOUD_DRIVER} != x ]; then
85       args="${args} -y ${CLOUD_DRIVER}"
86    fi
87    if [ x${CLOUD_URISTYLE} != x ]; then
88       args="${args} -u ${CLOUD_URISTYLE}"
89    fi
90    if [ x${CLOUD_BLOBENDPOINT} != x ]; then
91       args="${args} -b ${CLOUD_BLOBENDPOINT}"
92    fi
93    if [ x${CLOUD_TABLEENDPOINT} != x ]; then
94       args="${args} -t ${CLOUD_TABLEENDPOINT}"
95    fi
96    if [ x${CLOUD_QUEUEENDPOINT} != x ]; then
97       args="${args} -q ${CLOUD_QUEUEENDPOINT}"
98    fi
99    ${bin}/bcloud ${args} -v 'Vol' clean
100    ${bin}/bcloud ${args} -v 'vol' clean
101    ${bin}/bcloud ${args} -v 'TestVol' clean   
102    ${bin}/bcloud ${args} -v 'Small' clean   
103    ${bin}/bcloud ${args} -v 'TEST' clean   
104    ${bin}/bcloud ${args} -v 'Backup-' clean
105    # Might report incorrect error if not setup correctly
106    true
107 fi