From b64ca08c4a11cae7af256f22c7c54aa24fc9857d Mon Sep 17 00:00:00 2001 From: Jonathan Blake Date: Thu, 15 Feb 2018 04:34:59 +0000 Subject: [PATCH] added test to avoid attempting to overwrite files directly in $AONDIR git-svn-id: https://projectaon.org/data/trunk@2693 f6f3e2d7-ff33-0410-aaf5-b4bee2cdac11 --- common/scripts/copy-ebooks.sh | 5 +++++ common/scripts/copy-svg.sh | 5 +++++ common/scripts/copy-xhtml.sh | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/common/scripts/copy-ebooks.sh b/common/scripts/copy-ebooks.sh index 3c39738..aea05d5 100755 --- a/common/scripts/copy-ebooks.sh +++ b/common/scripts/copy-ebooks.sh @@ -15,6 +15,11 @@ if [ ! -d "$AONDIR" ]; then 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" diff --git a/common/scripts/copy-svg.sh b/common/scripts/copy-svg.sh index f2b7e08..8498c4a 100755 --- a/common/scripts/copy-svg.sh +++ b/common/scripts/copy-svg.sh @@ -15,6 +15,11 @@ if [ ! -d "$AONDIR" ]; then 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 $@ diff --git a/common/scripts/copy-xhtml.sh b/common/scripts/copy-xhtml.sh index cce7ada..ab24393 100755 --- a/common/scripts/copy-xhtml.sh +++ b/common/scripts/copy-xhtml.sh @@ -15,6 +15,11 @@ if [ ! -d "$AONDIR" ]; then 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 $@ -- 2.17.1