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 export MONO_GAC_PREFIX="@gacprefix@${MONO_GAC_PREFIX+:$MONO_GAC_PREFIX}"
39 EVO_LIBDIR="@evolibdir@"
40 if [ -n "$EVO_LIBDIR" ]; then
41 export LD_LIBRARY_PATH="$EVO_LIBDIR${LD_LIBRARY_PATH+:$LD_LIBRARY_PATH}"
49 for i in $BEAGLED_ARGS; do
51 --help | --list-backends | --fg | --foreground ) fg_user=1 ;;
52 --bg | --background ) fg_user=0 ;;
53 --monogrind ) monogrind=1 ;;
54 --heap-buddy ) heap_buddy=1 ;;
59 # If the user didn't specify to run in fg/bg, then use the default
60 if [ -z "$fg_user" ]; then
66 # Handle logging, and optionally append the relevent default fg/bg argument if
67 # it was not user-specified.
68 if [ $fg -eq 1 ]; then
69 [ -z "$fg_user" ] && FGBG_ARG="--fg";
70 export BEAGLE_LOG_IN_THE_FOREGROUND_PLEASE=1
72 [ -z "$fg_user" ] && FGBG_ARG="--bg";
73 unset BEAGLE_LOG_IN_THE_FOREGROUND_PLEASE
76 if [ $heap_buddy -eq 1 ]; then
77 export _GET_ON_THE_HEAP_BUDDY_BANDWAGON=1
78 if [ -z "$BEAGLE_HEAP_BUDDY_DIR" ]; then
79 export BEAGLE_HEAP_BUDDY_DIR=.
81 MONO_EXTRA_ARGS="--profile=heap-buddy:$BEAGLE_HEAP_BUDDY_DIR/outfile.beagled $MONO_EXTRA_ARGS"
82 rm -f $BEAGLE_HEAP_BUDDY_DIR/outfile.beagled $BEAGLE_HEAP_BUDDY_DIR/outfile.helper.*
85 if [ $debug -eq 1 ]; then
86 export BEAGLE_DEBUG_FLAG_IS_SET=1
87 MONO_EXTRA_ARGS="--debug $MONO_EXTRA_ARGS"
90 # The BEAGLE_MONO_RUNTIME variable can be used to specify the path
91 # to an alternative runtime.
92 if [ -z "$BEAGLE_MONO_RUNTIME" ]; then
93 export BEAGLE_MONO_RUNTIME="mono"
95 echo "*** Using mono runtime at $BEAGLE_MONO_RUNTIME ***"
98 if [ $monogrind -eq 1 ]; then
100 CMDLINE="monogrind $TARGET_EXE $MONO_EXTRA_ARGS $BEAGLED_ARGS $FGBG_ARG"
102 CMDLINE="$BEAGLE_MONO_RUNTIME --debug $MONO_EXTRA_ARGS $TARGET_EXE $BEAGLED_ARGS $FGBG_ARG"
105 PROCESS_NAME="beagled"
107 if [ $fg -eq 1 ]; then
108 exec -a $PROCESS_NAME $CMDLINE
111 exec -a $PROCESS_NAME $CMDLINE &
114 # If beagled (in --bg mode) has exited with some errors, we need
115 # to inform the users about the same. This 500 milli-seconds sleep
116 # is to wait for the daemon to start and exit, in case of errors ;)
117 # Fixes http://bugzilla.gnome.org/show_bug.cgi?id=171975
121 if ! ps -p $! > /dev/null; then
122 echo "Beagle Daemon exited with errors. See ~/.beagle/Log/current-Beagle for more details."