Closed bound-variable closed 2 years ago
These instructions seem to be from a time before the data directory was managed outside of the standard yadm directory. The documentation should be updated. The alias should probably look like this instead:
alias syadm="sudo yadm --yadm-dir /etc/yadm --yadm-data /etc/yadm/data"
Can you give that a try and let me know if this works better for you? It should result in all of the "syadm" data being stored in /etc/yadm
.
Yes, I was able to run the syadm
alias, add files, and commit them. But I wasn't able to push this to the same repo I use for files under $HOME
. I guess that's to be expected? So do I need to create another remote repo to host the files under /etc
?
Yes, a cloned Git repo can only have a single worktree configured, so the system-level files and your own dotfiles would need to be in separate repos. I can clarify this in documentation too.
If you want, you could specify the worktree as /
(with yadm init -w /
) instead, and maintain ALL of your files in a single repo. But your home directory would need to use the same fully qualified path on all hosts. All of the tracked files for a repo must be under the work tree, so by using /
you could track any file on a system. (that isn't a typical use-case though)
I've set it up with the alias and the command above: sudo yadm --yadm-dir /etc/yadm --yadm-data /etc/yadm/data init -w /
I can add and commit files under $HOME
, but not under /etc
. For example, if I enter /etc/zsh
and add the files in there, there's no error, but there's also nothing to commit. Running sudo yadm ... commit -a
prints initial commit. Running sudo yadm ... status
prints no commits yet.
When you don't specify yadm-dir and yadm-data, you're using the default locations (for your user).
You would need to continue to specify those overridden directories each time you run yadm.
sudo yadm --yadm-dir /etc/yadm --yadm-data /etc/yadm/data add <file>
sudo yadm --yadm-dir /etc/yadm --yadm-data /etc/yadm/data commit
Some people create an alias to make running those commands simpler.
Sorry, I was implying that I was using the alias. That's what the ellipsis was for. I should have been clearer I suppose.
Yadm wasn't working for my system files. I couldn't figure it out. So I went ahead and learned about Git and bare repos. I'm using the basic method (just git) and it works with both my system files and user files.
You can close this issue of you like.
OK, I just tried it again myself, and it the alias below is working for me.
alias syadm="sudo yadm --yadm-dir /etc/yadm --yadm-data /etc/yadm/data"
I'm very happy you have a solution that's working for you though.
I'll keep this issue open, to track getting the FAQ updated with the necessary parameters.
Another way I'm using is to use a simple script syncfiles and call that with a file/folder (incl relative path too), it'll create a absolute path structure and keep the file there at ~/.config/yadm/files
. Later on at bootstrapping step we can just rsync -avP
it to /
.
The only thing missing is that we've to keep track if the file is changed by ourselves there's no git status
.
@Animeshz I'm thinking of using a similar approach, except of copying system files from my home directory, they would be symlink'ed. This solves the problem of detecting if the file is changed. So the approach might look like:
~/.config/system/
. For example /etc/resolv.conf
at ~/.config/system/etc/resolv.conf
. The kind of solution seems like it could make sense on a single-user system where the /home directory is available at boot time. It wouldn't work if the home directory has an additional layer of encryption, but it could work if only full-disk encryption is used.
Am I missing a downside to this approach?
Oh hey, I forgot to tell, I also added -S
option that will sync all the previously synced files back.
syncfiles /etc/cron.weekly
cd /etc
syncfiles resolv.conf
syncfiles -S # syncs both of them, as added previously
Never had a problem till now!
Describe the bug
Following the docs doesn't lead to effective results.
To reproduce
Steps to reproduce the behavior:
alias syadm="sudo yadm -Y /etc/yadm"
syadm init -w /etc
Expected behavior
Running
yadm
assudo
shouldn't ask to overwrite extant repo.Environment