Install hooks in prefix/share/zavai
[gregoa/zavai.git] / hooks / gsm
1 #!/bin/sh
2
3 make_default_conf() {
4         cat > ~/.frameworkd.conf << EOT
5 [frameworkd]
6 log_to=file
7 log_destination=/tmp/frameworkd.log
8
9 [ogsmd]
10 log_level=INFO
11 modemtype = ti_calypso
12 ti_calypso_deep_sleep = adaptive
13 ti_calypso_dsp_mode = aec+nr
14 ti_calypso_muxer = fso-abyss
15 EOT
16 }
17
18 case "$1" in
19         # At the start of zavai
20         status)
21         ;;
22         pre)
23                 exec om gsm power 1
24         ;;
25         post)
26                 exec om gsm power 0
27         ;;
28         # Run, blocking until the process ends
29         run)
30                 if [ -x /usr/bin/frameworkd ]
31                 then
32                         # Make default config if missing
33                         test -e ~/.frameworkd.conf || make_default_conf
34
35                         # Start frameworkd for GSM services only
36                         exec /usr/bin/frameworkd -s ogsmd > /tmp/zavai-frameworkd.log 2>&1
37                 else
38                         # For testing
39                         exec sleep 10
40                 fi
41         ;;
42         *)
43                 echo "Usage: $0 {run|status}." >&2
44                 exit 1
45         ;;
46 esac
47
48 exit 0