• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2
3# Test the copying of a large directory hierarchy...while deleting it.
4
5# Copyright (C) 2003-2006 IBM
6#
7# This program is free software; you can redistribute it and/or
8# modify it under the terms of the GNU General Public License as
9# published by the Free Software Foundation; either version 2 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful, but
13# WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15# General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program; if not, write to the Free Software
19# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
20# 02111-1307, USA.
21
22TREE_DEST="$POUNDER_TMPDIR/copytree/"
23
24# Set up the erase
25trap 'echo Cleaning up...; rm -rf "$TREE_DEST"; echo Clean.; exit 0'  1 2 15
26
27# Copy the data
28mkdir -p "$TREE_DEST"
29cp -pRdu /usr "$TREE_DEST"
30
31# Compare the data
32diff -Naur /usr "$TREE_DEST/usr/" | tee "$POUNDER_TMPDIR/copytree.diff"
33
34# Clean up
35rm -rf "$TREE_DEST"
36
37# Anything in the diff?
38DIFF_ERRORS=`wc -l < $POUNDER_TMPDIR/copytree.diff`
39if [ $DIFF_ERRORS -gt 0 ]; then
40        exit $DIFF_ERRORS
41fi
42
43exit 0
44