1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-04 17:24:46 +00:00

add chmod preserve for #368

This commit is contained in:
deadc0de6
2022-12-07 15:46:31 +01:00
committed by deadc0de
parent 3b38d45c39
commit 83662006d7
6 changed files with 155 additions and 58 deletions

View File

@@ -90,8 +90,20 @@ dotfiles:
src: dir
dst: ~/dir
chmod: 744
f_preserve:
src: preserve
dst: ~/preserve
chmod: preserve
```
The `chmod` value defines the file permissions in octal notation to apply on dotfiles. If undefined
new files will get the system default permissions (see `umask`, `777-<umask>` for directories and
`666-<umask>` for files).
The special keyword `preserve` allows to ensure that if the dotfiles already exists
on the filesystem, it is not altered during `install` and the `chmod` value won't
be changed during `update`.
On `import`, the following rules are applied:
* If the `-m`/`--preserve-mode` switch is provided or the config option
@@ -107,12 +119,13 @@ On `install`, the following rules are applied:
* Otherwise, the permissions of the dotfile in the `dotpath` are applied.
* If the global setting `force_chmod` is set to true, dotdrop will not ask
for confirmation to apply permissions.
* If `chmod` is `preserve` and the destination exists with a different permission set
than system default, then it is not altered
On `update`, the following rule is applied:
* If the permissions of the file in the filesystem differ from the dotfile in the `dotpath`,
then the dotfile entry `chmod` is added/updated accordingly.
then the dotfile entry `chmod` is added/updated accordingly (unless `chmod` value is `preserve`)
## Symlinking dotfiles