26 lines
448 B
Bash
Executable File
26 lines
448 B
Bash
Executable File
#!/usr/bin/env sh
|
|
|
|
# requires rclone to be setup
|
|
|
|
set -e
|
|
|
|
SCRIPT=$(readlink -f "$0")
|
|
SCRIPTPATH=$(dirname "$SCRIPT")
|
|
|
|
source $XDG_CONFIG_HOME/nextcloud.config.sh
|
|
|
|
if test -n "$1"; then
|
|
FILE_PATH=$1
|
|
elif test ! -t 0; then
|
|
read -r FILE_PATH
|
|
else
|
|
>&2 echo "Provide a file"
|
|
exit 1
|
|
fi
|
|
|
|
FILENAME=$(basename $FILE_PATH)
|
|
|
|
rclone copy "$FILE_PATH" "$NC_RCLONE_REMOTE:/$NC_SHARE_DIR"
|
|
|
|
$SCRIPTPATH/nc-create-share.sh "$NC_SHARE_DIR/$FILENAME"
|