Little fix.
[irreco.git] / lirc-0.8.4a / contrib / lircs
blob1db2f2ab83b3cbc57df757047903a23ba5be4cce
1 #!/bin/bash
3 # ---------------------------------------------------------------------
5 # LIRC starter (called 'lircs' for simplicity)
7 # A simple shell script to make the configuration of LIRC more comfortable.
9 # It may be necessary to change the script if ...
10 # - you have a non-standard installation or
11 # - you use more or other client applications (see below) or
12 # - the init scripts are located elsewhere on your Linux system (see below).
14 # ---------------------------------------------------------------------
16 # author: Michael Kammerer <M.Kammerer@gmx.de>
18 # PLEASE send me your comments, ideas, bug reports, ... via E-Mail.
20 # ---------------------------------------------------------------------
22 # location of the LIRC config file
23 # change this if your LIRC config file is located elsewhere
24 CONFIG_FILE=${HOME}/.lircrc
26 # any editor to edit LIRC config file
27 FILE_EDITOR=vim
31 # function declarations
33 start_clients () {
34 if [ -s ${CONFIG_FILE} ]; then
35 echo -n Starting LIRC clients ...
37 # add more clients HERE or change the ones I put here as a start
38 irxevent &
39 irexec --daemon
41 echo " done"
42 else
43 echo "LIRC config file not found in ${CONFIG_FILE}"
44 exit 1
48 restart_lircd () {
49 if [ "${USER}" = "root" ]; then
50 # change this if your Linux system keeps the init scripts elsewhere
51 /sbin/init.d/lircd restart
52 else
53 echo "`basename ${0}`: you must be 'root' to restart the LIRC daemon (lircd)."
54 exit 1
58 stop_lircd () {
59 if [ "${USER}" = "root" ]; then
60 # change this if your Linux system keeps the init scripts elsewhere
61 /sbin/init.d/lircd stop
62 else
63 echo "`basename ${0}`: you must be 'root' to stop the LIRC daemon (lircd)."
64 exit 1
68 edit_config_file () {
69 ${FILE_EDITOR} ${CONFIG_FILE}
72 print_info () {
73 echo "LIRC starter version 0.2, 09/2000 "
74 echo "Written by Michael Kammerer <M.Kammerer@gmx.de>."
75 echo "Visit 'www.crosswinds.net/~michaelkammerer/lircs' for updates."
78 print_help () {
79 echo "LIRC starter usage: lirc [option]"
80 echo "'option' can be:"
81 echo "as any user:"
82 echo "-h | --help print this short help text"
83 echo "-c | --clients start LIRC clients (necessary if lircd was restarted)"
84 echo "-e | --edit edit LIRC config file '${CONFIG_FILE}'"
85 echo "-v | --version print script version and other info"
86 echo "only as 'root':"
87 echo "-r | --restart restart LIRC daemon (lircd) "
88 echo "-s | --stop stop LIRC daemon"
92 # processing of command line arguments
94 case $1 in
95 -r)
96 restart_lircd
98 --restart)
99 restart_lircd
102 stop_lircd
104 --stop)
105 restart_lircd
108 start_clients
110 --clients)
111 start_clients
114 print_help
116 --help)
117 print_help
120 edit_config_file
122 --edit)
123 edit_config_file
126 print_info
128 --version)
129 print_info
132 print_help
134 esac