File: issue70

package info (click to toggle)
rsbackup 10.0-4
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 1,908 kB
  • sloc: cpp: 10,859; sh: 2,566; makefile: 387; perl: 11
file content (74 lines) | stat: -rwxr-xr-x 2,388 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#! /bin/sh
# Copyright © 2011, 2012, 2014, 2015, 2017, 2019 Richard Kettlewell.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
set -e
. ${srcdir:-.}/setup.sh

setup

get_inode() {
    ls -li "$1" | awk '{print $1}'
}

# Suppress backup linking for volume 2
while IFS="" read -r line; do
    case "$line" in
    *"volume volume2"* )
        echo "$line"
        echo "    rsync-link-dest false"
        ;;
    * )
        echo "$line"
        ;;
    esac
done < ${WORKSPACE}/config > ${WORKSPACE}/config.new
mv ${WORKSPACE}/config.new ${WORKSPACE}/config

echo "| Create first backup"
RUN=all RSBACKUP_TIME=315532800 s ${RSBACKUP} --backup 
echo "| Create second backup"
RUN=all RSBACKUP_TIME=315619200 s ${RSBACKUP} --backup 
echo "| Modify file"
echo >> ${WORKSPACE}/volume1/file1
echo "| Create third backup"
RUN=all RSBACKUP_TIME=315705600 s ${RSBACKUP} --backup

echo "| Check that backup linking works"
i1_1=$(get_inode "${WORKSPACE}/store1/host1/volume1/1980-01-01T00:00:00/file1")
i1_2=$(get_inode "${WORKSPACE}/store1/host1/volume1/1980-01-02T00:00:00/file1")
i1_3=$(get_inode "${WORKSPACE}/store1/host1/volume1/1980-01-03T00:00:00/file1")
if [ $i1_1 != $i1_2 ]; then
    echo >&2 "ERROR: inode mismatch file1: 1/2"
    exit 1
fi
if [ $i1_2 == $i1_3 ]; then
    echo >&2 "ERROR: unexpected inode match file1: 2/3"
    exit 1
fi

i4_1=$(get_inode "${WORKSPACE}/store1/host1/volume2/1980-01-01T00:00:00/dir2/file4")
i4_2=$(get_inode "${WORKSPACE}/store1/host1/volume2/1980-01-02T00:00:00/dir2/file4")
i4_3=$(get_inode "${WORKSPACE}/store1/host1/volume2/1980-01-03T00:00:00/dir2/file4")
if [ $i4_1 == $i4_2 ]; then
    echo >&2 "ERROR: unexpected inode match file4: 1/2"
    exit 1
fi
if [ $i4_2 == $i4_3 ]; then
    echo >&2 "ERROR: unexpected inode match file4: 2/3"
    exit 1
fi


cleanup