diff options
-rwxr-xr-x | create-temp | 4 | ||||
-rwxr-xr-x | publish | 17 |
2 files changed, 13 insertions, 8 deletions
diff --git a/create-temp b/create-temp index 02b6064..f72b2fd 100755 --- a/create-temp +++ b/create-temp @@ -31,8 +31,8 @@ TARGET="$HOME/tmp" rmdir "$BASE/"*"/downloads" 2> /dev/null || true rmdir "$BASE/"* 2> /dev/null || true -[ -d "$BASE/$TODAY" ] || mkdir "$BASE/$TODAY" -[ -d "$BASE/$TODAY/downloads" ] || mkdir -m 2773 "$BASE/$TODAY/downloads" +mkdir -p "$BASE/$TODAY" +[ -d "$BASE/$TODAY/downloads" ] || install -d -m 2770 -g ww-download "$BASE/$TODAY/downloads" if ! [ -L "$TARGET" ] && [ -e "$TARGET" ]; then echo "$0: '$TARGET' already exists and is not a symlink." >&2 exit 1; @@ -41,7 +41,7 @@ # # The random location chosen is printed to stdout when the script finishes, # and is copied to the xclipboard if the xclip(1) or xsel(1) utility is -# installed. +# installed (configurable via the clipper variable). # # base_http and base_rsync can be overriden in a ~/.publish.cfg shell snippet. @@ -55,6 +55,14 @@ ttl=180 date_format='%Y-%m-%d-' rsync_args="--compress --times --chmod=u=rwX,go=rX" +if command -v xclip >/dev/null 2>&1; then + clipper=xclip +elif command -v xsel >/dev/null 2>&1; then + clipper=xsel +else + clipper=true +fi + rsync_pre_invoke() { true ;} rsync_post_invoke() { true ;} @@ -297,13 +305,10 @@ if [ "$add_default_cs" -gt 0 ] ; then shift fi -if command -v xclip >/dev/null 2>&1 && [ -n "${DISPLAY:-}" ]; then - echo -n "$main_uri" | xclip -elif command -v xsel >/dev/null 2>&1 && [ -n "${DISPLAY:-}" ]; then - echo -n "$main_uri" | xsel +if [ -n "${DISPLAY:-}" ]; then + echo -n "$main_uri" | $clipper fi - if [ -n "${ttl}" ]; then setup_tmpdir echo "${ttl}" > "$tmpdir/.publish.ttl" |