LP#1967770: Make sure cover image dirs exist
authorMike Rylander <mrylander@gmail.com>
Tue, 5 Apr 2022 14:38:55 +0000 (10:38 -0400)
committerMike Rylander <mrylander@gmail.com>
Tue, 5 Apr 2022 14:38:55 +0000 (10:38 -0400)
This commit teaches autogen.sh, which should be run after each upgrade,
how to check for and create the required locations for cover image
upload.

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/src/extras/autogen.sh

index 7cf9502..90f6da2 100755 (executable)
@@ -24,6 +24,7 @@ set -u
 JSDIR="LOCALSTATEDIR/web/opac/common/js"
 FMDOJODIR="LOCALSTATEDIR/web/js/dojo/fieldmapper"
 SLIMPACDIR="LOCALSTATEDIR/web/opac/extras/slimpac"
+COVERDIR="LOCALSTATEDIR/web/opac/extras/ac"
 
 # ---------------------------------------------------------------------------
 # Make sure we're not root and are able to write to the destination directory
@@ -76,11 +77,20 @@ function check_files_writable {
 OHNO=0
 
 # Verify we're able to write everywhere we need
-for DIR in "$JSDIR" "$FMDOJODIR" "$SLIMPACDIR"
+for DIR in "$JSDIR" "$FMDOJODIR" "$SLIMPACDIR" "$COVERDIR"
 do
     check_dir_writable "$DIR"
 done
 
+# Verify we have cover image directories, creating where needed
+for DIR in "small/r" "medium/r" "large/r"
+do
+    if [ ! -d "$COVERDIR/$DIR" ]; then
+        mkdir -p "$COVERDIR/$DIR"
+    fi
+    check_dir_writable "$COVERDIR/$DIR"
+done
+
 for FILE in "$JSDIR/fmall.js" "$JSDIR/fmcore.js" "$JSDIR/*/OrgTree.js" "$SLIMPACDIR/*/lib_list.inc" "$SLIMPACDIR/locales.inc" "LOCALSTATEDIR/web/eg_cache_hash"
 do
     check_files_writable "$FILE"