From: Arvin Schnell Date: Wed, 9 Apr 2025 14:45:34 +0000 (+0200) Subject: - allow to set path for more commands on the target X-Git-Tag: v0.12.2~6^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1000%2Fhead;p=thirdparty%2Fsnapper.git - allow to set path for more commands on the target --- diff --git a/client/snbk/BackupConfig.cc b/client/snbk/BackupConfig.cc index 1d89a5ee..8ed3a35b 100644 --- a/client/snbk/BackupConfig.cc +++ b/client/snbk/BackupConfig.cc @@ -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); } diff --git a/client/snbk/BackupConfig.h b/client/snbk/BackupConfig.h index fb400b1c..39763a88 100644 --- a/client/snbk/BackupConfig.h +++ b/client/snbk/BackupConfig.h @@ -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: diff --git a/client/snbk/TheBigThing.cc b/client/snbk/TheBigThing.cc index fda469b2..47e9c2ef 100644 --- a/client/snbk/TheBigThing.cc +++ b/client/snbk/TheBigThing.cc @@ -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) { diff --git a/configure.ac b/configure.ac index 4d94528b..639623ef 100644 --- a/configure.ac +++ b/configure.ac @@ -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.]) diff --git a/doc/snapper-backup-configs.xml.in b/doc/snapper-backup-configs.xml.in index a486fa3b..adae5cd1 100644 --- a/doc/snapper-backup-configs.xml.in +++ b/doc/snapper-backup-configs.xml.in @@ -2,13 +2,13 @@ - 2024-12-17 + 2025-04-09 snapper-backup-configs 5 - 2024-12-17 + 2025-04-09 @VERSION@ Filesystem Snapshot Management @@ -105,21 +105,48 @@ - Location of the btrfs binary on the target. Optional. + Location of the btrfs binary on the target. Can also + be used to install wrapper scripts. Optional. + + + + + + + Location of the findmnt binary on the target. Can also + be used to install wrapper scripts. Optional. + + + + + + + Location of the mkdir binary on the target. Can also + be used to install wrapper scripts. Optional. - Location of the realpath binary on the target. Optional. + Location of the realpath binary on the target. Can also + be used to install wrapper scripts. Optional. - + + + Location of the rm binary on the target. Can also + be used to install wrapper scripts. Optional. + + + + + - Location of the findmnt binary on the target. Optional. + Location of the rmdir binary on the target. Can also + be used to install wrapper scripts. Optional.