diff -Nur -x '*.orig' -x '*.rej' smeserver-rdiff-backup-0.0.1/root/etc/e-smith/db/configuration/defaults/rdiff-backup/EnableLocal mezzanine_patched_smeserver-rdiff-backup-0.0.1/root/etc/e-smith/db/configuration/defaults/rdiff-backup/EnableLocal --- smeserver-rdiff-backup-0.0.1/root/etc/e-smith/db/configuration/defaults/rdiff-backup/EnableLocal 1970-01-01 10:00:00.000000000 +1000 +++ mezzanine_patched_smeserver-rdiff-backup-0.0.1/root/etc/e-smith/db/configuration/defaults/rdiff-backup/EnableLocal 2006-05-18 12:27:37.151346634 +1000 @@ -0,0 +1 @@ +yes diff -Nur -x '*.orig' -x '*.rej' smeserver-rdiff-backup-0.0.1/root/etc/e-smith/db/configuration/defaults/rdiff-backup/EnableRemote mezzanine_patched_smeserver-rdiff-backup-0.0.1/root/etc/e-smith/db/configuration/defaults/rdiff-backup/EnableRemote --- smeserver-rdiff-backup-0.0.1/root/etc/e-smith/db/configuration/defaults/rdiff-backup/EnableRemote 1970-01-01 10:00:00.000000000 +1000 +++ mezzanine_patched_smeserver-rdiff-backup-0.0.1/root/etc/e-smith/db/configuration/defaults/rdiff-backup/EnableRemote 2006-05-18 12:27:33.139046716 +1000 @@ -0,0 +1 @@ +no diff -Nur -x '*.orig' -x '*.rej' smeserver-rdiff-backup-0.0.1/root/etc/e-smith/db/configuration/defaults/rdiff-backup/RemoteHost mezzanine_patched_smeserver-rdiff-backup-0.0.1/root/etc/e-smith/db/configuration/defaults/rdiff-backup/RemoteHost --- smeserver-rdiff-backup-0.0.1/root/etc/e-smith/db/configuration/defaults/rdiff-backup/RemoteHost 1970-01-01 10:00:00.000000000 +1000 +++ mezzanine_patched_smeserver-rdiff-backup-0.0.1/root/etc/e-smith/db/configuration/defaults/rdiff-backup/RemoteHost 2006-05-18 12:06:09.610028678 +1000 @@ -0,0 +1 @@ +localhost diff -Nur -x '*.orig' -x '*.rej' smeserver-rdiff-backup-0.0.1/root/etc/e-smith/db/configuration/defaults/rdiff-backup/RemotePath mezzanine_patched_smeserver-rdiff-backup-0.0.1/root/etc/e-smith/db/configuration/defaults/rdiff-backup/RemotePath --- smeserver-rdiff-backup-0.0.1/root/etc/e-smith/db/configuration/defaults/rdiff-backup/RemotePath 1970-01-01 10:00:00.000000000 +1000 +++ mezzanine_patched_smeserver-rdiff-backup-0.0.1/root/etc/e-smith/db/configuration/defaults/rdiff-backup/RemotePath 2006-05-18 12:27:24.088625883 +1000 @@ -0,0 +1 @@ +/media/usbdisk/rdiff-backup diff -Nur -x '*.orig' -x '*.rej' smeserver-rdiff-backup-0.0.1/root/etc/e-smith/templates/root/.ssh/config/50rdiff-backup mezzanine_patched_smeserver-rdiff-backup-0.0.1/root/etc/e-smith/templates/root/.ssh/config/50rdiff-backup --- smeserver-rdiff-backup-0.0.1/root/etc/e-smith/templates/root/.ssh/config/50rdiff-backup 1970-01-01 10:00:00.000000000 +1000 +++ mezzanine_patched_smeserver-rdiff-backup-0.0.1/root/etc/e-smith/templates/root/.ssh/config/50rdiff-backup 2006-05-18 12:44:58.209946495 +1000 @@ -0,0 +1,22 @@ +{ + return "# rdiff-backup: EnableRemote is no" + if (${'rdiff-backup'}{EnableRemote} ne 'yes'); + + my $host = ${'rdiff-backup'}{RemoteHost} || 'localhost'; + + return "# rdiff-backup: RemoteHost is localhost" + if ($host eq 'localhost'); + + my $identity = ${'rdiff-backup'}{RemoteIdentity} || undef; + + return "# rdiff-backup: No RemoteIdentity for $host" + if (!$identity); + + $OUT =<<"END_OF_HERE"; + +Host rdiff-backup-$host + Hostname $host + IdentityFile $identity + +END_OF_HERE +} diff -Nur -x '*.orig' -x '*.rej' smeserver-rdiff-backup-0.0.1/root/sbin/e-smith/do_rdiff-backup mezzanine_patched_smeserver-rdiff-backup-0.0.1/root/sbin/e-smith/do_rdiff-backup --- smeserver-rdiff-backup-0.0.1/root/sbin/e-smith/do_rdiff-backup 2006-05-18 12:51:51.415034961 +1000 +++ mezzanine_patched_smeserver-rdiff-backup-0.0.1/root/sbin/e-smith/do_rdiff-backup 2006-05-18 12:51:42.770539174 +1000 @@ -1,28 +1,61 @@ #!/bin/sh +#---------------------------------------------------------------------- +# smeserver-rdiff-backup +# Copyright (C) 2005-2006 Gordon Rowell +# +# 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 2 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 or more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +#---------------------------------------------------------------------- -/sbin/e-smith/config get rdiff-backup || exit 0 +/sbin/e-smith/config get rdiff-backup >/dev/null || exit 0 -BACKUP_PATH=$(/sbin/e-smith/config getprop rdiff-backup BackupPath) - -if [ ! -d $BACKUP_PATH ] -then - echo "$BACKUP_PATH does not exist - is it mounted?" - exit 1 -fi +ID=$(/sbin/e-smith/config getprop sysconfig SystemID) FORCE="--force" -ID=$(/sbin/e-smith/config getprop sysconfig SystemID) +RDIFF_BACKUP="/usr/bin/rdiff-backup" +OPTIONS="--include-globbing-filelist /etc/rdiff-backup.filelist" +OPTIONS="$OPTIONS --exclude /" +OPTIONS="$OPTIONS $FORCE" + +/sbin/e-smith/signal-event pre-backup || exit 1 -DIR=$BACKUP_PATH/$ID +if [ $(/sbin/e-smith/config getprop rdiff-backup EnableLocal) = 'yes' ] +then + BACKUP_PATH=$(/sbin/e-smith/config getprop rdiff-backup BackupPath) + + if [ ! -d $BACKUP_PATH ] + then + echo "$BACKUP_PATH does not exist - is it mounted?" + exit 2 + fi + + $RDIFF_BACKUP $OPTIONS / $BACKUP_PATH/$ID || exit 3 +fi -[ -d $DIR ] || mkdir -p $DIR +if [ $(/sbin/e-smith/config getprop rdiff-backup EnableRemote) = 'yes' ] +then + REMOTE_PATH=$(/sbin/e-smith/config getprop rdiff-backup RemotePath) -/sbin/e-smith/signal-event pre-backup || exit 2 + REMOTE_HOST=$(/sbin/e-smith/config getprop rdiff-backup RemoteHost) -/usr/bin/rdiff-backup --include-globbing-filelist /etc/rdiff-backup.filelist \ - --exclude / \ - $FORCE \ - / $DIR || exit 3 + if [ $REMOTE_HOST = "localhost" ] + then + echo "$0: Skipping remote backup to localhost" + else + $RDIFF_BACKUP $OPTIONS / $REMOTE_HOST::$REMOTE_PATH/$ID || exit 4 + fi +fi -/sbin/e-smith/signal-event post-backup || exit 4 +/sbin/e-smith/signal-event post-backup || exit 5