1
#! /bin/sh
2
# Keyboard startup/shutdown script
3
CONFIGURED=/etc/hildon-input-method.configured
4
5
if [ "x$AF_PIDDIR" = "x" ]; then
6
  echo "$0: Error, AF_PIDDIR is not defined"
7
  exit 2
8
fi
9
if [ ! -w $AF_PIDDIR ]; then
10
  echo "$0: Error, directory $AF_PIDDIR is not writable"
11
  exit 2
12
fi
13
14
# Small hack to have it working NOW
15
if [ "x$LAUNCHWRAPPER" = "x" ]; then
16
  LAUNCHWRAPPER=/etc/osso-af-init/launch-wrapper.sh
17
fi
18
if [ "x$LAUNCHWRAPPER_NICE_TRYRESTART" = "x" ]; then
19
  echo "$0: LAUNCHWRAPPER_NICE_TRYRESTART is not defined - starting with LAUNCHWRAPPER"
20
  LAUNCHWRAPPER_NICE_TRYRESTART=$LAUNCHWRAPPER
21
fi
22
23
if [ ! -f $CONFIGURED ]; then 
24
  if [ -x /usr/bin/hildon-input-method-configurator ]; then
25
    if test "x$_SBOX_DIR" = "x";then
26
      /usr/bin/hildon-input-method-configurator && sudo /bin/touch $CONFIGURED
27
    else
28
      /usr/bin/hildon-input-method-configurator && fakeroot /bin/touch $CONFIGURED
29
    fi
30
  fi
31
fi
32
33
PROG=/usr/bin/hildon-input-method
34
SVC="Keyboard"
35
36
case "$1" in
37
start)  START=TRUE
38
        ;;
39
stop)   START=FALSE
40
        ;;
41
*)      echo "Usage: $0 {start|stop}"
42
        exit 1
43
        ;;
44
esac
45
46
if [ $START = TRUE ]; then
47
  # check that required environment is defined
48
  if [ "x$DISPLAY" = "x" ]; then
49
    echo "$0: Error, DISPLAY is not defined"
50
    exit 2
51
  fi
52
  source $LAUNCHWRAPPER_NICE_TRYRESTART start "$SVC" "$PROG"
53
else
54
  source $LAUNCHWRAPPER_NICE_TRYRESTART stop "$SVC" "$PROG"
55
fi