Skip to content

Deprecate --config and add explicit SOURCE/DEST interface - #44

Merged
plattfot merged 27 commits into
masterfrom
10/deprecate_config_option
Oct 1, 2025
Merged

plattfot merged 27 commits into
masterfrom
10/deprecate_config_option

Conversation

@plattfot

Copy link
Copy Markdown
Owner

Now that I finally have proper testing for this I can address the issue in #10.

Description

I'm deprecating the --config interface in favor of just explicitly specify the source and destination directory.
Benefits for this are:

  • you avoid the clunky interface with --type push/pull.
  • It no longer require snapper to be installed.
  • You can now have both the source and destination be remote locations on different machines.

Changes

  • Added full test coverage for both the --config interface and the new.
  • When --config is not specified it not expects a positional SOURCE and DEST
  • Alternative you can use --source SOURCE and --dest DEST.
  • Config file now accepts SOURCE= and DEST= to configure the source and backup location. Use --source/--dest to override them on the CLI, or positional if overriding both.
  • Added --dest-private-key for setting the ssh private key for the dest machine.
  • Added --src-private-key for setting the ssh private keye for the source machine.
  • --private-key sets the private key for both source and dest machine.

Examples:

Backing up snapshots from a remote machine

Deprecated way:

/usr/bin/baksnapper --config home --private-key /root/.ssh/baksnapper --type pull baksnapper@remote-host-to-back.up:/backups

New way:

/usr/bin/baksnapper --dest-private-key /root/.ssh/baksnapper baksnapper@remote-host-to-back.up:/backups /home/.snapshots

Assuming the snapper snapshot directory for home is /home/.snapshots.

Default push backup

And for a push backup, where you have the snapper snapshot directory for root at /.snapshots.

Deprecated way:

/usr/bin/baksnapper --config root /path/to/backup …

New way:

/usr/bin/baksnapper /.snapshots /path/to/backup/root …

Backup a remote machine to another remote machine

Have a third machine pull snapshots from one remote machine and push them to another remote machine.

/usr/bin/baksnapper --src-private-key /root/.ssh/baksnapper-source baksnapper@remote-host-source:/.snapshots --dest-private-key /root/.ssh/baksnapper-backup baksnapper@remote-host-backup:/backups/source/root

Going to simplify the interface where you specify source and
destination.
Going to simplify the interface where you specify source and
destination.
It will still show the help for the deprecated workflow using
--config/--type.
That allows to use an input variable as an output.  Avoiding the use
of the functions setting global `_` variables.  Instead designated
variables can be used directly.  With that it can check if things are
set or not in the function call.
Moved all commands that uses snapper to configure the source and
destination.  And sender and receiver.

Will make it easier to clean up once the --config option is removed.
To be able to test when given SOURCE and DEST rather than --config.
]

Reducing a lot of the boilerplate in the testing code.
To convert meson's configure_file output to something baksnapper can
parse.
To make sure it fails when not given enough position arguments.
To set the key used to connect to the source/destination remote
location.
To set the SOURCE/DEST private key.
Mock the ssh connection to be able to test that it works.
To be able to override source or dest from the config file.
@plattfot plattfot self-assigned this Sep 29, 2025
@plattfot
plattfot force-pushed the 10/deprecate_config_option branch from 0b3a687 to 8dd1bd3 Compare September 29, 2025 03:30
@plattfot
plattfot merged commit d0634b5 into master Oct 1, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant