28 lines
767 B
Bash
28 lines
767 B
Bash
|
#!/bin/sh
|
||
|
|
||
|
server='https://nuage.jean-cloud.net'
|
||
|
user="lexicographe"
|
||
|
ncpath=content/
|
||
|
password="$CLOUD_PASSWORD"
|
||
|
if [ -z "$password" ] ; then
|
||
|
password="$(cat .password)"
|
||
|
fi
|
||
|
if [ -z "$password" ] ; then
|
||
|
echo "Aucun mot de passe trouvé"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
action="$1"
|
||
|
if [ -z "$action" ] ; then
|
||
|
action=pull
|
||
|
fi
|
||
|
|
||
|
if [ "$action" = 'pull' ] ; then
|
||
|
rclone copy --webdav-url="$server/remote.php/webdav/" --webdav-vendor=nextcloud --webdav-user="$user" --webdav-pass=$(rclone obscure $password) :webdav:"$ncpath" content
|
||
|
elif [ "$action" = 'push' ] ; then
|
||
|
rclone copy --webdav-url="$server/remote.php/webdav/" --webdav-vendor=nextcloud --webdav-user="$user" --webdav-pass=$(rclone obscure $password) content :webdav:"$ncpath"
|
||
|
else
|
||
|
echo "unknown action: $action"
|
||
|
exit 1
|
||
|
fi
|