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