#!/bin/sh # # Copyright (C) 2000-2016 Kern Sibbald # License: BSD 2-Clause; see file LICENSE-FOSS # # Cleanup left over files -- both before and after test run # . scripts/functions cwd=`pwd` chmod -R u+rwx ${tmp} rm -rf ${tmp}/FileVolume* rm -rf ${tmp}/TestVolume001 ${tmp}bacula-restores ${tmp}/Small* rm -rf ${tmp}/sed_tmp ${tmp}/file-list rm -rf ${tmp}/* rm -rf ${working}/log ${tmp}/TEST-* rm -rf ${working}/log ${tmp}/Backup-* rm -rf ${working}/*.bsr ${working}/log*.sd rm -rf ${working}/*.trace ${working}/*.traceback ${working}/*.state rm -rf ${working}/@* rm -rf ${working}/* rm -rf ${tmp}disk-changer rm -f ${cwd}/bin/plugins/test-plugin-fd.so rm -rf ${cwd}/mnt find . -name "gigaslam.gif" -exec rm -f {} \; # bin directory does not always exist if [ -d ${bin} ] ; then if [ -f ${bin}/bacula ] ; then ${bin}/bacula stop -KILL 2>&1 >/dev/null fi fi cd ${scripts} ./drop_bacula_tables >/dev/null 2>&1 ./make_bacula_tables >/dev/null 2>&1 ./grant_bacula_privileges >/dev/null 2>&1 cd ${cwd} if [ x$USE_VTAPE = xyes ]; then rm -rf ${working}/ach fi if [ x$FORCE_DEDUP = xyes ]; then rm -rf ${working}/dde rm -rf ${working}/ddefd fi # Remove cloud test volumes if [ x$FORCE_CLOUD = xyes ]; then drv=`echo $CLOUD_DRIVER | tr 'A-Z' 'a-z'` if [ "${drv}" = s3 -o "${drv}" = fakes3 ]; then if [ x${CLOUD_HOSTNAME} != x ]; then if [ x${CLOUD_PROTOCOL} = xHTTPS ]; then endpoint="" else endpoint="--endpoint-url=http://${CLOUD_HOSTNAME}" fi fi if [ x${CLOUD_REGION} != x ]; then region="--region ${CLOUD_REGION}" else region="" fi aws configure set default.s3.signature_version s3v4 aws s3 rm s3://${CLOUD_BUCKETNAME} $endpoint --recursive --include 'TestVol*' --include 'Vol*' $region 2>/dev/null >/dev/null fi if [ x${CLOUD_BUCKETNAME} != x ]; then args="${args} -n ${CLOUD_BUCKETNAME}" fi if [ x${CLOUD_ACCESSKEY} != x ]; then args="${args} -a ${CLOUD_ACCESSKEY}" fi if [ x${CLOUD_SECRETKEY} != x ]; then args="${args} -s ${CLOUD_SECRETKEY}" fi if [ x${CLOUD_PROTOCOL} != x ]; then args="${args} -p ${CLOUD_PROTOCOL}" fi if [ x${CLOUD_REGION} != x ]; then args="${args} -r ${CLOUD_REGION}" fi if [ x${CLOUD_DRIVER} != x ]; then args="${args} -y ${CLOUD_DRIVER}" fi if [ x${CLOUD_URISTYLE} != x ]; then args="${args} -u ${CLOUD_URISTYLE}" fi if [ x${CLOUD_BLOBENDPOINT} != x ]; then args="${args} -b ${CLOUD_BLOBENDPOINT}" fi if [ x${CLOUD_TABLEENDPOINT} != x ]; then args="${args} -t ${CLOUD_TABLEENDPOINT}" fi if [ x${CLOUD_QUEUEENDPOINT} != x ]; then args="${args} -q ${CLOUD_QUEUEENDPOINT}" fi ${bin}/bcloud ${args} -v 'Vol' clean ${bin}/bcloud ${args} -v 'vol' clean ${bin}/bcloud ${args} -v 'TestVol' clean ${bin}/bcloud ${args} -v 'Small' clean ${bin}/bcloud ${args} -v 'TEST' clean ${bin}/bcloud ${args} -v 'Backup-' clean # Might report incorrect error if not setup correctly true fi