~jon-raiford/mythbuntu/lirc

« back to all changes in this revision

Viewing changes to debian/lirc.init.d

  • Committer: Mario Limonciello
  • Date: 2009-10-10 02:05:56 UTC
  • mfrom: (114.1.12 ubuntu)
  • Revision ID: superm1@ubuntu.com-20091010020556-wl6h56405u92myro
merge with jeremey's branch again.  any fixes will come up in following commits.  much easier that way

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
{
39
39
        REMOTE_ARGS="$*"
40
40
 
41
 
    #We need a default socket location
42
 
    if [ -z "$REMOTE_SOCKET" ]; then
43
 
        REMOTE_SOCKET="/dev/lircd"
44
 
    fi
45
 
 
46
41
        #For remote only detection support, we need
47
42
        #both REMOTE_DEVICE and TRANSMITTER_DEVICE undefined
48
43
        if [ -z "$REMOTE_DEVICE" ] && [ -z "$TRANSMITTER_DEVICE" ] && [ -c $dev ]; then
73
68
{
74
69
        TRANSMITTER_ARGS="$*"
75
70
 
76
 
    #We need a default socket location
77
 
    if [ -z "$TRANSMITTER_SOCKET" ]; then
78
 
        TRANSMITTER_SOCKET="/dev/lircd1"
79
 
    fi
80
 
 
81
71
        #Transmitters must be explicitly be defined
82
72
        if [ ! -z "$TRANSMITTER_DEVICE" ] || [ ! -z "$TRANSMITTER_DRIVER" ]; then
83
73
                if [ -n "$TRANSMITTER_DEVICE" ] && [ "$TRANSMITTER_DEVICE" != "none" ]; then
90
80
                #Now, if we ALSO have a remote defined, add some args
91
81
                #To make the second lircd connect
92
82
                if [ ! -z "$REMOTE_DEVICE" ] || [ ! -z "$REMOTE_DRIVER" ]; then
 
83
                        TRANSMITTER_SOCKET="${TRANSMITTER_SOCKET}1"
93
84
                        TRANSMITTER_ARGS="$TRANSMITTER_ARGS --connect=localhost:8765 --pidfile=/var/run/lirc/lircd1.pid"
94
85
                fi
95
86
                TRANSMITTER_ARGS="--output=$TRANSMITTER_SOCKET $TRANSMITTER_ARGS"
131
122
        START_IREXEC=false
132
123
fi
133
124
 
134
 
 
 
125
#We need default socket locations
 
126
OLD_SOCKET="/dev/lircd"
 
127
if [ -z "$REMOTE_SOCKET" ]; then
 
128
        REMOTE_SOCKET="/var/run/lirc/lircd"
 
129
fi
 
130
if [ -z "$TRANSMITTER_SOCKET" ]; then
 
131
        TRANSMITTER_SOCKET="/var/run/lirc/lircd"
 
132
fi
135
133
 
136
134
case "$1" in
137
135
        start)
147
145
 
148
146
                        #if we have a remote defined, it is primary process
149
147
                        if [ ! -z "$REMOTE_LIRCD_ARGS" ]; then
150
 
                                start-stop-daemon --start --quiet --exec /usr/sbin/lircd -- $REMOTE_LIRCD_ARGS < /dev/null
 
148
                                start-stop-daemon --start --quiet --oknodo --exec /usr/sbin/lircd -- $REMOTE_LIRCD_ARGS < /dev/null
151
149
                                log_end_msg $?
 
150
                                if [ -S "$REMOTE_SOCKET" -a "$OLD_SOCKET" != "$REMOTE_SOCKET" ]; then
 
151
                                        rm -f $OLD_SOCKET && ln -s $REMOTE_SOCKET $OLD_SOCKET
 
152
                                fi 
152
153
 
153
154
                                #now if we additionally have a transmitter defined, it is secondary process
154
155
                                if [ ! -z "$TRANSMITTER_LIRCD_ARGS" ]; then
155
156
                                        /usr/sbin/lircd $TRANSMITTER_LIRCD_ARGS < /dev/null
 
157
                                        if [ -S "$TRANSMITTER_SOCKET" ]; then
 
158
                                                rm -f ${OLD_SOCKET}1 && ln -s $TRANSMITTER_SOCKET ${OLD_SOCKET}1
 
159
                                        fi 
156
160
                                fi
157
161
                        elif [ ! -z "$TRANSMITTER_LIRCD_ARGS" ]; then
158
 
                                start-stop-daemon --start --quiet --exec /usr/sbin/lircd -- $TRANSMITTER_LIRCD_ARGS < /dev/null
 
162
                                start-stop-daemon --start --quiet --oknodo --exec /usr/sbin/lircd -- $TRANSMITTER_LIRCD_ARGS < /dev/null
 
163
                                log_end_msg $?
 
164
                                if [ -S "$TRANSMITTER_SOCKET" -a "$OLD_SOCKET" != "$TRANSMITTER_SOCKET" ]; then
 
165
                                        rm -f $OLD_SOCKET && ln -s $TRANSMITTER_SOCKET $OLD_SOCKET
 
166
                                fi 
159
167
                        else
160
168
                                log_end_msg 1
161
169
                        fi
162
170
                fi
163
171
 
164
172
                if [ "$START_LIRCMD" = "true" ]; then
 
173
                        [ -d "/var/run/lirc" ] || mkdir -p "/var/run/lirc"
165
174
                        log_daemon_msg "Starting remote control mouse daemon : LIRCMD "
166
 
                        start-stop-daemon --start --quiet --exec /usr/sbin/lircmd < /dev/null
 
175
                        start-stop-daemon --start --quiet --oknodo --exec /usr/sbin/lircmd < /dev/null
167
176
                        log_end_msg $?
168
177
                fi
169
178
 
170
179
                if [ "$START_IREXEC" = "true" ]; then
 
180
                        [ -d "/var/run/lirc" ] || mkdir -p "/var/run/lirc"
171
181
                        log_daemon_msg "Starting execution daemon: irexec"
172
 
                        start-stop-daemon --start --quiet --exec /usr/bin/irexec -- -d /etc/lirc/lircrc < /dev/null
 
182
                        start-stop-daemon --start --quiet --oknodo --exec /usr/bin/irexec -- -d /etc/lirc/lircrc < /dev/null
173
183
                        log_end_msg $?
174
184
                fi
175
185
                ;;
190
200
                        log_daemon_msg "Stopping remote control daemon(s): LIRC"
191
201
                        start-stop-daemon --stop --quiet --exec /usr/sbin/lircd
192
202
                        log_end_msg $?
 
203
                        [ -h "$OLD_SOCKET" ] && rm -f $OLD_SOCKET
 
204
                        [ -h "${OLD_SOCKET}1" ] && rm -f ${OLD_SOCKET}1
193
205
                fi
194
206
                ;;
195
207
        reload|force-reload)