aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/navit/files/shr/navit.launcher
blob: f3e1b0a0fc680cebfbb2ae44f5e73f65dd5bfa83 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#! /bin/sh
#
# Copyright Matthias Hentges <devel@hentges.net> (c) 2008
# License: GPL (see http://www.gnu.org/licenses/gpl.txt for a copy of the license)
#
# Filename: navit.launcher
# Date: 20080105 (YMD)
#
#################################################################################
#
# 20080105 - v0.0.1	- Initial release
# 20090818 -            - Zoff <zoff@zoff.cc> addons and fixes
# 20091025 -            - Zoff check if navit already running
# 20091122 -            - Zoff use fsoraw, use correct LANG setting
#
#
#################################################################################

# On devices with low memory (< 512Mb?) Navit will segfault on start.
# This can be worked around by doing
# "echo 1 > /proc/sys/vm/overcommit_memory"

# check if navit already running:
pgrep '^navit$'
not_running=$?

if [ $not_running = 0 ]; then
        echo "navit already running !!"
else
        echo "ok starting navit ..."

        # HINT: to get correct LANG setting
        . /etc/profile

        # HINT: we need that for streetname search
        export LC_ALL=''
        unset LC_ALL

        # HINT: that should be set in illume, but atm its not
        # export LANG=de_AT.utf8

	if test "`cat /proc/meminfo | grep ^MemTotal | awk '{print $2}'`" -lt "500000"
	then
	        if test "$USER" = "root"
	        then
	                echo "Enabling low-mem workaround..."
	                OLD=`cat /proc/sys/vm/overcommit_memory`
	                echo 1 > /proc/sys/vm/overcommit_memory
	                navit.real $*
	                echo ${OLD} > /proc/sys/vm/overcommit_memory
	                exit
	        else
	                echo "I need root-privs to enable the low-mem workaround!"
	        fi
	fi
        navit.real $*
fi