get_child_value(json_file.get_root(), "ssh-user", ssh_user);
get_child_value(json_file.get_root(), "ssh-identity", ssh_identity);
}
+
+ get_child_value(json_file.get_root(), "target-btrfs-bin", target_btrfs_bin);
+ get_child_value(json_file.get_root(), "target-realpath-bin", target_realpath_bin);
+ get_child_value(json_file.get_root(), "target-findmnt-bin", target_findmnt_bin);
}
#include <vector>
#include <snapper/Enum.h>
+#include <snapper/SnapperDefines.h>
#include "Shell.h"
Shell get_source_shell() const;
Shell get_target_shell() const;
+ string target_btrfs_bin = BTRFS_BIN;
+ string target_realpath_bin = REALPATH_BIN;
+ string target_findmnt_bin = FINDMNT_BIN;
+
private:
vector<string> ssh_options() const;
using namespace std;
- CmdBtrfsSubvolumeList::CmdBtrfsSubvolumeList(const Shell& shell, const string& mount_point)
+ CmdBtrfsSubvolumeList::CmdBtrfsSubvolumeList(const string& btrfs_bin, const Shell& shell, const string& mount_point)
{
- SystemCmd::Args cmd_args = { BTRFS_BIN, "subvolume", "list", "-a", "-puqR", mount_point };
+ SystemCmd::Args cmd_args = { btrfs_bin, "subvolume", "list", "-a", "-puqR", mount_point };
SystemCmd cmd(shellify(shell, cmd_args));
if (cmd.retcode() != 0)
}
- CmdBtrfsSubvolumeShow::CmdBtrfsSubvolumeShow(const Shell& shell, const string& mount_point)
+ CmdBtrfsSubvolumeShow::CmdBtrfsSubvolumeShow(const string& btrfs_bin, const Shell& shell, const string& mount_point)
{
- SystemCmd::Args cmd_args = { BTRFS_BIN, "subvolume", "show", mount_point };
+ SystemCmd::Args cmd_args = { btrfs_bin, "subvolume", "show", mount_point };
SystemCmd cmd(shellify(shell, cmd_args));
if (cmd.retcode() != 0)
static const long top_level_id = 5;
static const long unknown_id = -1;
- CmdBtrfsSubvolumeList(const Shell& shell, const string& mount_point);
+ CmdBtrfsSubvolumeList(const string& btrfs_bin, const Shell& shell, const string& mount_point);
/**
* Entry for every subvolume (unfortunately except the top-level).
{
public:
- CmdBtrfsSubvolumeShow(const Shell& shell, const string& mount_point);
+ CmdBtrfsSubvolumeShow(const string& btrfs_bin, const Shell& shell, const string& mount_point);
const string& get_uuid() const { return uuid; }
const string& get_parent_uuid() const { return parent_uuid; }
namespace snapper
{
- CmdFindmnt::CmdFindmnt(const Shell& shell, const string& path)
+ CmdFindmnt::CmdFindmnt(const string& findmnt_bin, const Shell& shell, const string& path)
: path(path)
{
- SystemCmd::Args cmd_args = { FINDMNT_BIN, "--json", "--target", path };
+ SystemCmd::Args cmd_args = { findmnt_bin, "--json", "--target", path };
SystemCmd cmd(shellify(shell, cmd_args));
if (cmd.retcode() != 0)
{
public:
- CmdFindmnt(const Shell& shell, const string& path);
+ CmdFindmnt(const string& findmnt_bin, const Shell& shell, const string& path);
const string& get_source() const { return source; }
const string& get_target() const { return target; }
namespace snapper
{
- CmdRealpath::CmdRealpath(const Shell& shell, const string& path)
+ CmdRealpath::CmdRealpath(const string& realpath_bin, const Shell& shell, const string& path)
: path(path)
{
- SystemCmd::Args cmd_args = { REALPATH_BIN, path };
+ SystemCmd::Args cmd_args = { realpath_bin, path };
SystemCmd cmd(shellify(shell, cmd_args));
if (cmd.retcode() != 0)
{
public:
- CmdRealpath(const Shell& shell, const string& path);
+ CmdRealpath(const string& realpath_bin, const Shell& shell, const string& path);
const string& get_realpath() const { return realpath; }
// Query additional information (uuids, read-only) from btrfs.
- CmdBtrfsSubvolumeShow extra(shell_source, backup_config.source_path + "/" SNAPSHOTS_NAME "/" +
+ CmdBtrfsSubvolumeShow extra(BTRFS_BIN, shell_source, backup_config.source_path + "/" SNAPSHOTS_NAME "/" +
to_string(num) + "/" SNAPSHOT_NAME);
TheBigThing the_big_thing(num);
// In case the target-path is a symbolic link (or includes things like "/../") we
// need a lookup for the realpath first.
- CmdRealpath cmd_realpath(shell_target, backup_config.target_path);
+ CmdRealpath cmd_realpath(backup_config.target_realpath_bin, shell_target, backup_config.target_path);
const string target_path = cmd_realpath.get_realpath();
- CmdFindmnt cmd_findmnt(shell_target, target_path);
+ CmdFindmnt cmd_findmnt(backup_config.target_findmnt_bin, shell_target, target_path);
const string mount_point = cmd_findmnt.get_target();
if (target_path.size() < mount_point.size())
if (!boost::starts_with(target_path, mount_point))
SN_THROW(Exception("unsupported target-path setup"));
- CmdBtrfsSubvolumeList target_snapshots(shell_target, mount_point);
+ CmdBtrfsSubvolumeList target_snapshots(backup_config.target_btrfs_bin, shell_target, mount_point);
string start;
if (target_path != mount_point)
// Query additional information (receive-uuid, read-only) from btrfs.
- CmdBtrfsSubvolumeShow y(shell_target, target_path + "/" + path);
+ CmdBtrfsSubvolumeShow y(backup_config.target_btrfs_bin, shell_target, target_path + "/" + path);
bool is_read_only = y.is_read_only();
if (!is_read_only)
<refentry id='snapper-backup-configs5'>
<refentryinfo>
- <date>2024-11-05</date>
+ <date>2024-12-17</date>
</refentryinfo>
<refmeta>
<refentrytitle>snapper-backup-configs</refentrytitle>
<manvolnum>5</manvolnum>
- <refmiscinfo class='date'>2024-11-05</refmiscinfo>
+ <refmiscinfo class='date'>2024-12-17</refmiscinfo>
<refmiscinfo class='version'>@VERSION@</refmiscinfo>
<refmiscinfo class='manual'>Filesystem Snapshot Management</refmiscinfo>
</refmeta>
password or passphrase. Optional for target mode ssh-push.</para>
</listitem>
</varlistentry>
+
+ <varlistentry>
+ <term><option>target-btrfs-bin</option></term>
+ <listitem>
+ <para>Location of the btrfs binary on the target. Optional.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>target-realpath-bin</option></term>
+ <listitem>
+ <para>Location of the realpath binary on the target. Optional.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>target-findmnt-bin</option></term>
+ <listitem>
+ <para>Location of the findmnt binary on the target. Optional.</para>
+ </listitem>
+ </varlistentry>
+
</variablelist>
</refsect1>
+-------------------------------------------------------------------
+Tue Dec 17 09:14:46 CET 2024 - aschnell@suse.com
+
+- make some binary paths used in snbk configurable
+ (gh#openSUSE/snapper#970)
+
-------------------------------------------------------------------
Mon Dec 02 16:51:50 CET 2024 - aschnell@suse.com