deadc0de6 / dotdrop

Save your dotfiles once, deploy them everywhere
https://dotdrop.readthedocs.io
GNU General Public License v3.0
1.78k stars 105 forks source link

[help] Opt out of chmod/file-permission checks? #369

Closed Lilja closed 1 year ago

Lilja commented 1 year ago

What I am trying to achieve I just added a new dotfile that installs from my WSL image to my host machine. The config goes something like this:

  wezterm_conf_wsl:
    src: wezterm
    dst: "/mnt/c/Users/Erik\ Lilja"
    link: "nolink"

When I run it, dotdrop tries to chmod the file to 755. I don't like how dotdrop tries to change that, and I saw that you could put the desired chmod octal. But in this scenario, that octal could change and since its affecting a quite important directory I don't want it to perform any side effects.

What I have tried so far put chmod: 777 on that dotfile, but I think it's a shaky solution

deadc0de6 commented 1 year ago

Hello, as described in the doc, the following appends on install:

So in your case, the permission of the file <dotpath>/wezterm should be applied to /mnt/c/Users/Erik\ Lilja, probably that directory permission is 755 in the dotpath.

But you want dotdrop to NOT touch the permission if that directory already exists, since it may be changed outside dotdrop, correct?

Of course you could force the permission you want with chmod: <something>. Most people do want that if the directory permission changes outside of dotdrop it is restored by dotdrop (based on the chmod entry or the directory permissions in the dotpath).

We could for example add a special value to the chmod entry like chmod: - to mean that no change of permission should occur on install. In case the directory does not exist it would get 777. Would that solve your use-case?

Lilja commented 1 year ago

We could for example add a special value to the chmod entry like chmod: - to mean that no change of permission should occur on install. In case the directory does not exist it would get 777. Would that solve your use-case?

Yes, I think that would work

deadc0de6 commented 1 year ago

Cool, I'll implement it and will keep you posted.

deadc0de6 commented 1 year ago

@Lilja I added a new special value to chmod: preserve. This should tell install and update not to mess with existing files permissions if set.

It is tracked in the chmod-preserve branch. The doc is here.

I couldn't go with - since this is a reserved keyword in yaml.

Could you give it a try?

Lilja commented 1 year ago

Tried it out, worked fine!

deadc0de6 commented 1 year ago

The new feature is now available in version 1.12.1.