summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2013-05-07 14:02:39 +0000
committerweasel <weasel@bc3d92e2-beff-0310-a7cd-cc87d7ac0ede>2013-05-07 14:02:39 +0000
commitc6b1bb22730ae1a28ca4d1ebe56b48e1a87d442a (patch)
tree612ddd67a2fb7b94e4201d3c9af6f6d79120b222
parent9c1b659facd5e8da7af451d53061237ed42c6baa (diff)
Add unpublish support
git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@623 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede
-rwxr-xr-xpublish20
1 files changed, 18 insertions, 2 deletions
diff --git a/publish b/publish
index 4d4a4f6..2dab69e 100755
--- a/publish
+++ b/publish
@@ -83,6 +83,7 @@ OPTIONS:
-t days time to live in days
-T tag directory name on the server (use this to re-publish under that name)
-x Publish the contents of the xclipboard.
+ -u Unpublish directory (only useful together with -T)
EOF
}
@@ -121,8 +122,10 @@ do_screenshot=0
make_qrcode=0
add_default_cs=0
relative=""
+d_server=""
+unpublish=0
-while getopts "rhnq8HSxs:t:T:" OPTION
+while getopts "rhnq8HSxs:t:T:u" OPTION
do
case $OPTION in
h)
@@ -165,6 +168,9 @@ do
T)
d_server="$OPTARG"
;;
+ u)
+ unpublish=1
+ ;;
*)
usage >&2
exit 1
@@ -176,6 +182,17 @@ shift $(($OPTIND - 1))
tmpdir=""
+if [ "$unpublish" -gt 0 ] ; then
+ if [ -z "$d_server" ]; then
+ echo "Option -u only makes sense together with -T."
+ exit 1
+ fi
+ setup_tmpdir
+ $NODO rsync --recursive $rsync_args $relative --delete -v "$tmpdir/." $base_rsync"/$d_server/"
+ exit
+fi
+
+
if [[ "$do_screenshot" -gt 0 ]]; then
setup_tmpdir
img="$tmpdir/screenshot.png"
@@ -240,7 +257,6 @@ else
echo "$main_uri"
fi
-
publish_pre_invoke
if [ "$make_qrcode" -gt 0 ] ; then