Skip to content
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

Add copy config option #128

Open
jerrykal opened this issue Jun 15, 2017 · 15 comments
Open

Add copy config option #128

jerrykal opened this issue Jun 15, 2017 · 15 comments

Comments

@jerrykal
Copy link

jerrykal commented Jun 15, 2017

Add an option to copy file instead of symlink, e.g.

- link:
    ~/.zshrc:
      copy: true
      path: zshrc
@anishathalye
Copy link
Owner

Would it be better to just have a separate copy: thing like link: ?

@jerrykal
Copy link
Author

That's a good idea.

@jerrykal jerrykal changed the title Add copy option to link Add copy config option Jun 15, 2017
@sharethewisdom
Copy link

Also, options could be added to copy: equivalent to options found in install(1)?

@anishathalye
Copy link
Owner

Actually, it may be better to have a copy: true option (as @ooJerryLeeoo suggested) rather than a separate copy: task (otherwise, there would be a lot of duplicated logic).

@anishathalye
Copy link
Owner

As discussed in #221, we couldn't find concrete cases where copy: was necessary. This issue also hasn't received a ton of attention, so perhaps this feature is not needed.

@u1156
Copy link

u1156 commented Nov 1, 2020

Hi! I think I have a use case for that feature. I want to track my standard Dockerfile and if dotbot links it then docker-compose can't use this symlink as a file. Because docker-compose is strict about working context.
It would be great to be able to instruct dotbot to copy files instead of linking them in some specific cases.

@anishathalye
Copy link
Owner

I don't use docker-compose, but based on this issue it seems like it does support symlinks (except on Windows)?

@u1156
Copy link

u1156 commented Nov 6, 2020

I'm on a mac. Symlinks does not seem to work for a Dockerfile.

@anishathalye
Copy link
Owner

Ah, I see. For now, you can use shell: with a command like cp -u ....

@jmigual
Copy link

jmigual commented May 29, 2021

Hi I found another use case. I have a .gitconfig file that I use both for Windows and Linux. It wouldn't be much of a problem except when signing commits with GPG where Git on Windows requires you to define the gpg.program key if you don't want it to use the incorporated gpg from Git-Bash. So, my idea was to comment the Windows only part of the .gitconfig file, copy the file and uncomment the part if I am on Windows.

@eengstrom
Copy link
Contributor

@jmigual - I offer an alternative for your use case that I use:

First, I define an environment variable, ${DBOT_TARGET_DISTRO}, which is set in mydotbot wrapper script. Then, with a file ~/.gitconfig-windows or ~/.gitconfig-linux or whatever, you can link the distro-local file like this:

- link:
    # add some distro-specific symlinks
    ~/.gitconfig-local:
      path: ~/.gitconfig-${DBOT_TARGET_DISTRO}
      if: '[ -n "$DBOT_TARGET_DISTRO" ]'

Finally, include that in your main~/.gitconfig file like this:

[include]
  path = ~/.gitconfig-local

@jmigual
Copy link

jmigual commented May 30, 2021

Thanks! This will work perfectly. I didn't know about the include directive in .gitconfig

@waipeng
Copy link

waipeng commented Apr 17, 2024

Hi! I stumbled on this old issue.

My use case is for ~/Library/KeyBindings/DefaultKeyBinding.dict on MacOS. Turns out that using a symlink does not work for some programs like TextEdit1 .

Yes, I can work around it with cp. Just adding this as a potential use case, in case this is ever reconsidered.

Thanks for the work! ❤️

@anishathalye anishathalye reopened this Apr 17, 2024
@anishathalye
Copy link
Owner

I think there's enough demand for this that we should add it. I'm pretty busy at the moment but will take a closer look as soon as I get a chance.

@klaustopher
Copy link

It looks like the code that is in #221 still works is tested and has documentation attached. Could we re-open and merge this PR?

I have the same issue that in my dotfiles on macOS I want to install a keyboard layout in ~/Library/Keyboard Layouts and symlinks don't work there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants