summaryrefslogtreecommitdiff
path: root/publish
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2010-02-16 21:21:04 +0000
committerweasel <weasel@bc3d92e2-beff-0310-a7cd-cc87d7ac0ede>2010-02-16 21:21:04 +0000
commitf5ea04cc56855a4e868ba5c05fb904f853809994 (patch)
tree37f6c45af9051a2a9724a9544e5d907bf1776da7 /publish
parentaa0e92335a096b622238a4aa871ed36a998ff05c (diff)
publish: add hooks, make date format configurable
git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@442 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede
Diffstat (limited to 'publish')
-rwxr-xr-xpublish17
1 files 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