Skip to content

introduce a "base dir" option #183

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
JesseRacine opened this issue Mar 13, 2023 · 8 comments
Closed

introduce a "base dir" option #183

JesseRacine opened this issue Mar 13, 2023 · 8 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@JesseRacine
Copy link

Currently, resticprofile runs from the current directory that you are in when you run it. I was thinking that there could be a "base-dir" option that would set the directory that resticprofile runs from. If this option were implemented then you could run resticprofile from any directory and the backup would still work, since the backup (source option) could then be relative to the base-dir.

@jkellerer
Copy link
Collaborator

Makes sense. Could simplify the creation of reusable profiles, when relative paths can be used in source and the base is configured separately.

@kohanla
Copy link

kohanla commented Apr 13, 2023

@jkellerer Thanks for implementing this. Hope it will be merged soon :-). This option is important.

@kohanla
Copy link

kohanla commented Apr 16, 2023

@jkellerer I tested this pull request now. In case anybody else want to test it. Install git and go, then run

git clone https://github.com/creativeprojects/resticprofile.git
cd resticprofile
git fetch origin pull/192/head:base-dir
git merge base-dir
make build-all
ls -l resticprofile*

It works! Thanks for your code! But I have one wish.

It seems not possible to set the base-dir on "command level" as well. But I would prefer to set the base-dir just for the backup command, because in most cases it is only necessary there.

And then one question. If you do

cd /tmp
resticprofile testrestic.restore latest --target .

where should resticprofile restore to if base-dir is set to '/'

In my opinion it should be /tmp, but it is for some reason '/'

That's why I would prefer to have an option to set the base-dir on command level. This would allow me to run restore without a base-dir.

@jkellerer
Copy link
Collaborator

Thanks a lot for testing it. That is very good feedback.

In the current form base-dir not only sets the base for source-paths but for anything that depends on the current working dir. For consistency, I think this is correct behaviour, however I also see your use case.

Will update the PR to add a separate option to set a base just for backup sources.

@kohanla
Copy link

kohanla commented Apr 16, 2023

Will update the PR to add a separate option to set a base just for backup sources.

Thanks! I will test when it is ready.

@creativeprojects creativeprojects added the enhancement New feature or request label Apr 23, 2023
jkellerer added a commit that referenced this issue Jul 29, 2023
* Implemented "base-dir" for profiles
* Added "go to top" links to reference
* Added "source-base" for backup "source"
* BaseDir: Reload config when $PWD changes
* Added `.StartupDir` as `.CurrentDir` is now in sync with $PWD
@kohanla
Copy link

kohanla commented Jul 31, 2023

@jkellerer

Will update the PR to add a separate option to set a base just for backup sources.

Thanks for your PR! Just to clarify, did you add an option to set a base just for backup sources?

@jkellerer
Copy link
Collaborator

Yes, there are 2 options, source-base and base-dir

@kohanla
Copy link

kohanla commented Jul 31, 2023

Thanks! Will test when 0.23 is available.

@creativeprojects creativeprojects added this to the v0.23.0 milestone Aug 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants