Comments (6)
I’m not sure what you mean by "mackup is the source for the add
command", because the chezmoi mackup support is mostly unsupported and undocumented, and I’m not sure that adding more explicit support for its idiosyncratic configuration mechanism would be a good thing. Especially as mackup support is only enabled for macOS, although it appears that mackup has some Linux support now.
I’m not seeing anything that suggests that ~/.config/iterm2/AppSupport/DynamicProfiles
should be a link to ~/Library/Application Support/iTerm2/DynamicProfiles
or something like that.
from chezmoi.
Part of the
iterm2/AppSupport/DynamicProfiles
file (directory) is a symlink, specifically theAppSupport
:~ ❯ ls -an ~/.config/iterm2/ total 0 drwxr-xr-x 3 501 20 96 Jul 16 2021 . drwxr-xr-x 10 501 20 320 Dec 8 23:42 .. lrwxr-xr-x 1 501 20 46 Jul 16 2021 AppSupport -> /Users/<NAME>/Library/Application Support/iTerm2
Hence adding this won't work.
What do you mean by "adding this won't work"? chezmoi supports symlinks and running
chezmoi add ~/.config/iterm2
results in private_dot_config/iterm2/symlink_AppSupport
being added to the source state with the contents /Users/<NAME>/Library/Application Support/iTerm2
.
What different result would you want?
from chezmoi.
Maybe it wasn't clear enough, or I am missing something, I will try to explain a bit more:
iterm as an example stores files in /Users/<NAME>/.config/iterm2/AppSupport/DynamicProfiles
which is actually, after symlink evaluation is /Users/<NAME>/Library/Application\ Support/iTerm2/DynamicProfiles
.
What's important to backup here is not the symlink itself, but the files inside the target directory.
I am getting an error when trying to do that:
~ ❯ chezmoi add ~/.config/iterm2/AppSupport/DynamicProfiles 20:38:15
chezmoi: lstat /Users/<NAME>/.local/share/chezmoi/dot_config/iterm2/symlink_AppSupport/DynamicProfiles: not a directory
And I don't get an error with: chezmoi add /Users/<NAME>/Library/Application\ Support/iTerm2/DynamicProfiles
For example if a file named "a.txt" is in that directory, it will be backed up with method 2 but not with method 1.
from chezmoi.
What I am suggesting is just doing filepath.EvalSymlinks
on each path passed to the add
logic from mackup command (or in general actually).
from chezmoi.
I’m not sure that would quite do what you really want, as to me you would want chemzoi add ~/.config/iterm2/AppSupport/DynamicProfiles
actually add:
private_dot_config/iterm2/symlink_AppSupport
private_Library/Application Support/iTerm2/DynamicProfiles/*
That feels like too much magic to be a default behaviour. At the same time, I think that the lstat
error provided is not useful, especially as it happens even with --follow
enabled (where I would expect it to traverse through but only add private_dot_config/iterm2/AppSupport/DynamicProfiles/*
).
I think that we have two issues:
-
chezmoi cannot pass through a directory symlink at all during
add
resolution, even with--follow
. This is surprising and I think that it's a bug. -
chezmoi should not magic its way into doing the right thing, but with a two step command the right thing should be possible, although it may require new flags that I don't have good names for:
chezmoi add ~/.config/iterm2/AppSupport chezmoi add ~/.config/iterm2/AppSupport/DynamicProfiles --resolve-to-real-files
from chezmoi.
I agree it's a bug, as I don't have enough history with chezmoi I thought it's expected.
Regarding the expected behaviour, I am not sure I agree:
The symlink is not something I try to backup at all. It's created by iterm and I'm OK with not backing it up, all I am interested in (and expect to work) is add private_dot_config/iterm2/AppSupport/DynamicProfiles/*
which is what I suggest will happen when running chezmoi mackup add iterm2
(after symlink evaluation in the mackup cmd).
I agree there's an inherent problem of backing up this path and hoping it will apply successfully on another machine where iterm not necessarily set up the same symlink for AppSupport
, but that is to handle by chezmoi user specifically for his use case (for example, having it apply to a different location depending on os).
What I am trying to say is the real value I see in the mackup integration is having the real backup paths available in a single command, hence I suggested to just evalsymlinks
each mackup path before add
ing.
I am OK with closing this issue without any action, it's not that important, just wanted to explain my thoughts 🤓
from chezmoi.
Related Issues (20)
- `chezmoi apply` overwrites any files that were placed by chezmoi, no matter the source HOT 2
- One-line binary install handle ARM(v7) HOT 2
- Use 1Password for secret with GitHub code spaces HOT 2
- chezmoi in GitHub codespaces 1/2 works HOT 3
- chezmoi edit with neovim hangs after making edits HOT 2
- Use `.chezmoiignore` to ignore scripts in `.chezmoiscripts`
- Re-add an "executable_" prefix file on Windows will lose the prefix HOT 4
- `gitHub.refreshPeriod` not work
- Machine UUID variable HOT 4
- Support for custom url request headers in .chezmoiexternal HOT 3
- msys2 not detected, bash scripts will run with windows shell HOT 2
- Customize the path for a single file HOT 3
- KeepassXC mode: "open" does not work with args ["--yubikey", "1:2343434"] HOT 1
- Way to add a file without `applying` HOT 4
- Using scripts on Windows? HOT 3
- FEATURE REQUEST: chezmoi mv HOT 3
- Add support to gopass multiline values HOT 2
- Setup branches inside config HOT 1
- New machine and some files just aren't there/claimed as unmanaged HOT 6
- Super Slow on my Windows HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chezmoi.