1 |
9800
|
aaronmk
|
#!/bin/bash -e
|
2 |
|
|
. "$(dirname "${BASH_SOURCE[0]}")"/util.sh
|
3 |
|
|
|
4 |
|
|
if self_not_included; then
|
5 |
|
|
|
6 |
|
|
alias use_sync='declare prefix=sync_; import_vars; unset prefix'
|
7 |
|
|
|
8 |
|
|
upload() # usage: local_dir=... remote_url=server:dir upload paths...
|
9 |
|
|
# requires put from https://uutils.googlecode.com/svn/trunk/bin/put
|
10 |
|
|
{
|
11 |
|
|
echo_func; kw_params local_dir remote_url swap
|
12 |
|
|
|
13 |
|
|
base_dir="$local_dir" cmd=canon_rel_path foreach_arg
|
14 |
9811
|
aaronmk
|
# also need to --include parent dirs for each --include path
|
15 |
|
|
local a; for a in "$@"; do path_parents "$a"; args+=("${dirs[@]}"); done
|
16 |
|
|
set -- "${args[@]}"
|
17 |
|
|
|
18 |
9800
|
aaronmk
|
set -- "${@/#/--include=/}" # prepend each with --include=/
|
19 |
|
|
src="$local_dir" dest="$remote_url" command put "$@" --exclude="**"
|
20 |
|
|
}
|
21 |
|
|
|
22 |
|
|
download() { echo_func; swap=1 upload; } # usage: see upload()
|
23 |
|
|
|
24 |
|
|
fi
|