From 975b347b7206a0e9caeeea8349e4765b4db654f9 Mon Sep 17 00:00:00 2001 From: Mike Burns Date: Fri, 16 Aug 2013 15:42:56 +0200 Subject: Pre-up, post-up, pre-down, and post-down hooks These are programs that, if they exist, will run before or after the syncronization/removal is run. Three use cases caused this: 1. The thoughtbot dotfiles will run a vundle installation set of commands after intitial synchronization. 2. I changed the location of `.bash_history` to `.bash/history` and wanted to move `.bash_history` to `.bash/history` after up to preserve existing history. 3. Moving from an existing old-style custom install script to `rcup` might require some cleanup; this happened in practice, and required a simple script. --- man/rcup.1 | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'man/rcup.1') diff --git a/man/rcup.1 b/man/rcup.1 index 99fa364..4140205 100644 --- a/man/rcup.1 +++ b/man/rcup.1 @@ -84,7 +84,8 @@ option in .Xr rcrc 5 can be used to list files that must only be copied. .Pp -Two meta files are supported: host-specific files and tagged files. +Three meta files are supported: host-specific files, tagged files, +hooks. .Pp Host-specific files go in a directory named for the host, prefixed with .Pa host- . @@ -93,8 +94,7 @@ For example, contains files specific to the computer with hostname .Pa scarlett , and these files will only be installed on the computer with hostname -.Pa scarlett -\&. +.Pa scarlett . .Pp Tagged files go in a directory named for the tag, prefixed with .Li tag- . @@ -103,18 +103,33 @@ Therefore, files under are only installed when installing using the .Li git tag. +.Pp +Hooks go in a directory named +.Pa hooks . +Two hooks are supported by +.Nm rcup : +pre-up and post-up . These go in files with predictable filenames: +.Pa .dotfiles/hooks/pre-up and +.Pa .dotfiles/hooks/post-up . +These files must be executable. They are run every time +.Nm +is run, and therefore must be idempotent. .Sh ALGORITHM It is instructive to understand the process .Nm rcup uses when synchronizing your rc files: .Bl -enum .It +The pre-up hook is run. +. +.It All non-host, non-tag files without a dot prefix are symlinked to the dotted filename in your home directory. So, .Pa .dotfiles/tigrc is symlinked to .Pa ~/.tigrc . +. .It All non-host, non-tag directories have their structure copied to your home directory, then a non-dotted symlink is created within. So for @@ -125,12 +140,14 @@ causes the directory to be created, then .Pa haskell.vim is symlinked within. +. .It Steps (1) and (2) are applied to host-specific files. These are files under a directory named .Sm off .Pa host- Va $HOSTNAME . .Sm on +. .It Steps (1) and (2) are applied to tag-specific files. These are files under directories named @@ -142,6 +159,9 @@ where is the name of each specified tag in turn, taken from the command line or from .Xr rcrc 5 . +. +.It +The post-up hook is run. .El . .Sh FILES -- cgit v1.2.3