summaryrefslogtreecommitdiff
path: root/man
diff options
context:
space:
mode:
authorGravatar Mike Burns <mike@mike-burns.com>2013-08-16 15:42:56 +0200
committerGravatar Mike Burns <mike@mike-burns.com>2013-08-16 16:11:36 +0200
commit975b347b7206a0e9caeeea8349e4765b4db654f9 (patch)
tree7e993414fce578e351b38d0a761670ee551f22b0 /man
parent526fb25aff2b27b46aaa4754f5b613ca1c97f8c3 (diff)
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.
Diffstat (limited to 'man')
-rw-r--r--man/rcdn.111
-rw-r--r--man/rcup.126
2 files changed, 34 insertions, 3 deletions
diff --git a/man/rcdn.1 b/man/rcdn.1
index 6c641c9..24ca1a2 100644
--- a/man/rcdn.1
+++ b/man/rcdn.1
@@ -30,6 +30,17 @@ is, that directory is removed. If a rc file is not a symlink but is
listed in
.Va COPY_ALWAYS
the file is removed.
+.Pp
+The
+.Nm
+program will run hooks before and after removing files, if these hooks
+exist. Hooks are executable programs inside the dotfiles directory, with
+the following names:
+.Pa hooks/pre-down and
+.Pa hooks/post-down .
+These hooks are run each time
+.Nm
+is run and therefore must be idempotent.
.
.Bl -tag
.It Fl d Ar DIR
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