From 71a5e706eea446a9157d0469c8e96c08b62f1df9 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Fri, 18 Mar 2016 11:28:38 -0700 Subject: automatic symlink fixes for GPG --- home-mrconfig | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/home-mrconfig b/home-mrconfig index f2d96393..d7cc5bb4 100644 --- a/home-mrconfig +++ b/home-mrconfig @@ -158,6 +158,21 @@ lib = fi fi } + # For the case where the updated file overwrites the symlink (this + # is for ~/src/priv which is not checked out on win32 so skip that + # check) + fix_overwritten_symlink_aggressive () { + local file=$1 + if [ ! -L "$HOME/$file" \ + -a "$HOME/$file" -nt "$HOME/src/priv/$file" ]; then + mv "$HOME/$file" "$HOME/src/priv/$file" + fi + } + +# TODO: have a variable "unstowable" listing the files in a repo that +# should be fixed by the above code, and incorporate into mr stow +# library. Similarly set MR_NAME as a variable or something (should +# work on that library) # --- primary dotfiles repository @@ -261,6 +276,10 @@ pre_update = mr autoci # into ~/.duply, make the dirs first pre_stow = homedir_mkdirs +pre_unstow = fix_overwritten_symlink_aggressive .gnupg/pubring.gpg; fix_overwritten_symlink_aggressive .gnupg/secring.gpg; fix_overwritten_symlink_aggressive .gnupg/trustdb.gpg; +pre_restow = fix_overwritten_symlink_aggressive .gnupg/pubring.gpg; fix_overwritten_symlink_aggressive .gnupg/secring.gpg; fix_overwritten_symlink_aggressive .gnupg/trustdb.gpg; +pre_update = fix_overwritten_symlink_aggressive .gnupg/pubring.gpg; fix_overwritten_symlink_aggressive .gnupg/secring.gpg; fix_overwritten_symlink_aggressive .gnupg/trustdb.gpg; + [src/athpriv] checkout = git clone athenap:athpriv athpriv lib = MR_NAME=athpriv -- cgit v1.2.3