File: driver_atime-preserve_code.txt

package info (click to toggle)
backup2l 1.6-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 448 kB
  • sloc: sh: 3,194; makefile: 7
file content (78 lines) | stat: -rw-r--r-- 2,620 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
75
76
77
78
# Submitted by: Adrian Bunk  (2006-02-07 17:41)
# 
# It was a bit annoying that mutt was no longer able to figure out
# which folders contained new emails after a backup run. This patch 
# fixes this by adding --atime-preserve to invocations of tar.

# default tar driver, but with --atime-preserve
DRIVER_ATIME_TAR ()
{
    case $1 in
        -test)
            require_tools tar
            echo "ok"
            ;;
        -suffix)
            echo "tar"
            ;;
        -create)        # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
            tar cf $3 -T $4 --numeric-owner --no-recursion --atime-preserve 2>&1 \
                | grep -v 'tar: Removing leading .* from .* names'
            ;;
        -toc)           # Arguments: $2 = BID, $3 = archive file name
            tar tf $3 | sed 's#^#/#'
            ;;
        -extract)       # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
            tar x --same-permission --same-owner --numeric-owner -f $3 -T $4 2>&1
            ;;
    esac
}

# default tar.gz driver, but with --atime-preserve
DRIVER_ATIME_TAR_GZ ()
{
    case $1 in
        -test)
            require_tools tar
            echo "ok"
            ;;
        -suffix)
            echo "tar.gz"
            ;;
        -create)        # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
            tar czf $3 -T $4 --no-recursion --atime-preserve 2>&1 \
                | grep -v 'tar: Removing leading .* from .* names'
            ;;
        -toc)           # Arguments: $2 = BID, $3 = archive file name
            tar tzf $3 | sed 's#^#/#'
            ;;
        -extract)       # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
            tar zx --same-permission --same-owner -f $3 -T $4 2>&1
            ;;
    esac
}

# default tar.bz2 driver, but with --atime-preserve
DRIVER_ATIME_TAR_BZ2 ()
{
    case $1 in
        -test)
            require_tools tar bzip2
            echo "ok"
            ;;
        -suffix)
            echo "tar.bz2"
            ;;
        -create)        # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
            tar cjf $3 -T $4 --no-recursion --atime-preserve 2>&1 \
                | grep -v 'tar: Removing leading .* from .* names'
            ;;
        -toc)           # Arguments: $2 = BID, $3 = archive file name
            tar tjf $3 | sed 's#^#/#'
            ;;
        -extract)       # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
            tar jx --same-permission --same-owner -f $3 -T $4 2>&1
            ;;
    esac
}