This file is indexed.

/usr/share/doc/dvbackup/examples/rundvbackup is in dvbackup 1:0.0.4-9.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  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
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/bin/sh
# 
# File: rundvbackup
# Author: Robert Jordens <jordens@debian.org>
# License: GNU General Public License Version 2 (GPLv2), incorporated herein by
# reference
# Id: $Id$
# Warning: read it before you use it
# 
# TODO: how shall we start/stop the recorder in the right moment? 
#       tar takes its time while scanning and filling the buffer

# exit on errors
set -e -x

HOST=$( hostname )
STAMP=$( date '+%Y%m%d%H%M%S' )
# * DIRS sorted by priority but smart: dirs with large files 
#   scattered throughout to reduce underruns) 
#   TODO: write multiplexer/interleaver or a tar that randomizes the list
# * TODO: if you change DIRS between backups that results in consistent 
#   but less known/defined behaviour
DIRS="/etc /home /var /boot /root /bin /sbin /usr /win"
# TODO: has to exist
STATEDIR=/var/lib/dvbackup
FONT=-misc-fixed-medium-r-normal--6-60-75-75-c-40-iso10646-1
LOGOTEMPLATE=/usr/share/doc/dvbackup/examples/logotemplate.ppm

# sequence should be about:
#  0 1 2 2 2 1 2 2 2 1 2 2 2 0 1 2 2 2 1 2 2 2 1 2 2 2 0 .....
# or for example:
#  0 monthly (first saturday of the month)
#  1 weekly (every sunday)
#  2 daily (everyday except sundays and the first saturday of the month)
# requires you to atmost play in 3 backups to get the current state.
# TODO: example crontab
if [ -z "$1" -o "x$1" = "x0" ]; then
        LEVEL=0
        PARENT=""
else
        LEVEL=$1
        # if this fails, we should bail out and TODO: usage
        PARENT=$(( $LEVEL - 1 ))
fi
TITLE=$HOST-l$LEVEL-$STAMP
test -n "$PARENT" && PARENTSTATEFILECOMMON=$STATEDIR/state-$HOST-l$PARENT
test -n "$PARENTSTATEFILECOMMON" && \
	PARENTSTATEFILE=$( readlink $PARENTSTATEFILECOMMON )
THISSTATEFILECOMMON=$STATEDIR/state-$HOST-l$LEVEL
test -e $THISSTATEFILECOMMON && OLDSTATEFILE=$( readlink $THISSTATEFILECOMMON ) 
THISSTATEFILE=$STATEDIR/state-$TITLE
LOGO=$( mktemp -t dvbackup-logo-XXXXXX )
# TODO: nice paragraphing "/home /etc\n/usr /var\n...". This here is 
#       sufficient for 8 lines
DIRSNL=$( echo $DIRS | tr ' ' '\n' )
# TODO: based on
convert -font "$FONT" -draw "text 1,7 '$TITLE'" -draw "text 1,13 '$DIRSNL'" \
        $LOGOTEMPLATE $LOGO

# safe because we have backups of this statefile ($THISSTATEFILE-HighestStamp)
# TODO: missing error handling, roll-back on error/abort
if [ "$LEVEL" = 0 ]; then
        touch $THISSTATEFILE
else
        cp $PARENTSTATEFILE $THISSTATEFILE
fi

(nice -n -10 tar \
        --create \
        --listed-incremental $THISSTATEFILE \
        --label "$TITLE" \
        --ignore-failed-read \
        --blocking-factor 128 \
        --preserve-permissions \
        --same-owner \
        --one-file-system \
        --sparse \
        --verbose --verbose \
        $DIRS \
| rsbep \
| dvbackup \
        --prefix=250 \
        --set-backup-title=$TITLE \
        --set-picture=$LOGO \
        --verbose \
| dvconnect \
        --send \
        --device=/dev/video1394/0 \
        --buffers=1024 \
        --kbuffers=32 \
        --underrun-data=/usr/share/dvbackup/underrun-pal.dv \
        -- - \
) 2>&1 | gzip -3 > $STATEDIR/$TITLE.log.gz

rm -f $LOGO

# TODO: missing log-rotation and statefile aging
rm -f $THISSTATEFILECOMMON
test -e "$OLDSTATEFILE" && bzip2 $OLDSTATEFILE
ln -s $(basename $THISSTATEFILE) $THISSTATEFILECOMMON

# TODO: testing of success of the backup
# dvconnect --device /dev/video1394/0 | dvbackup -t
# dvconnect --device /dev/video1394/0 | dvbackup --decode --verbose | rsbep -d -v
# | tar Ox > /dev/null
# tar --ignore-zeros

# TODO: replay of backups: 
# TODO: this is damn hard at 3MB/sec. overruns guaranteed
# --atime-preserve
#       for i in range(0,levels necessary): do
#            replay backup-$i-HighestStampBelowStampOf($i-1)

# something with cpio
# find $DIRS -print0 | cpio --format=crc --create --null --verbose