added test to avoid attempting to overwrite files directly in $AONDIR
authorJonathan Blake <jonathan.blake@projectaon.org>
Thu, 15 Feb 2018 04:34:59 +0000 (04:34 +0000)
committerJonathan Blake <jonathan.blake@projectaon.org>
Thu, 15 Feb 2018 04:34:59 +0000 (04:34 +0000)
git-svn-id: https://projectaon.org/data/trunk@2693 f6f3e2d7-ff33-0410-aaf5-b4bee2cdac11

common/scripts/copy-ebooks.sh
common/scripts/copy-svg.sh
common/scripts/copy-xhtml.sh

index 3c39738..aea05d5 100755 (executable)
@@ -15,6 +15,11 @@ if [ ! -d "$AONDIR" ]; then
 fi
 CURR_DIR=`pwd`
 
 fi
 CURR_DIR=`pwd`
 
+if [ "$AONDIR" -ef "$CURR_DIR" ]; then
+    >&2 echo "Current directory is the same as AONDIR: giving up"
+    exit
+fi
+
 BASE_DIR="$AONDIR/common/epub"
 book_db="$AONDIR/common/sqlite/bookcodes.db"
 
 BASE_DIR="$AONDIR/common/epub"
 book_db="$AONDIR/common/sqlite/bookcodes.db"
 
index f2b7e08..8498c4a 100755 (executable)
@@ -15,6 +15,11 @@ if [ ! -d "$AONDIR" ]; then
 fi
 CURR_DIR=`pwd`
 
 fi
 CURR_DIR=`pwd`
 
+if [ "$AONDIR" -ef "$CURR_DIR" ]; then
+    >&2 echo "Current directory is the same as AONDIR: giving up"
+    exit
+fi
+
 book_db="$AONDIR/common/sqlite/bookcodes.db"
 
 for book in $@
 book_db="$AONDIR/common/sqlite/bookcodes.db"
 
 for book in $@
index cce7ada..ab24393 100755 (executable)
@@ -15,6 +15,11 @@ if [ ! -d "$AONDIR" ]; then
 fi
 CURR_DIR=`pwd`
 
 fi
 CURR_DIR=`pwd`
 
+if [ "$AONDIR" -ef "$CURR_DIR" ]; then
+    >&2 echo "Current directory is the same as AONDIR: giving up"
+    exit
+fi
+
 book_db="$AONDIR/common/sqlite/bookcodes.db"
 
 for book in $@
 book_db="$AONDIR/common/sqlite/bookcodes.db"
 
 for book in $@