--- /dev/null
+#!/bin/sh
+set -e
+DEST=$1
+echo "Installing to $DEST"
+if [ ! -d $DEST/bin ] ; then
+ echo "Creating $DEST and the whole directory hierarchy under it."
+ mkdir -p $DEST/{bin,cf,db,index,log,tmp}
+fi
+echo "Installing binaries..."
+rm -f $DEST/bin/*
+cp run/bin/* $DEST/bin/
+echo "Installing config files..."
+for a in cf/* ; do
+ if [ -f $a ] ; then
+ if [ ! -f $DEST/$a ] ; then
+ echo "$a: new, installed"
+ cp $a $DEST/$a
+ elif diff -u $DEST/$a $a ; then
+ echo "$a: no differences"
+ else
+ echo -n "$a differs, replace it [Yn]? "
+ read x
+ if [ -z "$x" -o "$x" == "y" -o "$x" == "Y" ] ; then
+ echo "$a: replacing and keeping the old version as $a.old"
+ mv $DEST/$a $DEST/$a.old
+ cp $a $DEST/$a
+ else
+ echo "$a: installing the new version as $a.dist"
+ cp $a $DEST/$a.dist
+ fi
+ fi
+ fi
+done
+echo "Done."