split upload with moar features

This commit is contained in:
Ville Rantanen
2018-03-15 22:29:07 +02:00
parent 61d872fa17
commit acb366120d
5 changed files with 196 additions and 127 deletions

View File

@@ -0,0 +1,28 @@
#!/bin/bash
test "$1" = "-h" && {
echo "Add argument -f to overwrite files"
exit 0
}
test "$1" = "-f" && FORCE=1
which curl &> /dev/null || {
echo "curl required"
exit 1
}
ROOTURL="{{ rooturl }}"
SHARE="{{ name }}"
get_file() {
WRITE=0
FILENAME="$1"
TOKEN="$2"
test "$FORCE" = "1" && WRITE=1
test -f "${FILENAME}" || WRITE=1
test "$WRITE" = "1" && {
echo Downloading ${FILENAME}
mkdir -p $( dirname "$FILENAME" )
curl "${ROOTURL}direct/${SHARE}/${TOKEN}/${FILENAME}" > "${FILENAME}"
} || {
echo Skipping ${FILENAME}
}
}
{{ commands }}