From f5ea04cc56855a4e868ba5c05fb904f853809994 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Tue, 16 Feb 2010 21:21:04 +0000 Subject: publish: add hooks, make date format configurable git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@442 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede --- publish | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/publish b/publish index 43d5b43..4507f8d 100755 --- a/publish +++ b/publish @@ -50,6 +50,13 @@ base_rsync=marvin.example.com:/var/www/www.example.com/htdocs/pub history_file=~/.publish.history history_lines=1000 +date_format='%Y-%m-%d-' + +rsync_pre_invoke() { true ;} +rsync_post_invoke() { true ;} +publish_pre_invoke() { true ;} +publish_post_invoke() { true ;} + [ -e ~/.publish.cfg ] && . ~/.publish.cfg usage() @@ -147,9 +154,9 @@ elif [ "$inputxclip" = 1 ] ; then echo "Ignoring -x because there are files on the command line" >&2 fi -d_date=$(date +'%Y-%m-%d') +d_date=$(date +"$date_format") d_random=$(get_random) -d_server="$d_date-$d_random" +d_server="$d_date$d_random" rsync_args="--partial --recursive --compress" d_server_http_base=$( echo -n "$d_server" | uri_encode ) @@ -165,6 +172,8 @@ else fi +publish_pre_invoke + while [ "$#" -gt 0 ]; do file="$1" shift @@ -185,5 +194,9 @@ while [ "$#" -gt 0 ]; do echo "$uri" history_append "$uri" + rsync_pre_invoke $NODO rsync $rsync_args "$file$trail" $base_rsync"/$d_server/" + rsync_post_invoke done + +publish_post_invoke -- cgit v1.2.3