aspiers / stow

GNU Stow - mirror of savannah git repository occasionally with more bleeding-edge branches
http://www.gnu.org/s/stow/
GNU General Public License v3.0
650 stars 41 forks source link

How to make stow sync all new files? #28

Closed c02y closed 6 years ago

c02y commented 6 years ago

(Also posted to https://unix.stackexchange.com/questions/445712/how-to-sync-files-and-symbolic-links-between-original-dir-and-symbolic-directory)

For instance, I put symbolic links into ~/.local/bin/ which point to real executable files in ~/Dotfiles.d/local/.local/bin/.

I use the following instructions to do that:

$ cd ~/Dotfiles.d/
$ stow -v local

so stow will create links for all files in local (which contains .local/bin/) into `~/.local/bin/`

But when I need to add new files into the bin directory, whether I add file in ~/.local/bin/ or ~/Dotfiles.d/local/.local/bin/, stow is not able to sync files between these two directories.

What I want is:

  1. If add new file into ~/.local/bin/ directly, it will actually add new file into ~/Dotfiles.d/local/.local/bin automatically, and create a symbolic link into ~/.local/bin/ automatically.
  2. If I add new file into ~/Dotfiles.d/local/.local/bin/, it will automatically create a symbolic link of this file into ~/.local/bin/.

Is stow able to do that?

unai-ndz commented 6 years ago

Why don't you link the bin folder entirely instead?

c02y commented 6 years ago

You mean put the bin in my ~/Dotfiles.d/? But the local is not the only directory in the ~/Dotfiles.d/ directory, I got several other directories in it such as vim (~/Dotfiles.d/vim/.vim) and fish(~/Dotfiles.d/fish/.config/fish), etc..

Besides, according the logic of stow, you have to put the the path of the directory in the ~/Dotfiles.d/.

And I cannot use command like stow local/.local/bin, since it will print

stow: ERROR: Slashes are not permitted in package names
unai-ndz commented 6 years ago

I have my ~/bin folder inside ~/dotfiles/bin/bin and I link it with stow bin. I don't see why you can't do that with .local/bin.

I have just tested it a little bit and discarded it because of how it handle the conflicts (It doesn't). So maybe I'm missing something.

c02y commented 6 years ago

A directory called fish which contains

~/Dotfiles.d/
  - fish/.config/fish/
    - functions/
    - completions/
    - config.fish

So I use stow fish to link the whole fish directory into ~/.config/fish.

I just tested, I put a file (such as foo) in ~/.config/fish/functions, the foo file will be ~/Dotfiles.d/fish/.config/fish/functions/ too.

I don't understand why this is not working to ~/Dotfiles.d/local.


UPDATE:

I realize that there are several files (pip*) in ~/.local/bin/ that are not in ~/Dotfiles.d/local/.local/bin/, the sync problem may be caused by this, so I remove ~/.local/bin and relink the bin directory using cd ~/Dotfiles.d/; stow local, then add files into ~/.local/bin/ and they exist in ~/Dotfiles.d/local/.local/bin/ too.

Since I have been using stow for years, the sync process works great for me, but recently this issue happens. I guess normally stow works as I expected. So I close this issue.