update sync script

This commit is contained in:
Adrian Amaglio 2023-05-05 10:34:09 +02:00
parent 5d4796d5cd
commit e2372596a3
3 changed files with 30 additions and 16 deletions

View File

@ -47,7 +47,9 @@ help:
html: html:
"$(PELICAN)" "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS) "$(PELICAN)" "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS)
pull: pull:
./pull-content.sh ./sync-content.sh pull
push:
./sync-content.sh push
clean: clean:
[ ! -d "$(OUTPUTDIR)" ] || rm -rf "$(OUTPUTDIR)" [ ! -d "$(OUTPUTDIR)" ] || rm -rf "$(OUTPUTDIR)"

View File

@ -1,15 +0,0 @@
#!/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
rclone copy --webdav-url="$server/remote.php/webdav/" --webdav-vendor=nextcloud --webdav-user="$user" --webdav-pass=$(rclone obscure $password) :webdav:"$ncpath" content

27
sync-content.sh Executable file
View File

@ -0,0 +1,27 @@
#!/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