Tizen 2.1 base
[framework/system/dlog.git] / dlogctrl
1 #!/bin/sh
2 MODE=none
3 OBJ=none
4 VAL=none
5 #echo "tizen_platform_dlog_logging_ctrl"
6 case "$1" in
7 get)
8         MODE=get
9 ;;
10 set)
11         MODE=set
12 ;;
13
14 *)
15 echo "Usage: dlogctrl {get|set} {platformlog} {1|0}"
16 exit 1
17 esac
18
19 case "$2" in
20 platformlog)
21         OBJ=platformlog
22 ;;
23 *)
24         echo "Usage: dlogctrl {get|set} {platformlog} {1|0}"
25 exit 1
26 esac
27
28 if [ "$MODE" = "set" ]; then
29         case "$3" in
30         1)
31                 VAL=1
32         ;;
33         0)
34                 VAL=0
35         ;;
36         *)
37                 echo "Usage: dlogctrl {get|set} {platformlog} {1|0}"
38         exit 1
39         esac
40 fi
41
42 if [ "$MODE" = "set" ]; then
43         if [ "$OBJ" = "platformlog" ] && [ "$VAL" = "1" ] ; then
44                 touch /opt/etc/dlog/.platformloggingmode 2>/dev/null
45         elif [ "$OBJ" = "platformlog" ] && [ "$VAL" = "0" ] ; then
46                 rm -f /opt/etc/dlog/.platformloggingmode 2>/dev/null
47         fi
48 else
49         if [ "$OBJ" = "platformlog" ]; then
50                 if [ -e "/opt/etc/dlog/.platformloggingmode" ]; then
51                         echo 1
52                 else
53                         echo 0
54                 fi
55         fi
56     echo "You must reboot this target to apply the change!"
57 fi
58
59 exit 0