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. --- bin/rcup | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'bin/rcup') diff --git a/bin/rcup b/bin/rcup index 5f51192..5a42a81 100755 --- a/bin/rcup +++ b/bin/rcup @@ -119,13 +119,13 @@ handle_command_line() { handle_common_flags rcup $version $verbosity tags=${arg_tags:-$TAGS} - dotfiles_dirs=${dotfiles_dirs:-$DOTFILES_DIRS} + DOTFILES_DIRS=${dotfiles_dirs:-$DOTFILES_DIRS} files=$@ for tag in $tags; do LS_ARGS="$LS_ARGS -t $tag" done - for dotfiles_dir in $dotfiles_dirs; do + for dotfiles_dir in $DOTFILES_DIRS; do LS_ARGS="$LS_ARGS -d $dotfiles_dir" done for exclude in $excludes; do @@ -146,6 +146,9 @@ if [ -e $HOME/.rcrc ]; then fi handle_command_line $* +: ${DOTFILES_DIRS:=$DOTFILES_DIRS $DEFAULT_DOTFILES_DIR} + +run_hooks pre up for dest_and_src in `lsrc $LS_ARGS`; do saved_ifs=$IFS @@ -162,3 +165,5 @@ for dest_and_src in `lsrc $LS_ARGS`; do handle_file $src $dest $sigil done + +run_hooks post up -- cgit v1.2.3