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}"
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 ;;
55 --heap-shot ) heap_shot=1 ;;
57 --mono-debug ) mono_debug=1 ;;
61 # If the user didn't specify to run in fg/bg, then use the default
62 if [ -z "$fg_user" ]; then
68 # Handle logging, and optionally append the relevent default fg/bg argument if
69 # it was not user-specified.
70 if [ $fg -eq 1 ]; then
71 [ -z "$fg_user" ] && FGBG_ARG="--fg";
72 export BEAGLE_LOG_IN_THE_FOREGROUND_PLEASE=1
74 [ -z "$fg_user" ] && FGBG_ARG="--bg";
75 unset BEAGLE_LOG_IN_THE_FOREGROUND_PLEASE
78 if [ $heap_buddy -eq 1 ]; then
79 export _GET_ON_THE_HEAP_BUDDY_BANDWAGON=1
80 if [ -z "$BEAGLE_HEAP_BUDDY_DIR" ]; then
81 export BEAGLE_HEAP_BUDDY_DIR=.
83 MONO_EXTRA_ARGS="--profile=heap-buddy:$BEAGLE_HEAP_BUDDY_DIR/outfile.beagled $MONO_EXTRA_ARGS"
84 rm -f $BEAGLE_HEAP_BUDDY_DIR/outfile.beagled $BEAGLE_HEAP_BUDDY_DIR/outfile.helper.*
85 elif [ $heap_shot -eq 1 ]; then
86 export _HEY_LETS_DO_A_HEAP_SHOT=1
87 if [ -z "$BEAGLE_HEAP_SHOT_DIR" ]; then
88 export BEAGLE_HEAP_SHOT_DIR=.
90 MONO_EXTRA_ARGS="--profile=heap-shot:$BEAGLE_HEAP_SHOT_DIR/outfile.beagled $MONO_EXTRA_ARGS"
91 rm -f $BEAGLE_HEAP_BUDDY_DIR/outfile.beagled_* $BEAGLE_HEAP_BUDDY_DIR/outfile.helper_*
96 if [ $mono_debug -eq 1 ]; then
97 export BEAGLE_MONO_DEBUG_FLAG_IS_SET=1
98 MONO_EXTRA_ARGS="--debug $MONO_EXTRA_ARGS"
101 # The BEAGLE_MONO_RUNTIME variable can be used to specify the path
102 # to an alternative runtime.
103 if [ -z "$BEAGLE_MONO_RUNTIME" ]; then
104 export BEAGLE_MONO_RUNTIME="mono"
106 echo "*** Using mono runtime at $BEAGLE_MONO_RUNTIME ***"
109 if [ $monogrind -eq 1 ]; then
111 CMDLINE="monogrind $TARGET_EXE $MONO_EXTRA_ARGS $BEAGLED_ARGS $FGBG_ARG"
112 elif [ $mdb -eq 1 ]; then
113 CMDLINE="mdb $TARGET_EXE -args $BEAGLED_ARGS $FGBG_ARG"
115 CMDLINE="$BEAGLE_MONO_RUNTIME $MONO_EXTRA_ARGS $TARGET_EXE $BEAGLED_ARGS $FGBG_ARG"
118 PROCESS_NAME="beagled"
120 if [ $fg -eq 1 ]; then
121 exec -a $PROCESS_NAME $CMDLINE
124 exec -a $PROCESS_NAME $CMDLINE &
127 # If beagled (in --bg mode) has exited with some errors, we need
128 # to inform the users about the same. This 500 milli-seconds sleep
129 # is to wait for the daemon to start and exit, in case of errors ;)
130 # Fixes http://bugzilla.gnome.org/show_bug.cgi?id=171975
134 if ! ps -p $! > /dev/null; then
135 echo "Beagle Daemon exited with errors. See ~/.beagle/Log/current-Beagle for more details."