summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Kettlewell <rjk@greenend.org.uk>2019-10-01 14:10:28 +0100
committerRichard Kettlewell <rjk@greenend.org.uk>2019-10-06 11:57:23 +0100
commit732efaaa02488528a93a336293ca2f08238f0891 (patch)
treecb91392929678fabf3a89ca99702b10dad9f0b9c
parentf9fdb23fcaa07fa384a0b5dcf9e1677eb5bde4fc (diff)
Rename hook directives
This makes their function a bit clearer. #17
-rw-r--r--doc/CHANGES.html4
-rw-r--r--doc/rsbackup-manual.in.html4
-rw-r--r--doc/rsbackup-snapshot-hook.12
-rw-r--r--doc/rsbackup.544
-rwxr-xr-xscripts/systest4
-rw-r--r--src/Conf.cc12
-rw-r--r--src/Conf.h4
-rw-r--r--src/ConfBase.cc12
-rw-r--r--src/ConfBase.h12
-rw-r--r--src/ConfDirective.cc68
-rw-r--r--src/ConfDirective.h6
-rw-r--r--src/DeviceAccess.cc4
-rw-r--r--src/MakeBackup.cc24
-rw-r--r--tests/expect/issue43/failhook.txt4
-rwxr-xr-xtests/hook10
-rwxr-xr-xtests/setup.sh8
-rwxr-xr-xtools/rsbackup-snapshot-hook.in4
-rwxr-xr-xtools/t-hook-dryrun2
-rwxr-xr-xtools/t-hook-fsck-fail2
-rwxr-xr-xtools/t-hook-fsck-ok2
-rwxr-xr-xtools/t-hook-nosnap2
-rwxr-xr-xtools/t-hook-ok2
-rwxr-xr-xtools/t-hook-post2
23 files changed, 142 insertions, 96 deletions
diff --git a/doc/CHANGES.html b/doc/CHANGES.html
index 587b13f..ed197e1 100644
--- a/doc/CHANGES.html
+++ b/doc/CHANGES.html
@@ -29,6 +29,10 @@
href="https://github.com/ewxrjk/rsbackup/issues/59">issue
#59</a>.</li>
+ <li>The hook directives are renamed, to
+ (<code>pre</code>,<code>post</code>)<code>-</code>(<code>device</code>,<code>volume</code>)<code>-hook</code>. <b>Advance warning</b>: In
+ some future version the old names will be removed.</li>
+
</ul>
<h2>Changes In rsbackup 6.0</h2>
diff --git a/doc/rsbackup-manual.in.html b/doc/rsbackup-manual.in.html
index 4ef33b3..3083124 100644
--- a/doc/rsbackup-manual.in.html
+++ b/doc/rsbackup-manual.in.html
@@ -694,8 +694,8 @@ rsync error: some files/attrs were not transferred (see previous errors) (code 2
can be achieved by adding the following lines to your
configuration file:</p>
- <pre class=example>pre-backup-hook rsbackup-snapshot-hook
-post-backup-hook rsbackup-snapshot-hook</pre>
+ <pre class=example>pre-volume-hook rsbackup-snapshot-hook
+post-volume-hook rsbackup-snapshot-hook</pre>
<p>Then for each volume that is to be snapshotted, create
<code>/snap/<i>VOLUME</i></code> on the target host. The volume
diff --git a/doc/rsbackup-snapshot-hook.1 b/doc/rsbackup-snapshot-hook.1
index d27ada6..0c24d28 100644
--- a/doc/rsbackup-snapshot-hook.1
+++ b/doc/rsbackup-snapshot-hook.1
@@ -19,7 +19,7 @@ rsbackup-snapshot-hook \- rsync-based backup utility
\fBrsbackup-snapshot-hook\fR [\fIOPTIONS\fR]
.SH DESCRIPTION
\fBrsbackup-snapshot-hook\fR creates and removes LVM snapshots when
-configured as a pre- or post-backup-hook for \fBrsbackup\fR(1).
+configured as a pre- or post-volume-hook for \fBrsbackup\fR(1).
.PP
Snapshots will only be created for volumes that have a corresponding
directory in the snapshot directory.
diff --git a/doc/rsbackup.5 b/doc/rsbackup.5
index 58f52e7..6c6ab20 100644
--- a/doc/rsbackup.5
+++ b/doc/rsbackup.5
@@ -87,6 +87,8 @@ The directory to store logfiles and backup records.
The default is \fI/var/log/backup\fR.
.TP
.B post\-access\-hook \fICOMMAND\fR...
+.TP
+.B post\-device\-hook \fICOMMAND\fR...
A command to execute after all backup and prune operations.
This is executed only once per invocation of \fBrsbackup\fR.
A backup is still considered to have succeeded even if the post-access
@@ -94,6 +96,8 @@ hook fails (i.e. exits nonzero).
See \fBHOOKS\fR below.
.TP
.B pre\-access\-hook \fICOMMAND\fR...
+.TP
+.B pre\-device\-hook \fICOMMAND\fR...
A command to execute before anything that accesses any backup devices
(i.e. backup and prune operations).
This is executed only once per invocation of \fBrsbackup\fR and if it
@@ -488,15 +492,19 @@ The default is 3, meaning that if a volume hasn't been backed up in
the last 3 days it will have red ink in the HTML report.
.TP
.B post\-backup\-hook \fICOMMAND\fR...
+.TP
+.B post\-volume\-hook \fICOMMAND\fR...
A command to execute after finishing a backup, or after it failed.
A backup is still considered to have succeeded even if the post-backup
hook fails (exits nonzero).
See \fBHOOKS\fR below.
.TP
.B pre\-backup\-hook \fICOMMAND\fR...
+.TP
+.B pre\-volume\-hook \fICOMMAND\fR...
A command to execute before starting a backup.
If this hook fails (i.e. exits nonzero) then the backup is not made
-and the post-backup hook will not be run.
+and the post-volume-hook will not be run.
See \fBHOOKS\fR below.
.IP
This hook can override the source path for the backup by writing a new
@@ -610,14 +618,14 @@ root of the volume).
It need not be inside the volume though the usual use would be to
check for a file which is always present there.
.IP
-This check is done before executing the \fBpre\-backup\-hook\fR, so it
+This check is done before executing the \fBpre\-volume\-hook\fR, so it
applies to the real path to the volume, not the rewritten path.
.TP
.B check\-mounted true\fR|\fBfalse
If true, checks that the volume's path is a mount point before backing up the
volume.
.IP
-This check is done before executing the \fBpre\-backup\-hook\fR, so it
+This check is done before executing the \fBpre\-volume\-hook\fR, so it
applies to the real path to the volume, not the rewritten path.
.IP
Note that if multiple \fBcheck\-\fR options are used, all checks must
@@ -760,11 +768,11 @@ with the \fB\-c\fR option.
All hooks are run in \fB\-\-dry\-run\fR mode.
Hook scripts must honor \fBRSBACKUP_ACT\fR which will be set to
\fBfalse\fR in this mode and \fBtrue\fR otherwise.
-.SS "Access Hooks"
-Access hooks are executed (once) before doing anything that will
+.SS "Device Hooks"
+Device hooks are executed (once) before doing anything that will
access backup devices (even just to read them).
.PP
-The following environment variables are set when an access hook is executed:
+The following environment variables are set when a device hook is executed:
.TP
.B RSBACKUP_ACT
Set to \fBfalse\fR in \fB\-\-dry\-run\fR mode and \fBtrue\fR
@@ -774,31 +782,33 @@ otherwise.
A space-separated list of known device names.
.TP
.B RSBACKUP_HOOK
-The name of the hook (i.e. \fBpre\-access\-hook\fR, etc).
+The name of the hook (i.e. \fBpre\-device\-hook\fR, etc).
This allows a single hook script to serve as the implementation for
multiple hooks.
-.SS "Backup Hooks"
-Backup hooks are executed just before or just after a backup is
+.PP
+Device hooks used to be called access hooks.
+.SS "Volume Hooks"
+Volume hooks are executed just before or just after a backup is
made.
-Possible uses for backup hooks include snapshotting volumes or mounting volumes.
+Possible uses for volume hooks include snapshotting volumes or mounting volumes.
.PP
-When a backup hook is executed, the environment variables listed in
+When a volume hook is executed, the environment variables listed in
\fBENVIRONMENT\fR below are set, along with the following:
.TP
.B RSBACKUP_HOOK
-The name of the hook (i.e. \fBpre\-backup\-hook\fR, etc).
+The name of the hook (i.e. \fBpre\-volume\-hook\fR, etc).
This allows a single hook script to serve as the implementation for
multiple hooks.
.TP
.B RSBACKUP_STATUS
-(Only for \fBpost\-backup\-hook\fR).
+(Only for \fBpost\-volume\-hook\fR).
Either \fBok\fR or \fBfailed\fR.
.PP
-The error output from backup hooks is stored in the same backup record
+The error output from volume hooks is stored in the same backup record
as the output
from \fBrsync\fR.
.PP
-The exit status of the \fBpre\-backup\-hook\fR is interpreted as follows:
+The exit status of the \fBpre\-volume\-hook\fR is interpreted as follows:
.TP
.B 0
The hook succeeded.
@@ -813,7 +823,7 @@ Something went wrong.
The backup will be treated as failed, as if it had been attempted and \fBrsync\fR had failed.
.PP
.BR NOTE :
-The current behavior is that the pre/post backup hooks are run
+The current behavior is that the pre/post volume hooks are run
separately for each backup.
In a future version, they may be run only once for all backups of a
given volume, in which case \fBRSBACKUP_DEVICE\fR will no longer be
@@ -821,6 +831,8 @@ set.
.PP
See \fBrsbackup\-snapshot\-hook\fR(1) for a hook program that can be
used to back up from Linux LVM snapshots.
+.PP
+Volume hooks used to be called backup hooks.
.SH ENVIRONMENT
When a hook or \fBrsync\fR are executed, the following environment
variables are set:
diff --git a/scripts/systest b/scripts/systest
index 5598354..3711ed0 100755
--- a/scripts/systest
+++ b/scripts/systest
@@ -71,8 +71,8 @@ store ${WORK}/store
device dummy
logs ${WORK}/logs
lock ${WORK}/lock
-pre-backup-hook ${TOOLS}/rsbackup-snapshot-hook
-post-backup-hook ${TOOLS}/rsbackup-snapshot-hook
+pre-volume-hook ${TOOLS}/rsbackup-snapshot-hook
+post-volume-hook ${TOOLS}/rsbackup-snapshot-hook
rsync-timeout 60
hook-timeout 60
host-check command ${SCRIPTS}/host-check
diff --git a/src/Conf.cc b/src/Conf.cc
index f58e910..521fb7f 100644
--- a/src/Conf.cc
+++ b/src/Conf.cc
@@ -92,15 +92,15 @@ void Conf::write(std::ostream &os, int step, bool verbose) const {
d(os, "", step);
d(os, "# Command to run before accessing backup devices", step);
- d(os, "# pre-access-hook COMMAND ...", step);
- if(preAccess.size())
- os << indent(step) << "pre-access-hook " << quote(preAccess) << '\n';
+ d(os, "# pre-device-hook COMMAND ...", step);
+ if(preDevice.size())
+ os << indent(step) << "pre-device-hook " << quote(preDevice) << '\n';
d(os, "", step);
d(os, "# Command to run after accessing backup devices", step);
- d(os, "# pre-access-hook COMMAND ...", step);
- if(postAccess.size())
- os << indent(step) << "post-access-hook " << quote(postAccess) << '\n';
+ d(os, "# pre-device-hook COMMAND ...", step);
+ if(postDevice.size())
+ os << indent(step) << "post-device-hook " << quote(postDevice) << '\n';
d(os, "", step);
d(os, "# Names of backup devices", step);
diff --git a/src/Conf.h b/src/Conf.h
index 4145fb2..6249666 100644
--- a/src/Conf.h
+++ b/src/Conf.h
@@ -122,10 +122,10 @@ public:
std::string sendmail = DEFAULT_SENDMAIL;
/** @brief Pre-access hook */
- std::vector<std::string> preAccess;
+ std::vector<std::string> preDevice;
/** @brief Post-access hook */
- std::vector<std::string> postAccess;
+ std::vector<std::string> postDevice;
/** @brief Path to stylesheet for HTML report output
*
diff --git a/src/ConfBase.cc b/src/ConfBase.cc
index 8025d5e..d58fb0f 100644
--- a/src/ConfBase.cc
+++ b/src/ConfBase.cc
@@ -114,15 +114,15 @@ void ConfBase::write(std::ostream &os, int step, bool verbose) const {
d(os, "", 0);
d(os, "# Command to run prior to making a backup", step);
- d(os, "# pre-backup-hook COMMAND ...", step);
- if(preBackup.size())
- os << indent(step) << "pre-backup-hook " << quote(preBackup) << '\n';
+ d(os, "# pre-volume-hook COMMAND ...", step);
+ if(preVolume.size())
+ os << indent(step) << "pre-volume-hook " << quote(preVolume) << '\n';
d(os, "", 0);
d(os, "# Command to run after making a backup", step);
- d(os, "# post-backup-hook COMMAND ...", step);
- if(postBackup.size())
- os << indent(step) << "post-backup-hook " << quote(postBackup) << '\n';
+ d(os, "# post-volume-hook COMMAND ...", step);
+ if(postVolume.size())
+ os << indent(step) << "post-volume-hook " << quote(postVolume) << '\n';
d(os, "", 0);
d(os, "# Maximum time to wait for rsync to complete", step);
diff --git a/src/ConfBase.h b/src/ConfBase.h
index 09bce59..2e58c21 100644
--- a/src/ConfBase.h
+++ b/src/ConfBase.h
@@ -50,8 +50,8 @@ public:
maxAge(parent->maxAge), backupPolicy(parent->backupPolicy),
backupParameters(parent->backupParameters),
prunePolicy(parent->prunePolicy),
- pruneParameters(parent->pruneParameters), preBackup(parent->preBackup),
- postBackup(parent->postBackup), rsyncTimeout(parent->rsyncTimeout),
+ pruneParameters(parent->pruneParameters), preVolume(parent->preVolume),
+ postVolume(parent->postVolume), rsyncTimeout(parent->rsyncTimeout),
rsyncCommand(parent->rsyncCommand),
rsyncBaseOptions(parent->rsyncBaseOptions),
rsyncExtraOptions(parent->rsyncExtraOptions),
@@ -77,11 +77,11 @@ public:
/** @brief Pruning policy parameters */
std::map<std::string, std::string> pruneParameters;
- /** @brief Pre-backup hook */
- std::vector<std::string> preBackup;
+ /** @brief Pre-volume hook */
+ std::vector<std::string> preVolume;
- /** @brief Post-backup hook */
- std::vector<std::string> postBackup;
+ /** @brief Post-volume hook */
+ std::vector<std::string> postVolume;
/** @brief rsync timeout */
int rsyncTimeout = 0;
diff --git a/src/ConfDirective.cc b/src/ConfDirective.cc
index 57f8eb8..e1e7c10 100644
--- a/src/ConfDirective.cc
+++ b/src/ConfDirective.cc
@@ -34,10 +34,21 @@ ConfDirective::ConfDirective(const char *name_, int min_, int max_,
max(max_) {
if(!directives)
directives = new directives_type();
+ if(!aliases)
+ aliases = new std::set<std::string>();
assert((*directives).find(name) == (*directives).end());
(*directives)[name] = this;
}
+void ConfDirective::alias(const char *name_) {
+ std::string n(name_);
+ assert(directives != nullptr);
+ assert((*directives).find(n) == (*directives).end());
+ (*directives)[n] = this;
+ assert(aliases != nullptr);
+ aliases->insert(n);
+}
+
const ConfDirective *ConfDirective::find(const std::string &name) {
auto it = directives->find(name);
return it == directives->end() ? nullptr : it->second;
@@ -49,6 +60,10 @@ void ConfDirective::check(const ConfContext &cc) const {
throw SyntaxError("too few arguments to '" + name + "'");
if(args > max)
throw SyntaxError("too many arguments to '" + name + "'");
+ if(aliases->find(cc.bits[0]) != aliases->end())
+ warning(WARNING_DEPRECATED,
+ "%s:%d: the '%s' directive is deprecated, use '%s' instead",
+ cc.path.c_str(), cc.line, cc.bits[0].c_str(), name.c_str());
}
bool ConfDirective::get_boolean(const ConfContext &cc) const {
@@ -74,6 +89,7 @@ void ConfDirective::extend(const ConfContext &cc,
}
directives_type *ConfDirective::directives;
+std::set<std::string> *ConfDirective::aliases;
// HostOnlyDirective ----------------------------------------------------------
@@ -268,21 +284,25 @@ static const struct SendmailDirective: public ConfDirective {
}
} sendmail_directive;
-/** @brief The @c pre-access-hook directive */
-static const struct PreAccessHookDirective: public ConfDirective {
- PreAccessHookDirective(): ConfDirective("pre-access-hook", 1, INT_MAX) {}
+/** @brief The @c pre-device-hook directive */
+static const struct PreDeviceHookDirective: public ConfDirective {
+ PreDeviceHookDirective(): ConfDirective("pre-device-hook", 1, INT_MAX) {
+ alias("pre-access-hook");
+ }
void set(ConfContext &cc) const override {
- cc.conf->preAccess.assign(cc.bits.begin() + 1, cc.bits.end());
+ cc.conf->preDevice.assign(cc.bits.begin() + 1, cc.bits.end());
}
-} pre_access_hook_directive;
+} pre_device_hook_directive;
-/** @brief The @c post-access-hook directive */
-static const struct PostAccessHookDirective: public ConfDirective {
- PostAccessHookDirective(): ConfDirective("post-access-hook", 1, INT_MAX) {}
+/** @brief The @c post-device-hook directive */
+static const struct PostDeviceHookDirective: public ConfDirective {
+ PostDeviceHookDirective(): ConfDirective("post-device-hook", 1, INT_MAX) {
+ alias("post-access-hook");
+ }
void set(ConfContext &cc) const override {
- cc.conf->postAccess.assign(cc.bits.begin() + 1, cc.bits.end());
+ cc.conf->postDevice.assign(cc.bits.begin() + 1, cc.bits.end());
}
-} post_access_hook_directive;
+} device;
/** @brief The @c keep-prune-logs directive */
static const struct KeepPruneLogsDirective: public ConfDirective {
@@ -545,23 +565,27 @@ static const struct PruneParameterDirective: InheritableDirective {
}
} prune_parameter_directive;
-/** @brief The @c pre-backup-hook directive */
-static const struct PreBackupHookDirective: InheritableDirective {
- PreBackupHookDirective():
- InheritableDirective("pre-backup-hook", 1, INT_MAX) {}
+/** @brief The @c pre-volume-hook directive */
+static const struct PreVolumeHookDirective: InheritableDirective {
+ PreVolumeHookDirective():
+ InheritableDirective("pre-volume-hook", 1, INT_MAX) {
+ alias("pre-backup-hook");
+ }
void set(ConfContext &cc) const override {
- cc.context->preBackup.assign(cc.bits.begin() + 1, cc.bits.end());
+ cc.context->preVolume.assign(cc.bits.begin() + 1, cc.bits.end());
}
-} pre_backup_hook_directive;
+} pre_volume_hook_directive;
-/** @brief The @c post-backup-hook directive */
-static const struct PostBackupHookDirective: InheritableDirective {
- PostBackupHookDirective():
- InheritableDirective("post-backup-hook", 1, INT_MAX) {}
+/** @brief The @c post-volume-hook directive */
+static const struct PostVolumeHookDirective: InheritableDirective {
+ PostVolumeHookDirective():
+ InheritableDirective("post-volume-hook", 1, INT_MAX) {
+ alias("post-backup-hook");
+ }
void set(ConfContext &cc) const override {
- cc.context->postBackup.assign(cc.bits.begin() + 1, cc.bits.end());
+ cc.context->postVolume.assign(cc.bits.begin() + 1, cc.bits.end());
}
-} post_backup_hook_directive;
+} post_volume_hook_directive;
/** @brief The @c rsync-timeout directive */
static const struct RsyncTimeoutDirective: InheritableDirective {
diff --git a/src/ConfDirective.h b/src/ConfDirective.h
index 7e4a752..b951ac4 100644
--- a/src/ConfDirective.h
+++ b/src/ConfDirective.h
@@ -98,6 +98,9 @@ public:
unsigned acceptable_levels_ = LEVEL_TOP,
unsigned new_level_ = 0);
+ /** @brief Add an alias */
+ void alias(const char *name_);
+
/** @brief Name of directive */
const std::string name;
@@ -149,6 +152,9 @@ private:
/** @brief Map names to directives */
static directives_type *directives;
+
+ /** @brief Deprecated aliases */
+ static std::set<std::string> *aliases;
};
/** @brief Base class for generally inheritable directives */
diff --git a/src/DeviceAccess.cc b/src/DeviceAccess.cc
index 13307cb..b56cd30 100644
--- a/src/DeviceAccess.cc
+++ b/src/DeviceAccess.cc
@@ -45,7 +45,7 @@ static void runDeviceAccessHook(const std::vector<std::string> &cmd,
void preDeviceAccess() {
if(!devicesReady) {
- runDeviceAccessHook(globalConfig.preAccess, "pre-access-hook");
+ runDeviceAccessHook(globalConfig.preDevice, "pre-device-hook");
devicesReady = true;
}
}
@@ -57,7 +57,7 @@ void closeOnUnmount(IO *f) {
void postDeviceAccess() {
if(devicesReady) {
deleteAll(filesToClose);
- runDeviceAccessHook(globalConfig.postAccess, "post-access-hook");
+ runDeviceAccessHook(globalConfig.postDevice, "post-device-hook");
devicesReady = false;
}
}
diff --git a/src/MakeBackup.cc b/src/MakeBackup.cc
index a2d11ea..d97dac5 100644
--- a/src/MakeBackup.cc
+++ b/src/MakeBackup.cc
@@ -130,7 +130,7 @@ public:
*/
void subprocessIO(Subprocess &sp, bool outputToo = true);
- /** @brief Run the pre-backup hook if there is one
+ /** @brief Run the pre-volume hook if there is one
* @return Wait status
*/
int preBackup();
@@ -140,7 +140,7 @@ public:
*/
int rsyncBackup();
- /** @brief Run the post-backup hook if there is one */
+ /** @brief Run the post-volume hook if there is one */
void postBackup();
/** @brief Perform a backup */
@@ -203,16 +203,16 @@ void MakeBackup::subprocessIO(Subprocess &sp, bool outputToo) {
}
int MakeBackup::preBackup() {
- if(volume->preBackup.size()) {
+ if(volume->preVolume.size()) {
EventLoop e;
ActionList al(&e);
std::string output;
- Subprocess sp("pre-backup-hook/" + volume->parent->name + "/" + volume->name
+ Subprocess sp("pre-volume-hook/" + volume->parent->name + "/" + volume->name
+ "/" + device->name,
- volume->preBackup);
+ volume->preVolume);
sp.capture(1, &output);
- sp.setenv("RSBACKUP_HOOK", "pre-backup-hook");
+ sp.setenv("RSBACKUP_HOOK", "pre-volume-hook");
setEnvironment(sp);
sp.setTimeout(volume->hookTimeout);
sp.reporting(globalWarningMask & WARNING_VERBOSE, false);
@@ -344,15 +344,15 @@ int MakeBackup::rsyncBackup() {
}
void MakeBackup::postBackup() {
- if(volume->postBackup.size()) {
+ if(volume->postVolume.size()) {
EventLoop e;
ActionList al(&e);
- Subprocess sp("post-backup-hook/" + volume->parent->name + "/"
+ Subprocess sp("post-volume-hook/" + volume->parent->name + "/"
+ volume->name + "/" + device->name,
- volume->postBackup);
+ volume->postVolume);
sp.setenv("RSBACKUP_STATUS", outcome && outcome->rc == 0 ? "ok" : "failed");
- sp.setenv("RSBACKUP_HOOK", "post-backup-hook");
+ sp.setenv("RSBACKUP_HOOK", "post-volume-hook");
setEnvironment(sp);
sp.setTimeout(volume->hookTimeout);
sp.reporting(globalWarningMask & WARNING_VERBOSE, false);
@@ -364,12 +364,12 @@ void MakeBackup::postBackup() {
void MakeBackup::performBackup() {
// Run the pre-backup hook
- what = "preBackup";
+ what = "preVolume";
int rc = preBackup();
if(WIFEXITED(rc) && WEXITSTATUS(rc) == EX_TEMPFAIL) {
if(globalWarningMask & WARNING_VERBOSE)
IO::out.writef(
- "INFO: %s:%s is temporarily unavailable due to pre-backup-hook\n",
+ "INFO: %s:%s is temporarily unavailable due to pre-volume-hook\n",
host->name.c_str(), volume->name.c_str());
return;
}
diff --git a/tests/expect/issue43/failhook.txt b/tests/expect/issue43/failhook.txt
index b6ac789..e426d18 100644
--- a/tests/expect/issue43/failhook.txt
+++ b/tests/expect/issue43/failhook.txt
@@ -1,6 +1,6 @@
-WARNING: backup of host1:volume1 to device1: preBackup: exited with status 1
+WARNING: backup of host1:volume1 to device1: preVolume: exited with status 1
failhook-stderr
-WARNING: backup of host1:volume1 to device2: preBackup: exited with status 1
+WARNING: backup of host1:volume1 to device2: preVolume: exited with status 1
failhook-stderr
diff --git a/tests/hook b/tests/hook
index 04de94d..6cb4881 100755
--- a/tests/hook
+++ b/tests/hook
@@ -20,7 +20,7 @@ set -e
#env | grep ^RSBACKUP | sort
case "$RSBACKUP_HOOK" in
-pre-backup-hook )
+pre-volume-hook )
if [ -e ${WORKSPACE}/hookdata ]; then
echo >&3 "ERROR: hookdata already exists"
exit 1
@@ -28,7 +28,7 @@ pre-backup-hook )
touch ${WORKSPACE}/hookdata
what=pre
;;
-post-backup-hook )
+post-volume-hook )
if [ ! -e ${WORKSPACE}/hookdata ]; then
echo >&3 "ERROR: hookdata does not exit"
exit 1
@@ -41,7 +41,7 @@ post-backup-hook )
exit 1
fi
;;
-pre-access-hook )
+pre-device-hook )
if [ -e ${WORKSPACE}/devhookdata ]; then
echo >&3 "ERROR: devhookdata exists"
exit 1
@@ -49,7 +49,7 @@ pre-access-hook )
touch ${WORKSPACE}/devhookdata
what=dev-pre
;;
-post-access-hook )
+post-device-hook )
if [ ! -e ${WORKSPACE}/devhookdata ]; then
echo >&3 "ERROR: devhookdata does not exist"
exit 1
@@ -71,7 +71,7 @@ if [ ! -z "${RUN}" ]; then
fi
case "$RSBACKUP_HOOK" in
- pre-backup-hook )
+ pre-volume-hook )
case "$PRE_BACKUP_HOOK_STDERR" in
*? )
echo "$PRE_BACKUP_HOOK_STDERR" >&2
diff --git a/tests/setup.sh b/tests/setup.sh
index 9fcdc8e..f065ac7 100755
--- a/tests/setup.sh
+++ b/tests/setup.sh
@@ -54,8 +54,8 @@ setup() {
echo "public true" >> ${WORKSPACE}/config
- echo "pre-access-hook ${srcdir:-.}/hook" >> ${WORKSPACE}/config
- echo "post-access-hook ${srcdir:-.}/hook" >> ${WORKSPACE}/config
+ echo "pre-device-hook ${srcdir:-.}/hook" >> ${WORKSPACE}/config
+ echo "post-device-hook ${srcdir:-.}/hook" >> ${WORKSPACE}/config
echo "keep-prune-logs 1" >> ${WORKSPACE}/config
echo "backup-policy ${BACKUP_POLICY}" >> ${WORKSPACE}/config
@@ -90,8 +90,8 @@ setup() {
[ "${PRUNE_AGE}" != none ] && echo " ${PRUNE_AGE} 2" >> ${WORKSPACE}/config
echo " volume volume1 ${WORKSPACE}/volume1" >> ${WORKSPACE}/config
[ "${MIN_BACKUPS}" != none ] && echo " ${MIN_BACKUPS} 1" >> ${WORKSPACE}/config
- echo " pre-backup-hook ${srcdir:-.}/hook" >> ${WORKSPACE}/config
- echo " post-backup-hook ${srcdir:-.}/hook" >> ${WORKSPACE}/config
+ echo " pre-volume-hook ${srcdir:-.}/hook" >> ${WORKSPACE}/config
+ echo " post-volume-hook ${srcdir:-.}/hook" >> ${WORKSPACE}/config
echo " check-file file1" >> ${WORKSPACE}/config
echo " volume volume2 ${WORKSPACE}/volume2" >> ${WORKSPACE}/config
[ "${MIN_BACKUPS}" != none ] && echo " ${MIN_BACKUPS} 2" >> ${WORKSPACE}/config
diff --git a/tools/rsbackup-snapshot-hook.in b/tools/rsbackup-snapshot-hook.in
index 9b1f448..0175b34 100755
--- a/tools/rsbackup-snapshot-hook.in
+++ b/tools/rsbackup-snapshot-hook.in
@@ -116,7 +116,7 @@ if ${RSBACKUP_ACT:-false} && $remote test -e $snap; then
snaplv=${lv}.snap
snapdev=${dev%-*}-${snaplv}
case ${RSBACKUP_HOOK} in
- pre-backup-hook )
+ pre-volume-hook )
# Tidy up any leftovers
if $remote [ -e $snapdev ]; then
x $remote umount $snap >&2 || true
@@ -147,7 +147,7 @@ if ${RSBACKUP_ACT:-false} && $remote test -e $snap; then
# Backup from the snapshot, not the master
echo $snap
;;
- post-backup-hook )
+ post-volume-hook )
# Tidy up
x $remote umount $snap >&2
x $remote lvremove --force $snapdev >&2
diff --git a/tools/t-hook-dryrun b/tools/t-hook-dryrun
index 709d6c7..024cd9b 100755
--- a/tools/t-hook-dryrun
+++ b/tools/t-hook-dryrun
@@ -38,7 +38,7 @@ fake_cmd --must-not-run udevadm
RSBACKUP_VOLUME=rsb-volume \
RSBACKUP_VOLUME_path=/path/to/volume \
RSBACKUP_SSH_TARGET=localhost \
- RSBACKUP_HOOK=pre-backup-hook \
+ RSBACKUP_HOOK=pre-volume-hook \
RSBACKUP_ACT=false \
fake_run --must-output-empty \
./rsbackup-snapshot-hook -s ${fake_work}/snaps
diff --git a/tools/t-hook-fsck-fail b/tools/t-hook-fsck-fail
index 2b68f18..dd8549d 100755
--- a/tools/t-hook-fsck-fail
+++ b/tools/t-hook-fsck-fail
@@ -46,7 +46,7 @@ fake_cmd --must-not-run ssh
RSBACKUP_VOLUME=rsb-volume \
RSBACKUP_VOLUME_path=/path/to/volume \
RSBACKUP_SSH_TARGET=localhost \
- RSBACKUP_HOOK=pre-backup-hook \
+ RSBACKUP_HOOK=pre-volume-hook \
RSBACKUP_ACT=true \
fake_run --must-exit 2 --must-output-empty \
./rsbackup-snapshot-hook -s ${fake_work}/snaps
diff --git a/tools/t-hook-fsck-ok b/tools/t-hook-fsck-ok
index 6ad5f22..e0805c5 100755
--- a/tools/t-hook-fsck-ok
+++ b/tools/t-hook-fsck-ok
@@ -46,7 +46,7 @@ fake_cmd --must-not-run ssh
RSBACKUP_VOLUME=rsb-volume \
RSBACKUP_VOLUME_path=/path/to/volume \
RSBACKUP_SSH_TARGET=localhost \
- RSBACKUP_HOOK=pre-backup-hook \
+ RSBACKUP_HOOK=pre-volume-hook \
RSBACKUP_ACT=true \
fake_run --must-output "${fake_work}/snaps/rsb-volume" \
./rsbackup-snapshot-hook -s ${fake_work}/snaps
diff --git a/tools/t-hook-nosnap b/tools/t-hook-nosnap
index c19e12b..7887922 100755
--- a/tools/t-hook-nosnap
+++ b/tools/t-hook-nosnap
@@ -37,7 +37,7 @@ fake_cmd --must-not-run udevadm
RSBACKUP_VOLUME=rsb-volume \
RSBACKUP_VOLUME_path=/path/to/volume \
RSBACKUP_SSH_TARGET=localhost \
- RSBACKUP_HOOK=pre-backup-hook \
+ RSBACKUP_HOOK=pre-volume-hook \
RSBACKUP_ACT=true \
fake_run --must-output-empty \
./rsbackup-snapshot-hook -s ${fake_work}/snaps
diff --git a/tools/t-hook-ok b/tools/t-hook-ok
index 98116e5..76761f6 100755
--- a/tools/t-hook-ok
+++ b/tools/t-hook-ok
@@ -46,7 +46,7 @@ fake_cmd --must-not-run ssh
RSBACKUP_VOLUME=rsb-volume \
RSBACKUP_VOLUME_path=/path/to/volume \
RSBACKUP_SSH_TARGET=localhost \
- RSBACKUP_HOOK=pre-backup-hook \
+ RSBACKUP_HOOK=pre-volume-hook \
RSBACKUP_ACT=true \
fake_run --must-output "${fake_work}/snaps/rsb-volume" \
./rsbackup-snapshot-hook -s ${fake_work}/snaps
diff --git a/tools/t-hook-post b/tools/t-hook-post
index 65bc342..5be5902 100755
--- a/tools/t-hook-post
+++ b/tools/t-hook-post
@@ -45,7 +45,7 @@ fake_cmd --must-not-run ssh
RSBACKUP_VOLUME=rsb-volume \
RSBACKUP_VOLUME_path=/path/to/volume \
RSBACKUP_SSH_TARGET=localhost \
- RSBACKUP_HOOK=post-backup-hook \
+ RSBACKUP_HOOK=post-volume-hook \
RSBACKUP_ACT=true \
fake_run --must-output-empty \
./rsbackup-snapshot-hook -s ${fake_work}/snaps