summaryrefslogtreecommitdiff
path: root/community/esekeyd/esekeyd.rc
diff options
context:
space:
mode:
Diffstat (limited to 'community/esekeyd/esekeyd.rc')
-rw-r--r--community/esekeyd/esekeyd.rc51
1 files changed, 51 insertions, 0 deletions
diff --git a/community/esekeyd/esekeyd.rc b/community/esekeyd/esekeyd.rc
new file mode 100644
index 000000000..67dd42265
--- /dev/null
+++ b/community/esekeyd/esekeyd.rc
@@ -0,0 +1,51 @@
+#!/bin/sh
+#
+# Start/stop/restart the key daemon.
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+keystune(){
+ for keycode in "${KEYCODES[@]}"; do
+ key=`echo $keycode | cut -d: -f1`
+ code=`echo $keycode | cut -d: -f2`
+ setkeycodes $key $code
+ done
+}
+
+# source application-specific settings
+CONFIG=
+KEYCODES=
+DEVICE=
+[ -f /etc/conf.d/esekeyd ] && . /etc/conf.d/esekeyd
+
+PID=`pidof -o %PPID /usr/sbin/esekeyd`
+case "$1" in
+ start)
+ stat_busy "Starting esekeyd"
+ [ "$KEYCODES" ] && keystune
+ [ -z "$PID" ] && /usr/sbin/esekeyd $CONFIG $DEVICE &>/dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon esekeyd
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping esekeyd"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon esekeyd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0