diff --git a/scripts/deploy-ebook-to-www b/scripts/deploy-ebook-to-www index 289edd05..2c4ed47d 100755 --- a/scripts/deploy-ebook-to-www +++ b/scripts/deploy-ebook-to-www @@ -20,7 +20,9 @@ USAGE 3. Generate various images and thumbnails for web use. - 4. Generates RSS/Atom/OPDS feeds. + 4. Generates RSS/Atom/OPDS feeds, but only if no other tasks are queued behind this one. + + 5. Generate bulk download files, but only if no other tasks are queued behind this one. With --no-images, do not create cover thumbnails or hero images for the web. @@ -34,6 +36,8 @@ USAGE With --no-feeds, don't generate RSS/Atom/OPDS feeds. + With --no-bulk-downloads, don't generate bulk download files. + EOF exit } @@ -51,6 +55,7 @@ lastPushHash="" epubcheck="true" recompose="true" feeds="true" +bulkDownloads="true" if [ $# -eq 0 ]; then usage @@ -104,6 +109,10 @@ while [ $# -gt 0 ]; do feeds="false" shift 1 ;; + --no-bulk-downloads) + bulkDownloads="false" + shift 1 + ;; *) break ;; esac done @@ -369,6 +378,15 @@ do sudo chgrp --preserve-root --recursive "${group}" "${webRoot}/images/covers/" sudo chmod --preserve-root --recursive g+ws "${webRoot}/images/covers/" + popd > /dev/null || die "Couldn't pop directory." +done + +queuedTasks="false" +if tsp | grep --quiet --extended-regexp "^[0-9]+\s+queued"; then + queuedTasks="true" +fi + +if [ "${queuedTasks}" = "false" ]; then if [ "${verbose}" = "true" ]; then printf "Rebuilding web library cache ... " fi @@ -378,23 +396,52 @@ do if [ "${verbose}" = "true" ]; then printf "Done.\n" fi - - popd > /dev/null || die "Couldn't pop directory." -done - -if [ "${feeds}" = "true" ]; then - # Build the various feeds catalog +else if [ "${verbose}" = "true" ]; then - printf "Building feeds ... " - fi - - "${scriptsDir}/generate-feeds" --webroot "${webRoot}" --weburl "${webUrl}" - - sudo chown --recursive se:committers "${webRoot}"/{atom,rss,opds}/{*.xml,subjects} - sudo chmod --recursive 664 "${webRoot}"/{atom,rss,opds}/{*.xml,subjects/*.xml} - sudo chmod 775 "${webRoot}"/{atom,rss,opds}/subjects - - if [ "${verbose}" = "true" ]; then - printf "Done.\n" + printf "Tasks queued after this one, not rebuilding web library cache.\n" + fi +fi + +if [ "${feeds}" = "true" ]; then + # Build the various feeds catalog, but only if we don't have more items in the tsp build queue. + if [ "${queuedTasks}" = "false" ]; then + if [ "${verbose}" = "true" ]; then + printf "Building feeds ... " + fi + + "${scriptsDir}/generate-feeds" --webroot "${webRoot}" --weburl "${webUrl}" + + sudo chown --recursive se:committers "${webRoot}"/feeds/*/{*.xml,*/*.xml} + sudo chmod --recursive a+r,ug+w,a+X "${webRoot}"/feeds/*/ + + if [ "${verbose}" = "true" ]; then + printf "Done.\n" + fi + else + if [ "${verbose}" = "true" ]; then + printf "Tasks queued after this one, not building feeds.\n" + fi + fi +fi + +if [ "${bulkDownloads}" = "true" ]; then + # Build the various feeds catalog, but only if we don't have more items in the tsp build queue. + if [ "${queuedTasks}" = "false" ]; then + if [ "${verbose}" = "true" ]; then + printf "Building bulk downloads ... " + fi + + "${scriptsDir}/generate-bulk-downloads" --webroot "${webRoot}" + + sudo chown --recursive se:committers "${webRoot}"/bulk-downloads/*/ + sudo chmod --recursive a+r,ug+w,a+X "${webRoot}"/bulk-downloads/*/ + + if [ "${verbose}" = "true" ]; then + printf "Done.\n" + fi + else + if [ "${verbose}" = "true" ]; then + printf "Tasks queued after this one, not building bulk downloads.\n" + fi fi fi