1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-04 18:34:48 +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

@@ -8,7 +8,7 @@ Entry | Description
`src` | Dotfile path within the `dotpath` (dotfiles with empty `src` are ignored and considered installed, can use `variables`, make sure to quote)
`link` | Defines how this dotfile is installed. Possible values: *nolink*, *absolute*, *relative*, *link_children* (See [Symlinking dotfiles](config-file.md#symlinking-dotfiles)) (defaults to value of `link_dotfile_default`)
`actions` | List of action keys that need to be defined in the **actions** entry below (See [actions](config-actions.md))
`chmod` | Defines the file permissions in octal notation to apply during installation (See [permissions](config-file.md#permissions))
`chmod` | Defines the file permissions in octal notation to apply during installation or the special keyword `preserve` (See [permissions](config-file.md#permissions))
`cmpignore` | List of patterns to ignore when comparing (enclose in quotes when using wildcards; see [ignore patterns](config-file.md#ignore-patterns))
`ignore_missing_in_dotdrop` | Ignore missing files in dotdrop when comparing and importing (see [Ignore missing](config-file.md#ignore-missing))
`ignoreempty` | If true, an empty template will not be deployed (defaults to the value of `ignoreempty`)

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