From: Javier Fernández-Sanguino Date: Sun, 14 May 2017 12:58:01 +0000 (+0000) Subject: Add script to rsync the electronic books (epub et al) to the X-Git-Tag: 20180215~60 X-Git-Url: http://git.projectaon.org/?p=project-aon.git;a=commitdiff_plain;h=e26bd6a7787afe00c53e3cb4eaa630e5848b5b3b;hp=9e033435100e07e76b5ecd4faf37fe34e7bc2d4a Add script to rsync the electronic books (epub et al) to the server git-svn-id: https://projectaon.org/data/trunk@2638 f6f3e2d7-ff33-0410-aaf5-b4bee2cdac11 --- diff --git a/es/rsync-ebooks-to-server.sh b/es/rsync-ebooks-to-server.sh new file mode 100644 index 0000000..13a3387 --- /dev/null +++ b/es/rsync-ebooks-to-server.sh @@ -0,0 +1,48 @@ +#!/bin/sh + +# Copy all the electronic book formats generated using +# 'make publish' to Project Aon's server using rsync + +#LANGS="en es" +LANGS="es" +FORMATS="epub fb2 lrf mobi pdb" +DESTHOST=www.projectaon.org +ROOTSOURCEDIR=../../PUBLISH/ +ROOTDESTDIR=/home/javier_aon/projectaon/projectaon.org +OPTS="-rtz -i --chmod=Dg+s,ug+w,Fo-w,+X" +EXTRAOPTS="-vv" +#EXTRAOPTS="-v -v --dry-run" + + +# Command line options +if [ "$1" ] ; then + LANGS=$1 +fi + + +for lang in $LANGS; do + [ "$lang" = "en" ] && DIR=lw + [ "$lang" = "es" ] && DIR=ls + for type in $FORMATS; do + echo "Copying format ${type} in language ${lang}" + echo "Syncing files of type $f in language ${lang}" + + SOURCEDIR="${lang}/${type}" + DESTDIR=$SOURCEDIR + COMPLETE_SOURCE_DIR="${ROOTSOURCEDIR}/${SOURCEDIR}" + COMPLETE_DEST_DIR="${ROOTDESTDIR}/${DESTDIR}" + echo "ORIGIN: ${COMPLETE_SOURCE_DIR}" + echo "DESTINATION: ${DESTHOST}:${COMPLETE_DESTDIR}" + if [ ! -e "${COMPLETE_SOURCE_DIR}" ] || [ ! -d "${COMPLETE_SOURCE_DIR}" ] ; then + echo "ERROR: Directory ${COMPLETE_SOURCE_DIR} does not exist or is not a directory. Aborting." >&2 + echo "HINT: Did you run 'make publish' in the epub directory?" >&2 + exit 1 + fi + echo + set +e + rsync ${OPTS} ${EXTRAOPTS} ${COMPLETE_SOURCE_DIR} ${DESTHOST}:${COMPLETE_DESTDIR} + set -e + done +done + +