Hooks::rollback(filesystem->snapshotDir(snapshot1->getNum()),
filesystem->snapshotDir(snapshot2->getNum()));
+ Hooks::rollback(subvolume, filesystem, snapshot1->getNum(), snapshot2->getNum());
if (print_number)
cout << snapshot2->getNum() << endl;
Hooks::rollback(filesystem->snapshotDir(previous_default->getNum()),
filesystem->snapshotDir(snapshot->getNum()));
+ Hooks::rollback(subvolume, filesystem, previous_default->getNum(), snapshot->getNum());
}
break;
<para>Executed when the default snapshot gets changed</para>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><option>rollback <replaceable>subvolume</replaceable> <replaceable>fstype</replaceable> <replaceable>old-snapshot-number</replaceable> <replaceable>new-snapshot-number</replaceable></option></term>
+ <listitem>
+ <para>Executed when a rollback is done</para>
+ </listitem>
+ </varlistentry>
</variablelist>
- <para>More arguments may be passed in the future. Using snapper in
+ <para>More actions and arguments can be added any time. Using snapper in
the plugins is not allowed.</para>
</refsect1>
--- /dev/null
+#!/bin/bash
+
+# Use only for testing.
+
+echo `date +"%F %T"` $* >> /tmp/snapper-plugin-test.log
+
#endif
}
+
+ void
+ Hooks::rollback(const string& subvolume, const Filesystem* filesystem, unsigned int old_num, unsigned int new_num)
+ {
+ run_scripts({ "rollback", subvolume, filesystem->fstype(), std::to_string(old_num), std::to_string(new_num) });
+ }
+
}
static void set_default_snapshot(const string& subvolume, const Filesystem* filesystem, unsigned int num);
static void rollback(const string& old_root, const string& new_root);
+ static void rollback(const string& subvolume, const Filesystem* filesystem, unsigned int old_num, unsigned int new_num);
private: