/usr/bin/f-spot-sqlite-upgrade is in f-spot 0.8.2-4.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | #!/bin/sh
set -e
# This only upgrades the default database location
# if you have specified a different location
if [ ! -n "$XDG_CONFIG_HOME" ]; then
XDG_CONFIG_HOME="$HOME/.config"
fi
DB_LOCATION="$XDG_CONFIG_HOME/f-spot/photos.db"
BACKUP_LOCATION=$DB_LOCATION.backup
DUMP_LOCATION=$DB_LOCATION.dump
NEW_DB_LOCATION=$DB_LOCATION.new
if ! which sqlite >/dev/null 2>&1 ; then
echo "Could not find sqlite binary. Update aborted." >&2
exit 1
elif ! which sqlite3 >/dev/null 2>&1 ; then
echo "Could not find sqlite3 binary. Update aborted." >&2
exit 1
fi
if [ ! -f $DB_LOCATION ]; then
echo "Could not find $DB_LOCATION, nothing to update. Update aborted." >&2
exit 1
fi
# make sure nothing gets in the way
rm -f $BACKUP_LOCATION
rm -f $DUMP_LOCATION
rm -f $NEW_DB_LOCATION
if grep "^...This file contains an SQLite 2.1 database" $DB_LOCATION >/dev/null 2>&1; then
echo "Upgrading from SQLite 2.1 to SQLite3"
cp $DB_LOCATION $BACKUP_LOCATION
if sqlite $DB_LOCATION .dump > $DUMP_LOCATION &&
sqlite3 $NEW_DB_LOCATION < $DUMP_LOCATION; then
cp $NEW_DB_LOCATION $DB_LOCATION
echo "Upgrade was successful."
else
echo "Upgrade failed, putting old database back." >&2
cp $BACKUP_LOCATION $DB_LOCATION
exit 1
fi
else
echo "Database is already upgraded"
fi
|