From 56bb13cd0129cf97dd266441623c17c0fdd87f11 Mon Sep 17 00:00:00 2001
From: Daniel Baumann <daniel@debian.org>
Date: Sun, 23 Sep 2007 13:59:18 +0200
Subject: Only removing old packages if they exist.

---
 examples/cron/snapshots.sh | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/examples/cron/snapshots.sh b/examples/cron/snapshots.sh
index 2075388..e9f9795 100755
--- a/examples/cron/snapshots.sh
+++ b/examples/cron/snapshots.sh
@@ -84,10 +84,13 @@ do
 		mkdir -p "${SERVER}"
 
 		# Removing old packages
-		for FILE in `awk {'print $5'} "${SERVER}"/"${PACKAGE}"*.changes | grep -e ".*\.deb$" -e ".*\.diff.gz$" -e ".*\.dsc$" -e ".*\.tar.gz$" -e ".*\.udeb$"`
-		do
-			rm -f "${SERVER}"/"${FILE}"
-		done
+		if [ -f "${SERVER}"/"${PACKAGE}"*.changes ]
+		then
+			for FILE in `awk {'print $5'} "${SERVER}"/"${PACKAGE}"*.changes | grep -e ".*\.deb$" -e ".*\.diff.gz$" -e ".*\.dsc$" -e ".*\.tar.gz$" -e ".*\.udeb$"`
+			do
+				rm -f "${SERVER}"/"${FILE}"
+			done
+		fi
 
 		rm -f "${SERVER}"/"${PACKAGE}"*.changes
 
-- 
cgit v1.0