Advertisement
Guest User

alexander

a guest
Jan 31st, 2012
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.51 KB | None | 0 0
  1. #################################################################################
  2. # #
  3. # The following configuration file is generated automatically by the yaVDR #
  4. # system. Don't change this file as every update of yaVDR will overwrite #
  5. # the local changes. Instead put your required customizations #
  6. # into /etc/yavdr/templates_custom/ based on the original templates #
  7. # under /usr/share/yavdr/templates. #
  8. # #
  9. # http://www.yavdr.org/developer-zone/template-overview/ #
  10. # #
  11. # #
  12. #################################################################################
  13.  
  14. # Starts LIRC daemon.
  15. #
  16. # LIRC is used to control different
  17. # infrared receivers and transceivers.
  18.  
  19. description "LIRC Daemon"
  20. author "Gerald Dachs <gda@dachsweb.de>"
  21.  
  22. start on starting vdr
  23. stop on runlevel [016]
  24.  
  25. respawn
  26. normal exit 0
  27.  
  28. script
  29. load_modules ()
  30. {
  31. MODULES_MISSING=false
  32.  
  33. for mod in $*; do
  34. modprobe $mod 2> /dev/null || MODULES_MISSING=true
  35. done
  36.  
  37. if $MODULES_MISSING; then
  38. exit 0
  39. fi
  40. }
  41.  
  42. test -f /usr/sbin/lircd || exit 0
  43.  
  44. if [ -f /etc/lirc/hardware.conf ];then
  45. . /etc/lirc/hardware.conf
  46. fi
  47.  
  48. if [ ! -f /etc/lirc/lircd.conf ] || \
  49. grep -q "^#UNCONFIGURED" /etc/lirc/lircd.conf ||\
  50. [ "x$START_LIRCD" = "xfalse" ]; then
  51. exit 0
  52. fi
  53.  
  54. #We need default socket locations
  55. OLD_SOCKET="/dev/lircd"
  56. if [ -z "$REMOTE_SOCKET" ]; then
  57. REMOTE_SOCKET="/var/run/lirc/lircd"
  58. fi
  59.  
  60. [ -d "/var/run/lirc" ] || mkdir -p "/var/run/lirc"
  61.  
  62. if [ "$LOAD_MODULES" = "true" ]; then
  63. load_modules $REMOTE_MODULES
  64. fi
  65.  
  66. build_remote_args ()
  67. {
  68. REMOTE_ARGS="$*"
  69.  
  70. #For remote only detection support, we need
  71. #both REMOTE_DEVICE and TRANSMITTER_DEVICE undefined
  72. if [ -z "$REMOTE_DEVICE" ] && [ -z "$TRANSMITTER_DEVICE" ] && [ -c $dev ]; then
  73. REMOTE_DEVICE="$dev"
  74. fi
  75.  
  76. #If we have a REMOTE_DEVICE or REMOTE_DRIVER defined (either because no devices
  77. #were defined, OR if we explicitly did), then populate REMOTE_ARGS
  78. if [ ! -z "$REMOTE_DEVICE" ] || [ ! -z "$REMOTE_DRIVER" ]; then
  79. if [ -n "$REMOTE_DEVICE" ] && [ "$REMOTE_DEVICE" != "none" ]; then
  80. REMOTE_ARGS="--device=$REMOTE_DEVICE $REMOTE_ARGS"
  81. fi
  82. if [ -n "$REMOTE_DRIVER" ] && [ "$REMOTE_DRIVER" != "none" ]; then
  83. REMOTE_ARGS="--driver=$REMOTE_DRIVER $REMOTE_ARGS"
  84. fi
  85.  
  86. #Now, if we ALSO have a transmitter defined, add some args
  87. #To make the first lircd listen up
  88. if [ ! -z "$TRANSMITTER_DEVICE" ] || [ ! -z "$TRANSMITTER_DRIVER" ]; then
  89. REMOTE_ARGS="$REMOTE_ARGS --listen"
  90. fi
  91. REMOTE_ARGS="--output=$REMOTE_SOCKET $REMOTE_ARGS"
  92. fi
  93. echo $REMOTE_ARGS
  94. }
  95.  
  96. REMOTE_LIRCD_ARGS=`build_remote_args $REMOTE_LIRCD_ARGS`
  97. if [ -z "$REMOTE_LIRCD_ARGS" ]; then
  98. exit 0
  99. fi
  100.  
  101. if [ "$OLD_SOCKET" != "$REMOTE_SOCKET" ]; then
  102. rm -f $OLD_SOCKET && ln -s $REMOTE_SOCKET $OLD_SOCKET
  103. fi
  104.  
  105.  
  106. exec /usr/sbin/lircd --nodaemon $REMOTE_LIRCD_ARGS
  107. end script
  108.  
  109. post-start script
  110. if [ -f /etc/lirc/hardware.conf ];then
  111. . /etc/lirc/hardware.conf
  112. fi
  113.  
  114. if [ ! -f /etc/lirc/lircd.conf ] || \
  115. grep -q "^#UNCONFIGURED" /etc/lirc/lircd.conf ||\
  116. [ "x$START_LIRCD" = "xfalse" ]; then
  117. exit 0
  118. else
  119. while [ ! -e /dev/lircd ]; do
  120. sleep 0.1
  121. done
  122. fi
  123. end script
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement