]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- allow to set path for more commands on the target 1000/head
authorArvin Schnell <aschnell@suse.de>
Wed, 9 Apr 2025 14:45:34 +0000 (16:45 +0200)
committerArvin Schnell <aschnell@suse.de>
Wed, 9 Apr 2025 14:45:34 +0000 (16:45 +0200)
client/snbk/BackupConfig.cc
client/snbk/BackupConfig.h
client/snbk/TheBigThing.cc
configure.ac
doc/snapper-backup-configs.xml.in

index 1d89a5ee7048d8ceaf1e6ee6114d0ae30c84b6c6..8ed3a35b156eedc32f31e68b6be97906633b23c1 100644 (file)
@@ -71,8 +71,11 @@ namespace snapper
        }
 
        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);
+       get_child_value(json_file.get_root(), "target-mkdir-bin", target_mkdir_bin);
+       get_child_value(json_file.get_root(), "target-realpath-bin", target_realpath_bin);
+       get_child_value(json_file.get_root(), "target-rm-bin", target_rm_bin);
+       get_child_value(json_file.get_root(), "target-rmdir-bin", target_rmdir_bin);
     }
 
 
index fb400b1c892ab9c433aec10633b5c5f64c12923f..39763a880368e8e1b0fafe1b017fc59611d4cf51 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2024 SUSE LLC
+ * Copyright (c) [2024-2025] SUSE LLC
  *
  * All Rights Reserved.
  *
@@ -71,8 +71,11 @@ namespace snapper
        Shell get_target_shell() const;
 
        string target_btrfs_bin = BTRFS_BIN;
-       string target_realpath_bin = REALPATH_BIN;
        string target_findmnt_bin = FINDMNT_BIN;
+       string target_mkdir_bin = MKDIR_BIN;
+       string target_realpath_bin = REALPATH_BIN;
+       string target_rm_bin = RM_BIN;
+       string target_rmdir_bin = RMDIR_BIN;
 
     private:
 
index fda469b2e44aac9fdff40116d329adc18e736e14..47e9c2ef0c240f402c3241ca7e8a9647720938e8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2024 SUSE LLC
+ * Copyright (c) [2024-2025] SUSE LLC
  *
  * All Rights Reserved.
  *
@@ -73,7 +73,8 @@ namespace snapper
 
        // Create directory on target.
 
-       SystemCmd::Args cmd1_args = { MKDIR_BIN, "--", backup_config.target_path + "/" + num_string };
+       SystemCmd::Args cmd1_args = { backup_config.target_mkdir_bin, "--", backup_config.target_path + "/" +
+           num_string };
        SystemCmd cmd1(shellify(backup_config.get_target_shell(), cmd1_args));
        if (cmd1.retcode() != 0)
        {
@@ -195,7 +196,8 @@ namespace snapper
 
        // Remove info.xml on target.
 
-       SystemCmd::Args cmd2_args = { RM_BIN, "--", backup_config.target_path + "/" + num_string + "/info.xml" };
+       SystemCmd::Args cmd2_args = { backup_config.target_rm_bin, "--", backup_config.target_path + "/" + num_string +
+           "/info.xml" };
        SystemCmd cmd2(shellify(backup_config.get_target_shell(), cmd2_args));
        if (cmd2.retcode() != 0)
        {
@@ -210,7 +212,8 @@ namespace snapper
 
        // Remove directory on target.
 
-       SystemCmd::Args cmd3_args = { RMDIR_BIN, "--", backup_config.target_path + "/" + num_string };
+       SystemCmd::Args cmd3_args = { backup_config.target_rmdir_bin, "--", backup_config.target_path + "/" +
+           num_string };
        SystemCmd cmd3(shellify(backup_config.get_target_shell(), cmd3_args));
        if (cmd3.retcode() != 0)
        {
index 4d94528b71e1c9b50c9067c006d663210735b9ea..639623ef49fbd41293ef7604a04f302e3dcf79ac 100644 (file)
@@ -38,6 +38,7 @@ AC_PATH_PROG([LVM_BIN], [lvm], [/sbin/lvm])
 AC_PATH_PROG([LVREMOVE_BIN], [lvremove], [/sbin/lvremove])
 AC_PATH_PROG([LVRENAME_BIN], [lvrename], [/sbin/lvrename])
 AC_PATH_PROG([LVS_BIN], [lvs], [/sbin/lvs])
+AC_PATH_PROG([MKDIR_BIN], [mkdir], [/bin/mkdir])
 AC_PATH_PROG([REALPATH_BIN], [realpath], [/usr/bin/realpath])
 AC_PATH_PROG([RM_BIN], [rm], [/bin/rm])
 AC_PATH_PROG([RMDIR_BIN], [rmdir], [/bin/rmdir])
@@ -55,6 +56,7 @@ AC_DEFINE_UNQUOTED([LVM_BIN], ["$LVM_BIN"], [Path of lvm program.])
 AC_DEFINE_UNQUOTED([LVREMOVE_BIN], ["$LVREMOVE_BIN"], [Path of lvremove program.])
 AC_DEFINE_UNQUOTED([LVRENAME_BIN], ["$LVRENAME_BIN"], [Path of lvrename program.])
 AC_DEFINE_UNQUOTED([LVS_BIN], ["$LVS_BIN"], [Path of lvs program.])
+AC_DEFINE_UNQUOTED([MKDIR_BIN], ["$MKDIR_BIN"], [Path of mkdir program.])
 AC_DEFINE_UNQUOTED([REALPATH_BIN], ["$REALPATH_BIN"], [Path of realpath program.])
 AC_DEFINE_UNQUOTED([RM_BIN], ["$RM_BIN"], [Path of rm program.])
 AC_DEFINE_UNQUOTED([RMDIR_BIN], ["$RMDIR_BIN"], [Path of rmdir program.])
index a486fa3b4d504239bfd469e047598e5f8357d6b3..adae5cd114f80f693dd9f57fd994685dc942502b 100644 (file)
@@ -2,13 +2,13 @@
 <refentry id='snapper-backup-configs5'>
 
   <refentryinfo>
-    <date>2024-12-17</date>
+    <date>2025-04-09</date>
   </refentryinfo>
 
   <refmeta>
     <refentrytitle>snapper-backup-configs</refentrytitle>
     <manvolnum>5</manvolnum>
-    <refmiscinfo class='date'>2024-12-17</refmiscinfo>
+    <refmiscinfo class='date'>2025-04-09</refmiscinfo>
     <refmiscinfo class='version'>@VERSION@</refmiscinfo>
     <refmiscinfo class='manual'>Filesystem Snapshot Management</refmiscinfo>
   </refmeta>
       <varlistentry>
        <term><option>target-btrfs-bin</option></term>
        <listitem>
-         <para>Location of the btrfs binary on the target. Optional.</para>
+         <para>Location of the btrfs binary on the target. Can also
+         be used to install wrapper scripts. Optional.</para>
+       </listitem>
+      </varlistentry>
+
+      <varlistentry>
+       <term><option>target-findmnt-bin</option></term>
+       <listitem>
+         <para>Location of the findmnt binary on the target. Can also
+         be used to install wrapper scripts. Optional.</para>
+       </listitem>
+      </varlistentry>
+
+      <varlistentry>
+       <term><option>target-mkdir-bin</option></term>
+       <listitem>
+         <para>Location of the mkdir binary on the target. Can also
+         be used to install wrapper scripts. Optional.</para>
        </listitem>
       </varlistentry>
 
       <varlistentry>
        <term><option>target-realpath-bin</option></term>
        <listitem>
-         <para>Location of the realpath binary on the target. Optional.</para>
+         <para>Location of the realpath binary on the target. Can also
+         be used to install wrapper scripts. Optional.</para>
        </listitem>
       </varlistentry>
 
       <varlistentry>
-       <term><option>target-findmnt-bin</option></term>
+       <term><option>target-rm-bin</option></term>
+       <listitem>
+         <para>Location of the rm binary on the target. Can also
+         be used to install wrapper scripts. Optional.</para>
+       </listitem>
+      </varlistentry>
+
+      <varlistentry>
+       <term><option>target-rmdir-bin</option></term>
        <listitem>
-         <para>Location of the findmnt binary on the target. Optional.</para>
+         <para>Location of the rmdir binary on the target. Can also
+         be used to install wrapper scripts. Optional.</para>
        </listitem>
       </varlistentry>