Browse Source

Only run the iPhoto backup if hdiutil is available

Zachary Kotlarek 12 years ago
parent
commit
33f0adeacf
1 changed files with 12 additions and 10 deletions
  1. 12 10
      backup/syncAll.sh

+ 12 - 10
backup/syncAll.sh

@@ -40,16 +40,18 @@ fi
 "${SYNC_BIN}" TV 5
 "${SYNC_BIN}" YouTube 50
 
-# If iPhoto is available, copy to Bitcasa
-MOUNTED=0
-if [ ! -d /Volumes/iPhoto ]; then
-	MOUNTED=1
-	hdiutil attach -readonly /mnt/media/Pictures/iPhoto.sparsebundle >/dev/null 2>&1
-fi
-if [ -d /Volumes/iPhoto ]; then
-	BASE_LOCAL="/Volumes/iPhoto" "${SYNC_BIN}" Shared.photolibrary 1000
-	if [ $MOUNTED -gt 0 ]; then
-		hdiutil detach /Volumes/iPhoto >/dev/null 2>&1
+# If iPhoto is available back it up too
+if compgen -c hdiutil > /dev/null 2>&1; then
+	MOUNTED=0
+	if [ ! -d /Volumes/iPhoto ]; then
+		MOUNTED=1
+		hdiutil attach -readonly /mnt/media/Pictures/iPhoto.sparsebundle >/dev/null 2>&1
+	fi
+	if [ -d /Volumes/iPhoto ]; then
+		BASE_LOCAL="/Volumes/iPhoto" "${SYNC_BIN}" Shared.photolibrary 1000
+		if [ $MOUNTED -gt 0 ]; then
+			hdiutil detach /Volumes/iPhoto >/dev/null 2>&1
+		fi
 	fi
 fi