Skip to content

Add support for multiple snapper configs#2

Open
SludgeGirl wants to merge 1 commit into
aplanas:mainfrom
SludgeGirl:main
Open

Add support for multiple snapper configs#2
SludgeGirl wants to merge 1 commit into
aplanas:mainfrom
SludgeGirl:main

Conversation

@SludgeGirl

Copy link
Copy Markdown

This aims to add support for multiple snapper configs. In some cases a user might have snapshots for root, but also for /var/logs, /home, etc

Comment thread src/main.rs
verbose: bool,
) -> Result<Vec<FileInfo>, std::io::Error> {
let snapshot_path = format!("/.snapshots/{snapshot}/snapshot");
let snapshot_path = format!("{}/.snapshots/{snapshot}/snapshot", config.subvolume);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the snapshot prefix? If is SUBVOLUME I have SUBVOLUME="/" in my root config file, so the interpolation would be //.snapshots/...

Also maybe {config.subvolume}?

Comment thread src/main.rs
.unwrap_or_default();
changes.modified.push(FileChange {
path: (*name).to_string(),
path: format!("{}{}", old_file.snapshot_subvolume, old_file.path),

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would not old_file contain the subvolume already in the path?

Comment thread src/main.rs

let snapshots: Snapshots = serde_json::from_str(stdout).expect("Failed to parse JSON");
Ok(snapshots)
let snapshots: HashMap<String, Vec<Snapshot>> =

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure that I understand this change. You should have stdout already, why to change the way of snapshots construction?

Comment thread src/main.rs
.find(|s| s.active)
.map(|s| s.number)
.expect("No active snapshot found");
let default = snapshots.root.iter().find(|s| s.default).map(|s| s.number);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same. What is this fixing?

Comment thread src/main.rs
let (old_snapshot, new_snapshot) = get_old_new_snapshots(cli, &config)?;

check_directory_exists_and_readable("/.snapshots")?;
check_directory_exists_and_readable(&format!("{}/.snapshots", config.subvolume))?;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same, //

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.

2 participants