2
# Copyright © 2005-2007 Roger Leigh <rleigh@debian.org>
4
# schroot is free software: you can redistribute it and/or modify it
5
# under the terms of the GNU General Public License as published by
6
# the Free Software Foundation, either version 3 of the License, or
7
# (at your option) any later version.
9
# schroot is distributed in the hope that it will be useful, but
10
# WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
# General Public License for more details.
14
# You should have received a copy of the GNU General Public License
15
# along with this program. If not, see
16
# <http://www.gnu.org/licenses/>.
18
#####################################################################
22
if [ -f "$CHROOT_SCRIPT_CONFIG" ]; then
23
. "$CHROOT_SCRIPT_CONFIG"
26
if [ "$AUTH_VERBOSITY" = "verbose" ]; then
30
# Copy a file if the source and destination differ
32
# $2: destination file
39
da=$(/usr/bin/stat --format="%d %i" "$1")
40
db=$(/usr/bin/stat --format="%d %i" "$2")
43
ca=$(/usr/bin/md5sum "$1" | sed -e 's/\(^[0-9a-f][0-9a-f]*\).*$/\1/')
44
cb=$(/usr/bin/md5sum "$2" | sed -e 's/\(^[0-9a-f][0-9a-f]*\).*$/\1/')
46
# Copy if files are different
47
if [ "$da" != "$db" ]; then
48
if [ "$ca" != "$cb" ]; then
55
# Copy if destination file does not exist
61
echo "W: Not copying nonexistent file: $file"
65
if [ $1 = "setup-start" ] || [ $1 = "setup-recover" ]; then
67
if echo "$file" | grep -q '^/'; then
68
copy_file "$file" "${CHROOT_PATH}$file"
70
echo "W: Not copying file with relative path: $file"