From bb2ff2ab74ebeabb69d692d5bfda8e13b0e75eea Mon Sep 17 00:00:00 2001 From: mapperr Date: Sun, 27 Oct 2019 17:09:38 +0100 Subject: [PATCH] Process secrets after everithing else --- README.md | 12 ++++++++---- dfl | 3 ++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 293f69d..5b03819 100644 --- a/README.md +++ b/README.md @@ -30,17 +30,20 @@ If something that is not a link exists it will ask nicely what to do. ### Secrets You can put your secret dotfiles in the `dotfiles/secrets` directory, -they will be linked after the `default` ones, and, if `dotfiles` is a git repo, you can gitignore it. +they will be linked after the `default` ones and the eventual override. + +It's a handy directory to gitignore, if your `dotfiles` is a git repo. ### Overrides -If you need some 'overrides', put them in a new directory, e.g. `dotfiles/fluxbox`, and pass it to the script as an argument, +If you need some 'overrides', put them in a new directory, +e.g. `dotfiles/fluxbox`, and pass it to the script as an argument, like this: `dfl l fluxbox` -It will link `default`, then `secrets` and then the `fluxbox` directory, overriding existing links. +It will link `default`, then the `fluxbox` and then `secrets`, overriding existing links. This way of handle things is inspired by [bashdot](https://github.com/bashdot/bashdot) profiles. @@ -50,7 +53,8 @@ that translates in you need some dotfiles to have different content than the usu ### Tracking -`dfl` tracks the links it creates, so it deletes them if they are not presents in your `dotfiles` directory anymore. +`dfl` tracks the links it creates, +so it deletes them if they are not presents in your `dotfiles` directory anymore. It's clean, does not leave broken symlinks all around. diff --git a/dfl b/dfl index 530a7ce..edade4c 100755 --- a/dfl +++ b/dfl @@ -3,6 +3,7 @@ # DotFiles Linker # requirements: +# - bash, I guess # - readlink # optionals: @@ -348,10 +349,10 @@ elif [ "$command" = "l" ] || [ "$command" = "link" ]; then fi cd $dotfiles_dir_abs > /dev/null test -d $default_profile_name && process_profile $default_profile_name - test -d $secrets_profile_name && process_profile $secrets_profile_name if [ ! -z "$profile" ]; then test -d $profile && process_profile $profile fi + test -d $secrets_profile_name && process_profile $secrets_profile_name cd - >/dev/null process_deleted_files $profile -- 2.45.2