summaryrefslogtreecommitdiff
path: root/ohmd/run-ohm.sh
blob: f36b33ba6e0a63b4396484389237bdb423faed8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/sh

OHM_TMPDIR=/tmp/run-ohmd-$USER

if [ "$1" = "--help" ]; then
	echo "Usage:"
	echo "  $0 [run-options] [ohm-options]"
	echo
	echo "Run Options:"
	echo "  --skip-plugin-install: Don't do a temporary install of the plugins."
	echo "                         Only use this if $0 has already been run"
	echo "                         without this option"
	echo "  --debug:               Run with gdb"
	echo "  --memcheck:            Run with valgrind memcheck tool"
	echo "  --massif:              Run with valgrind massif heap-profiling tool"
	echo
	./ohmd --help
	exit 0
fi

if [ "$1" = "--skip-plugin-install" ] ; then
	shift
else
	make -C ../etc install DESTDIR=$OHM_TMPDIR prefix=/
	make -C ../plugins install DESTDIR=$OHM_TMPDIR prefix=/
fi

if [ "$1" = "--debug" ] ; then
	shift
	prefix="gdb --args"
elif [ "$1" = "--memcheck" ] ; then
	shift
	prefix="valgrind --show-reachable=yes --leak-check=full --tool=memcheck"
elif [ "$1" = "--massif" ] ; then
	shift
	prefix="valgrind --tool=massif"
fi

export OHM_CONF_DIR=$OHM_TMPDIR/etc/ohm
export OHM_PLUGIN_DIR=$OHM_TMPDIR/lib/ohm

echo "Execing: $prefix ./ohmd --no-daemon --verbose --g-fatal-critical $@"
sudo $prefix ./ohmd --no-daemon --verbose --g-fatal-critical $@