#!/bin/sh
# xulwrapper - a tiny wrapper for starting mongodb
#
# Copyright (c) 2010, Canonical Ltd.
# Author: Clint Byrum <clint@ubuntu.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; see the file COPYING.  If not, write to
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
#
# This wrapper is necessary as xulrunner does not follow normal library sematics
# Please see https://bugs.launchpad.net/ubuntu/+source/xulrunner-1.9.2/+bug/286906
# for more information.
#
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}/usr/lib/xulrunner-`xulrunner-1.9.2 --gre-version`
bname=`basename $0`
if [ "$bname" = "xulwrapper" ] ; then
    echo xulwrapper must not be used to wrap itself. Paradox avoided.
    exit 1
fi
exec "/usr/lib/mongodb/$bname" "$@"
