#!/bin/bash
#
# SemanticScuttle simple upgrader.
#

BASENAME="`basename $0`"
PREVIOUS="$1"
CURRENT="$2"

if [ -z "$CURRENT" ]; then
  echo "usage: $BASENAME <previous> <current>"
  exit 1
fi

wget http://downloads.sourceforge.net/project/semanticscuttle/SemanticScuttle/v0.98/SemanticScuttle-$CURRENT.zip && \
unzip SemanticScuttle-$CURRENT.zip && \
rm SemanticScuttle-$CURRENT.zip && \
cp -a SemanticScuttle-$PREVIOUS/data/config.php SemanticScuttle-$CURRENT/data/ && \
rm site && \
ln -s SemanticScuttle-$CURRENT/www site && \
echo "Audit:" && \
du -hs SemanticScuttle-$PREVIOUS && \
du -hs SemanticScuttle-$CURRENT

if [ -d "patches" ]; then
  echo "Check and apply the following patches manually:"
  find patches
fi