Finding preferences fails

Depending on which directory I’m in duplicacy finds or doesn’t find the preference file:

bash-3.2# pwd
/var/root
bash-3.2# /usr/local/bin/duplicacy  list -storage gcd://Duplicacy
Repository set to /
Storage set to gcd://Duplicacy
Snapshot mmac revision 1 created at 2024-01-04 16:25 -hash
Snapshot mmac revision 2 created at 2024-01-04 21:16
bash-3.2# cd /
bash-3.2# /usr/local/bin/duplicacy  list -storage gcd://Duplicacy
Repository has not been initialized
bash-3.2#

I fail to understand why, so I need some help :blush:

By default, Duplicacy repository is initialized in the current directory and configuration is stored in the .duplicacy/preferences files. That file contains storage paths and snapshot names, etc.

When you cd to a different directory — that folder does not exist obviously, so duplicacy has no idea what are you asking it to do :).

I guess confusion here is that duplicacy calls repository a source. Not target.

So to be able to run duplicacy, one must know where in the file structure duplicacy was initialized? Is it possible to set up an env variable or reference the prefs folder from commandline?

And this i don’t understand either:

Mac-mini:randomdirectory root# pwd
/var/root/randomdirectory
Mac-mini:randomdirectory root# /usr/local/bin/duplicacy  list -storage gcd://Duplicacy
Repository set to /
Storage set to gcd://Duplicacy
Snapshot mmac revision 1 created at 2024-01-04 16:25 -hash
Snapshot mmac revision 2 created at 2024-01-04 21:16
Mac-mini:~ root# cd /
Mac-mini:/ root# pwd
/
Mac-mini:/ root# /usr/local/bin/duplicacy  list -storage gcd://Duplicacy
Repository has not been initialized

Why does it find the config when I’m located in some random directory, under users home, but not in the root?

Yes. The init has a -repository flag, to init the repo elsewhere, as opposed to in the current directory. But it needs to be somewhere.

Yes, for example:

PWD=/path/to/folder duplicacy backup

Alternativley, have a look at this: Move .duplicacy folder · gilbertchen/duplicacy Wiki · GitHub

Perhaps it traverses parent directories in the attempt to find that .duplicacy folder.

So if you init duplicacy in /a/b/c folder, it will work from /a/b/c/d folder but not /x/y/z folder.

So, to backup my repository ( / root) on Macos, I have to have to .duplicacy folder in / . / is readonly filesystem, so I cannot use duplicacy, If my software before launch doesn’t change directory to /var/root I can’t backup. This is just absurd.

You can, see the link above.