3 # This line will be automatically uncommented when you "make install"
6 if [ -z $installed ] ; then
7 echo "*** Running uninstalled @target@ ***"
9 # When we run uninstalled, run in the foreground by default.
12 TARGET_EXE="./@target@"
14 export _BEAGLED_INDEX_HELPER_PATH="."
16 # The stuff in webserver, Tiles and images is only needed when
17 # web services are enabled.
18 export MONO_PATH="../Util:../BeagleClient:./webserver:../Tiles:../images${MONO_PATH+:$MONO_PATH}"
20 export LD_LIBRARY_PATH="../glue/.libs${LD_LIBRARY_PATH+:$LD_LIBRARY_PATH}"
22 export BEAGLE_FILTER_PATH="../Filters${BEAGLE_FILTER_PATH+:$BEAGLE_FILTER_PATH}"
23 export BEAGLE_BACKEND_PATH=".${BEAGLE_BACKEND_PATH+:$BEAGLE_BACKEND_PATH}"
27 # Otherwise default to running in the background
30 TARGET_EXE="@pkglibdir@/@target@"
32 export _BEAGLED_INDEX_HELPER_PATH="@pkglibdir@"
33 export MONO_PATH="@pkglibdir@${MONO_PATH+:$MONO_PATH}"
34 export LD_LIBRARY_PATH="@pkglibdir@${LD_LIBRARY_PATH+:$LD_LIBRARY_PATH}"
37 EVO_LIBDIR="@evolibdir@"
38 if [ -n "$EVO_LIBDIR" ]; then
39 export LD_LIBRARY_PATH="$EVO_LIBDIR${LD_LIBRARY_PATH+:$LD_LIBRARY_PATH}"
47 for i in $BEAGLED_ARGS; do
49 --help | --list-backends | --fg | --foreground ) fg_user=1 ;;
50 --bg | --background ) fg_user=0 ;;
51 --monogrind ) monogrind=1 ;;
52 --heap-buddy ) heap_buddy=1 ;;
58 # If the user didn't specify to run in fg/bg, then use the default
59 if [ -z "$fg_user" ]; then
65 # Handle logging, and optionally append the relevent default fg/bg argument if
66 # it was not user-specified.
67 if [ $fg -eq 1 ]; then
68 [ -z "$fg_user" ] && FGBG_ARG="--fg";
69 export BEAGLE_LOG_IN_THE_FOREGROUND_PLEASE=1
71 [ -z "$fg_user" ] && FGBG_ARG="--bg";
72 unset BEAGLE_LOG_IN_THE_FOREGROUND_PLEASE
75 if [ $heap_buddy -eq 1 ]; then
76 export _GET_ON_THE_HEAP_BUDDY_BANDWAGON=1
77 if [ -z "$BEAGLE_HEAP_BUDDY_DIR" ]; then
78 export BEAGLE_HEAP_BUDDY_DIR=.
80 MONO_EXTRA_ARGS="--profile=heap-buddy:$BEAGLE_HEAP_BUDDY_DIR/outfile.beagled $MONO_EXTRA_ARGS"
81 rm -f $BEAGLE_HEAP_BUDDY_DIR/outfile.beagled $BEAGLE_HEAP_BUDDY_DIR/outfile.helper.*
84 if [ $debug -eq 1 ]; then
85 export BEAGLE_DEBUG_FLAG_IS_SET=1
86 MONO_EXTRA_ARGS="--debug $MONO_EXTRA_ARGS"
89 # The BEAGLE_MONO_RUNTIME variable can be used to specify the path
90 # to an alternative runtime.
91 if [ -z "$BEAGLE_MONO_RUNTIME" ]; then
92 export BEAGLE_MONO_RUNTIME="mono"
94 echo "*** Using mono runtime at $BEAGLE_MONO_RUNTIME ***"
97 if [ $monogrind -eq 1 ]; then
99 CMDLINE="monogrind $TARGET_EXE $MONO_EXTRA_ARGS $BEAGLED_ARGS $FGBG_ARG"
100 elif [ $mdb -eq 1 ]; then
101 CMDLINE="mdb $TARGET_EXE -args $BEAGLED_ARGS $FGBG_ARG"
103 CMDLINE="$BEAGLE_MONO_RUNTIME --debug $MONO_EXTRA_ARGS $TARGET_EXE $BEAGLED_ARGS $FGBG_ARG"
106 PROCESS_NAME="beagled"
108 if [ $fg -eq 1 ]; then
109 exec -a $PROCESS_NAME $CMDLINE
112 exec -a $PROCESS_NAME $CMDLINE &
115 # If beagled (in --bg mode) has exited with some errors, we need
116 # to inform the users about the same. This 500 milli-seconds sleep
117 # is to wait for the daemon to start and exit, in case of errors ;)
118 # Fixes http://bugzilla.gnome.org/show_bug.cgi?id=171975
122 if ! ps -p $! > /dev/null; then
123 echo "Beagle Daemon exited with errors. See ~/.beagle/Log/current-Beagle for more details."