rsbackup-3.0/ 0000775 0001750 0001750 00000000000 12635241747 010204 5 0000000 0000000 rsbackup-3.0/scripts/ 0000775 0001750 0001750 00000000000 12635241746 011672 5 0000000 0000000 rsbackup-3.0/scripts/dist 0000775 0001750 0001750 00000005265 12561432221 012477 0000000 0000000 #! /bin/sh
#
# This file is part of rsbackup
# Copyright (C) 2010, 2011, 2013-15 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 .
set -e
# s COMMAND...
#
# Echo a command then execute it.
s() {
echo "$@" >&2
"$@"
}
hostname=$(uname -n)
# r HOST COMMAND...
#
# Echo a command then execute it remotely.
r() {
h=$1
shift
echo "$h:" "$@" >&2
case "$h" in
chroot:* )
(
cd
schroot -pc${h#chroot:} -- bash -c "$@"
)
;;
* )
ssh $h "$@"
;;
esac
}
# build HOST ARCH
#
# Create a .deb on HOST for architecture ARCH, then copy it back here
# and add it to the list of build products.
build() {
host=$1
arch=$2
debs=""
for b in $binpkgs; do
debs="$debs ${b}_${version}_${arch}.deb"
done
echo
echo "Build on $host for $arch"
echo
r $host "mkdir -p _builds"
r $host "cd _builds && rm -rf ${source} ${archive} ${debs}"
case "$host" in
chroot:* )
cp ${archive} $HOME/_builds/.
;;
* )
s scp ${archive} $host:_builds/.
;;
esac
r $host "cd _builds && tar xfz ${archive}"
r $host "cd _builds/${source} && debian/rules build"
r $host "cd _builds/${source} && fakeroot debian/rules binary"
for deb in $debs; do
case "$host" in
chroot:* )
cp $HOME/_builds/$deb products/
;;
* )
s scp $host:_builds/$deb products/
;;
esac
done
echo
echo "Built $debs"
echo
}
rm -rf products
mkdir products
# Build the source archive
s make -C doc html
s make distcheck
srcpkg=rsbackup # source package name
binpkgs="rsbackup" # binary packages
version=$(make echo-version) # get version number
source=${srcpkg}-${version} # source directory
archive=${srcpkg}-${version}.tar.gz # tarball
# Build .deb files
s build araminta amd64 # jessie
#s build chroot:wheezy32 i386 # wheezy
cp ${archive} doc/*.html doc/*.css products/.
rm -f products/*.in.html
mv products//CHANGES.html products/rsbackup-CHANGES.html
lintian -i -I products/*.deb
cd products
for f in *.tar.gz *.deb; do
echo
echo "* Signing $f ..."
echo
gpg -a -b "$f"
done
cd ..
ls -l products
rsbackup-3.0/scripts/fakeshell.sh 0000664 0001750 0001750 00000016520 12367444200 014100 0000000 0000000 # Copyright © 2014 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 .
#
# fake_init [OPTIONS]
#
# Creates fake workspace directory.
#
# Options:
# --autoclean Clean up workspace on exit (default)
# --no-autoclean Don't clean up worksapce on exit
#
fake_init() {
local autoclean=true
if [ ! -z "${fake_work}" ]; then
echo "ERROR: fake_init already called" >&2
exit 1
fi
while [ $# -gt 0 ]; do
case "$1" in
--autoclean )
autoclean=true
shift
;;
--no-autoclean )
autoclean=false
shift
;;
* )
echo "ERROR: fake_init: unknown option '$1'" >&2
exit 1
;;
esac
done
fake_work=`mktemp -d ${TMPDIR:-/tmp}/tmp.XXXXXXXXXX`
PATH="${fake_work}/faked:${PATH}"
export PATH
if $autoclean; then
trap fake_cleanup EXIT INT HUP TERM
fi
}
#
# fake_reset
#
# Clears the set of faked commands. Use this before each test.
#
fake_reset() {
if [ -z "${fake_work}" ]; then
echo "ERROR: fake_init not called" >&2
exit 1
fi
rm -rf "${fake_work}/faked" "${fake_work}/checks"
mkdir "${fake_work}/faked" "${fake_work}/checks"
fake_failed=false
}
#
# fake_cmd [OPTIONS] NAME [CMD] [--must-args ARGS]
#
# Create a faked command called NAME which executes CMD.
# The default value of CMD is 'true'.
#
# Options:
# --must-run This command must be run (see fake_check)
# --must-not-run This command must not be run (see fake_check)
# --must-args Require a specific argument sequence
#
fake_cmd() {
local name cmd must_run must_not_run must_args arg argno limit
must_run=false
must_not_run=false
must_args=false
if [ ! -d "${fake_work}/faked" ]; then
echo "ERROR: fake_reset not called" >&2
exit 1
fi
while [ $# -gt 0 ]; do
case "$1" in
--must-run )
must_run=true
shift
;;
--must-not-run )
must_not_run=true
shift
;;
-* )
echo "ERROR: fake_cmd: unknown option '$1'" >&2
exit 1
;;
* )
break
;;
esac
done
name="$1"
shift
if [ $# -gt 0 ] && [ "$1" != --must-args ]; then
cmd="$1"
shift
else
cmd=true
fi
if [ $# -gt 0 ] && [ "$1" = --must-args ]; then
must_args=true
shift
else
must_args=false
fi
echo "#! /usr/bin/env bash" > "${fake_work}/faked/${name}"
echo "set -e" >> "${fake_work}/faked/${name}"
# echo "echo \$0 \"\$@\" >&2" >> "${fake_work}/faked/${name}"
if $must_run; then
echo "ERROR: ${name}: was not run" > "${fake_work}/checks/${name}.run"
echo "rm -f ${fake_work}/checks/${name}.run" \
>> "${fake_work}/faked/${name}"
fi
if $must_not_run; then
echo "echo ERROR: ${name}: was run unexpectedly >> ${fake_work}/checks/${name}.errors" \
>> "${fake_work}/faked/${name}"
fi
if $must_args; then
echo "if [ \$# != $# ]; then" >> "${fake_work}/faked/${name}"
echo " echo ERROR: ${name}: expected $# args got \$# >> ${fake_work}/checks/${name}.errors" \
>> "${fake_work}/faked/${name}"
echo "fi" >> "${fake_work}/faked/${name}"
n=1
limit=$#
while [ $n -le $limit ]; do
echo "if [ \"\$$n\" != \"$1\" ]; then" \
>> "${fake_work}/faked/${name}"
echo " echo ERROR: ${name}: arg $n: expected $1 got \$$n >> ${fake_work}/checks/${name}.errors" \
>> "${fake_work}/faked/${name}"
echo "fi" >> "${fake_work}/faked/${name}"
n=$(($n+1))
shift
done
fi
echo "$cmd" >> "${fake_work}/faked/${name}"
chmod +x "${fake_work}/faked/${name}"
}
#
# fake_run [OPTIONS] [--] COMMAND ...
#
# Runs a command and checks its exit status.
# Default is to insist that it exists with status 0.
#
# Options:
# --must-exit STATUS must exit with a particular status
# --must-output STRING must write a particular string to stdout
# --must-output-empty must write nothing to stdout
#
#
fake_run() {
local must_exit must_output must_output_set must_output_empty status
must_exit=0
must_output_set=false
must_output_empty=false
while [ $# -gt 0 ]; do
case "$1" in
--must-exit )
shift
must_exit="$1"
shift
;;
--must-output )
shift
must_output="$1"
must_output_set=true
shift
;;
--must-output-empty )
must_output_empty=true
shift
;;
-- )
shift
break
;;
-* )
echo "ERROR: fake_run: unknown option '$1'" >&2
exit 1
;;
* )
break
;;
esac
done
if $must_output_set || $must_output_empty; then
if $must_output_empty; then
touch "${fake_work}/expected"
else
echo "$must_output" > "${fake_work}/expected"
fi
set +e
"$@" > "${fake_work}/got"
status=$?
set -e
else
set +e
"$@"
status=$?
set -e
fi
if [ $status != $must_exit ]; then
echo "ERROR: $1 exited with status $status (expected $must_exit)" >&2
exit 1
fi
if $must_output_set || $must_output_empty; then
if ! diff -ruN "${fake_work}/expected" "${fake_work}/got" \
> "${fake_work}/diff"; then
echo "ERROR: $1 gave unexpected output" >&2
cat "${fake_work}/diff" >&2
exit 1
fi
fi
}
# fake_check [OPTIONS]
#
# Reports any --must-* violations (see fake_cmd).
#
# Options:
# --expected-fail Don't terminate on failure
#
fake_check() {
local fatal failed
fatal=true
failed=false
if [ ! -d "${fake_work}/faked" ]; then
echo "ERROR: fake_reset not called" >&2
exit 1
fi
while [ $# -gt 0 ]; do
case "$1" in
--expected-fail )
fatal=false
shift
;;
* )
echo "ERROR: fake_check: unknown option '$1'" >&2
exit 1
;;
esac
done
for f in "${fake_work}/checks/"*; do
if [ -f "${f}" ]; then
cat "${f}" >&2
failed=true
fi
done
if $fatal && $failed; then
exit 1
fi
}
#
# fake_cleanup
#
# Remove workspace directory. Run by default on termination by default
# (see fake_init).
#
fake_cleanup() {
if [ -z "${fake_work}" ]; then
rm -rf "${fake_work}"
unset fake_work
fi
}
rsbackup-3.0/scripts/txt2src 0000775 0001750 0001750 00000001636 12103242262 013137 0000000 0000000 #! /usr/bin/perl -w
# Copyright © 2011 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 .
use strict;
my $symbol = shift;
(print "char $symbol\[] =\n")
or die "$!\n";
while(<>) {
s/[\"\\]/\\$&/g;
s/\n/\\n/g;
(print "\"$_\"\n") or die "$!\n";
}
(print ";\n") or die "$!\n";
(close STDOUT) or die "$!\n";
rsbackup-3.0/scripts/htmlman 0000775 0001750 0001750 00000004142 11646266233 013200 0000000 0000000 #! /bin/sh
#
# This file is part of DisOrder
# Copyright (C) 2004, 2005, 2007, 2008, 2010 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 .
#
set -e
stdhead=false
extension="html"
GNUSED=${GNUSED:-sed}
while test $# -gt 0; do
case "$1" in
-stdhead )
stdhead=true
;;
-extension )
shift
extension=$1
;;
-- )
shift
break
;;
-* )
echo >&2 "ERROR: unknown option $1"
exit 1
;;
* )
break
;;
esac
shift
done
for page; do
title=$(basename $page)
output=$page.$extension
echo "$page -> $output" >&2
exec > $output.new
echo ""
echo "
"
if $stdhead; then
echo "@quiethead@#"
fi
echo " $title"
echo " "
echo " "
if $stdhead; then
echo "@stdmenu{}@#"
fi
printf " "
# this is kind of painful using only BREs
nroff -Tascii -man "$page" | ${GNUSED} \
'1d;$d;
1,/./{/^$/d};
s/&/\&/g;
s/\</g;
s/>/\>/g;
s/@/\@/g;
s!\(.\)\1!\1!g;
s!\(&[#0-9a-z][0-9a-z]*;\)\1!\1!g;
s!_\(.\)!\1!g;
s!_\(&[#0-9a-z][0-9a-z]*;\)!\1!g;
s!\([bi]\)><\1>!!g'
echo "
"
if $stdhead; then
echo "@credits"
fi
echo " "
echo ""
mv $output.new $output
done
rsbackup-3.0/src/ 0000775 0001750 0001750 00000000000 12635241746 010772 5 0000000 0000000 rsbackup-3.0/src/PruneNever.cc 0000664 0001750 0001750 00000002072 12620463022 013276 0000000 0000000 // Copyright © 2015 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 .
#include
#include "rsbackup.h"
#include "Prune.h"
/** @brief The @c never pruning policy */
class PruneNever: public PrunePolicy {
public:
PruneNever(): PrunePolicy("never") {}
void validate(const Volume *) const override {}
void prunable(std::vector &,
std::map &,
int) const override {
}
} prune_never;
rsbackup-3.0/src/EventLoop.h 0000664 0001750 0001750 00000020457 12626574404 013006 0000000 0000000 //-*-C++-*-
// Copyright © 2015 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 .
#ifndef EVENTLOOP_H
#define EVENTLOOP_H
/** @file EventLoop.h
* @brief Asynchronous operations
*
* To manage asynchronous operations:
* - create a single @ref EventLoop object
* - create file descriptors and subprocesses
* - create @ref Reactor objects to handle I/O, timeouts and subprocesses
* - attach the reactor objects to the event loop
* - use @ref EventLoop::wait to start processing events
*
* Note that the event loop should be created before any subprocesses are
* created; otherwise the signal handling will not work properly.
*/
#include