Giter VIP home page Giter VIP logo

Comments (4)

TheLocehiliosan avatar TheLocehiliosan commented on September 26, 2024

@grasegger - Is using a symbolic link a possibility?

from yadm.

grasegger avatar grasegger commented on September 26, 2024

@TheLocehiliosan But how would I make sure the tracked symlink only gets created on darwin systems?

from yadm.

TheLocehiliosan avatar TheLocehiliosan commented on September 26, 2024
  1. Choose a central place you want the file to exist. For my example, I'll use $HOME/.config/yadm/src/abc.
  2. This file should be added to your dotfiles repo.
  3. On the system where you want this file referenced by an system specific path do the following:
    • Create a "fully qualitified" symlink to the file from step 1, in the desired location.
    • ln -s "$HOME/.config/yadm/src/abc" "$HOME/Library/Preferenes/abc"
    • Move that new symlink under the .config/yadm/alt path, and name it using a template that will match the system. https://yadm.io/docs/alternates#
    • mv "$HOME/Library/Preferenes/abc" "$HOME/.config/yadm/alt/Library/Preferenes/abc##os.Darwin"
    • Add that symlink to your dotfiles repo
    • yadm add "$HOME/.config/yadm/alt/Library/Preferenes/abc##os.Darwin"
    • At this point, yadm should have created a symlink in your desired path, which points to the os.Darwin versions (which in turn points to the central version)
  4. Repeat this on the other system
    • ln -s "$HOME/.config/yadm/src/abc" "$HOME/.config/abc/abc.conf"
    • mv "$HOME/.config/abc/abc.conf" "$HOME/.config/yadm/alt/.config/abc/abc.conf##os.Linux"
    • yadm add "$HOME/.config/yadm/alt/.config/abc/abc.conf##os.Linux"
  5. The appropriate symlink will only be created on the systems that match the template you use.

I know this sounds a bit complicated, but the end result would look like this:

.config/yadm/alt/Library/Preferenes/abc##os.Darwin -> $HOME/.config/yadm/src/abc
.config/yadm/alt/.config/abc/abc.conf##os.Linux -> $HOME/.config/yadm/src/abc
.config/yadm/src/abc

Note: it's important to use fully qualitified symlinks on each system, because your different systems may very well have different $HOME paths.

from yadm.

grasegger avatar grasegger commented on September 26, 2024
  1. Choose a central place you want the file to exist. For my example, I'll use $HOME/.config/yadm/src/abc.
  2. This file should be added to your dotfiles repo.
  3. On the system where you want this file referenced by an system specific path do the following:
    • Create a "fully qualitified" symlink to the file from step 1, in the desired location.
    • ln -s "$HOME/.config/yadm/src/abc" "$HOME/Library/Preferenes/abc"
    • Move that new symlink under the .config/yadm/alt path, and name it using a template that will match the system. https://yadm.io/docs/alternates#
    • mv "$HOME/Library/Preferenes/abc" "$HOME/.config/yadm/alt/Library/Preferenes/abc##os.Darwin"
    • Add that symlink to your dotfiles repo
    • yadm add "$HOME/.config/yadm/alt/Library/Preferenes/abc##os.Darwin"
    • At this point, yadm should have created a symlink in your desired path, which points to the os.Darwin versions (which in turn points to the central version)
  4. Repeat this on the other system
    • ln -s "$HOME/.config/yadm/src/abc" "$HOME/.config/abc/abc.conf"
    • mv "$HOME/.config/abc/abc.conf" "$HOME/.config/yadm/alt/.config/abc/abc.conf##os.Linux"
    • yadm add "$HOME/.config/yadm/alt/.config/abc/abc.conf##os.Linux"
  5. The appropriate symlink will only be created on the systems that match the template you use.

I know this sounds a bit complicated, but the end result would look like this:

.config/yadm/alt/Library/Preferenes/abc##os.Darwin -> $HOME/.config/yadm/src/abc
.config/yadm/alt/.config/abc/abc.conf##os.Linux -> $HOME/.config/yadm/src/abc
.config/yadm/src/abc

Note: it's important to use fully qualitified symlinks on each system, because your different systems may very well have different $HOME paths.

This is brilliant, I kinda forgot about tracking a symlink with git and wouldn't have thought that yadm just treats them like files.

from yadm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.