Sophie

Sophie

distrib > Mandriva > 2008.0 > x86_64 > media > main-backports-src > by-pkgid > 3f9a48167a56a98356d5f3b1473dcdea > files > 2

f-spot-0.4.1-1mdv2008.0.src.rpm

--- f-spot-0.4.0/src/f-spot.in.sqlite3-update	2007-08-01 21:09:06.000000000 +0200
+++ f-spot-0.4.0/src/f-spot.in	2007-11-08 11:21:53.000000000 +0100
@@ -8,6 +8,10 @@ beagledir=@BEAGLE_DIR@
 
 EXE_TO_RUN="$libdir/f-spot/f-spot.exe"
 
+# gw automatic update of the photo database
+file ~/.gnome2/f-spot/photos.db|fgrep -q 2.x && f-spot-sqlite-upgrade
+
+
 if test "x$turtledir" != "x"; then
     export MONO_PATH=$turtledir/lib:$turtledir/gui:$MONO_PATH
 fi
--- f-spot-0.4.0/tools/f-spot-sqlite-upgrade.sqlite3-update	2007-11-08 11:24:36.000000000 +0100
+++ f-spot-0.4.0/tools/f-spot-sqlite-upgrade	2007-11-08 13:40:41.000000000 +0100
@@ -8,6 +8,11 @@ if grep "^...This file contains an SQLit
 	echo "Upgrading from SQLite 2.1 to SQLite3"
 	mv $DB_LOCATION $BACKUP_LOCATION
 	sqlite $BACKUP_LOCATION .dump | sqlite3 $DB_LOCATION
+	RETVAL=$?
+	if [ $RETVAL -ne 0 ]; then
+		echo "Upgrade failed, restoring backup database"
+		mv -f $BACKUP_LOCATION $DB_LOCATION
+	fi
 else
 	echo "Database is already upgraded"
 fi