From e8bdd627910f3f30a1c775cf815126b142af828a Mon Sep 17 00:00:00 2001
From: John Vogel <jvogel4(a)stny.rr.com>
Date: Thu, 18 Jan 2018 06:26:50 -0500
Subject: [PATCH v2] Don't delete ports just because sync fails
Check the list file instead. If the port doesn't exist or
if it is commented out, then delete it.
---
mpup | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/mpup b/mpup
index 7730f20..7ee1093 100755
--- a/mpup
+++ b/mpup
@@ -160,7 +160,7 @@ while [ "$(cat $TMP_DIR/.pids 2>/dev/null | wc -l)" != "0" ]; do
done
done
-# remove ports that were deleted from mpup.lst
+# remove ports that were deleted from LIST_FILE
for PORT in $ROOT_DIR/*; do
PORT=${PORT##*/}
[ "$PORT" == "*" ] && continue
@@ -172,8 +172,8 @@ for PORT in $ROOT_DIR/*; do
[ -z "$f" ] && continue
# use the basename for file
f="$(basename $f)"
- # delete files of a port which was not sync'ed (.checkouts.$PORT missing)
- if [ ! -f "$TMP_DIR/.checkouts.$PORT" ]; then
+ # delete files for ports without valid entries in LIST_FILE
+ if ! grep -qE "^[[:space:]]*(httpup|rsync).*[[:space:]]+$PORT[[:space:]]*$" $LIST_FILE; then
rm -f $ROOT_DIR/$PORT/$f >/dev/null 2>&1
echo " Delete: $PORT/$f"
fi
--
2.15.1