#! /bin/sh ### BEGIN INIT INFO # Provides: speech-dispatcher # Required-Start: $remote_fs $syslog # Required-Stop: $remote_fs $syslog # Should-Start: festival # Should-Stop: festival # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Speech Dispatcher # Description: Common interface to speech synthesizers ### END INIT INFO global PATH := '/sbin:/bin:/usr/sbin:/usr/bin' global DAEMON := '/usr/bin/speech-dispatcher' global PIDFILE := '/var/run/speech-dispatcher/speech-dispatcher.pid' global NAME := 'speech-dispatcher' global DESC := ''Speech Dispatcher'' global USER := 'speech-dispatcher' test -f $DAEMON || exit 0 source /lib/lsb/init-functions global RUN := 'no' # Include speech-dispatcher defaults if available if test -f /etc/default/speech-dispatcher { source /etc/default/speech-dispatcher } if test "x$RUN" != "xyes" { log_action_msg "$NAME disabled; edit /etc/default/speech-dispatcher" exit 0 } set -e proc do_start { global PIDDIR := $[dirname $PIDFILE] test -e $PIDDIR || install -d -ospeech-dispatcher -gaudio -m750 $PIDDIR global SDDIR := "$PIDDIR/.speech-dispatcher" test -e $SDDIR || ln -s $PIDDIR $SDDIR global LOGDIR := "$SDDIR/log" test -e $LOGDIR || ln -s /var/log/speech-dispatcher $LOGDIR start-stop-daemon --oknodo --start --quiet --chuid $USER --pidfile $PIDFILE \ --exec $DAEMON -- --pid-file $PIDFILE } proc do_stop { start-stop-daemon --oknodo --stop --quiet --user $USER \ --pidfile $PIDFILE --exec $DAEMON } matchstr $1 { start { log_daemon_msg "Starting $DESC" "speech-dispatcher" do_start log_end_msg $Status } stop { log_daemon_msg "Stopping $DESC" "speech-dispatcher" do_stop log_end_msg $Status } reload|force-reload { log_daemon_msg "Reloading $DESC configuration files" "speech-dispatcher" start-stop-daemon --oknodo --stop --signal 1 --quiet --user $USER \ --pidfile $PIDFILE --exec $DAEMON log_end_msg $Status } restart { log_daemon_msg "Restarting $DESC" "speech-dispatcher" do_stop sleep 3 do_start log_end_msg $Status } * { global N := "/etc/init.d/$NAME" echo "Usage: $N {start|stop|restart|reload|force-reload}" > !2 exit 1 } } exit 0 (CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:PATH) op: Equal rhs: {(/sbin) (Lit_Other ":") (/bin) (Lit_Other ":") (/usr/sbin) (Lit_Other ":") (/usr/bin)} spids: [38] ) ] spids: [38] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:DAEMON) op: Equal rhs: {(/usr/bin/speech-dispatcher)} spids: [47] ) ] spids: [47] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:PIDFILE) op: Equal rhs: {(/var/run/speech-dispatcher/speech-dispatcher.pid)} spids: [50] ) ] spids: [50] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:NAME) op:Equal rhs:{(speech-dispatcher)} spids:[53])] spids: [53] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:DESC) op: Equal rhs: {(SQ <"Speech Dispatcher">)} spids: [56] ) ] spids: [56] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:USER) op:Equal rhs:{(speech-dispatcher)} spids:[61])] spids: [61] ) (AndOr children: [(C {(test)} {(-f)} {($ VSub_Name "$DAEMON")}) (C {(exit)} {(0)})] op_id: Op_DPipe ) (C {(.)} {(/lib/lsb/init-functions)}) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:RUN) op:Equal rhs:{(no)} spids:[83])] spids: [83] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(-f)} {(/etc/default/speech-dispatcher)} {(Lit_Other "]")}) terminator: ) ] action: [(C {(.)} {(/etc/default/speech-dispatcher)})] spids: [-1 102] ) ] spids: [-1 109] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(DQ (x) ($ VSub_Name "$RUN"))} {(KW_Bang "!") (Lit_Other "=")} {(DQ (xyes))} {(Lit_Other "]")} ) terminator: ) ] action: [ (C {(log_action_msg)} {(DQ ($ VSub_Name "$NAME") (" disabled; edit /etc/default/speech-dispatcher"))} ) (C {(exit)} {(0)}) ] spids: [-1 132] ) ] spids: [-1 147] ) (C {(set)} {(-e)}) (FuncDef name: do_start body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:PIDDIR) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(dirname)} {($ VSub_Name "$PIDFILE")})] ) left_token: spids: [164 168] ) } spids: [163] ) ] spids: [163] ) (AndOr children: [ (C {(Lit_Other "[")} {(-e)} {($ VSub_Name "$PIDDIR")} {(Lit_Other "]")}) (C {(install)} {(-d)} {(-ospeech-dispatcher)} {(-gaudio)} {(-m750)} {($ VSub_Name "$PIDDIR")} ) ] op_id: Op_DPipe ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:SDDIR) op: Equal rhs: {($ VSub_Name "$PIDDIR") (/.speech-dispatcher)} spids: [194] ) ] spids: [194] ) (AndOr children: [ (C {(Lit_Other "[")} {(-e)} {($ VSub_Name "$SDDIR")} {(Lit_Other "]")}) (C {(ln)} {(-s)} {($ VSub_Name "$PIDDIR")} {($ VSub_Name "$SDDIR")}) ] op_id: Op_DPipe ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:LOGDIR) op: Equal rhs: {($ VSub_Name "$SDDIR") (/log)} spids: [218] ) ] spids: [218] ) (AndOr children: [ (C {(Lit_Other "[")} {(-e)} {($ VSub_Name "$LOGDIR")} {(Lit_Other "]")}) (C {(ln)} {(-s)} {(/var/log/speech-dispatcher)} {($ VSub_Name "$LOGDIR")}) ] op_id: Op_DPipe ) (C {(start-stop-daemon)} {(--oknodo)} {(--start)} {(--quiet)} {(--chuid)} {($ VSub_Name "$USER")} {(--pidfile)} {($ VSub_Name "$PIDFILE")} {(--exec)} {($ VSub_Name "$DAEMON")} {(--)} {(--pid-file)} {($ VSub_Name "$PIDFILE")} ) ] spids: [160] ) spids: [155 159] ) (FuncDef name: do_stop body: (BraceGroup children: [ (C {(start-stop-daemon)} {(--oknodo)} {(--stop)} {(--quiet)} {(--user)} {($ VSub_Name "$USER")} {(--pidfile)} {($ VSub_Name "$PIDFILE")} {(--exec)} {($ VSub_Name "$DAEMON")} ) ] spids: [278] ) spids: [273 277] ) (Case to_match: {(DQ ($ VSub_Number "$1"))} arms: [ (case_arm pat_list: [{(start)}] action: [ (C {(log_daemon_msg)} {(DQ ("Starting ") ($ VSub_Name "$DESC"))} {(DQ (speech-dispatcher))}) (C {(do_start)}) (C {(log_end_msg)} {($ VSub_QMark "$?")}) ] spids: [315 316 339 -1] ) (case_arm pat_list: [{(stop)}] action: [ (C {(log_daemon_msg)} {(DQ ("Stopping ") ($ VSub_Name "$DESC"))} {(DQ (speech-dispatcher))}) (C {(do_stop)}) (C {(log_end_msg)} {($ VSub_QMark "$?")}) ] spids: [342 343 366 -1] ) (case_arm pat_list: [{(reload)} {(force-reload)}] action: [ (C {(log_daemon_msg)} {(DQ ("Reloading ") ($ VSub_Name "$DESC") (" configuration files"))} {(DQ (speech-dispatcher))} ) (C {(start-stop-daemon)} {(--oknodo)} {(--stop)} {(--signal)} {(1)} {(--quiet)} {(--user)} {($ VSub_Name "$USER")} {(--pidfile)} {($ VSub_Name "$PIDFILE")} {(--exec)} {($ VSub_Name "$DAEMON")} ) (C {(log_end_msg)} {($ VSub_QMark "$?")}) ] spids: [369 372 420 -1] ) (case_arm pat_list: [{(restart)}] action: [ (C {(log_daemon_msg)} {(DQ ("Restarting ") ($ VSub_Name "$DESC"))} {(DQ (speech-dispatcher))}) (C {(do_stop)}) (C {(sleep)} {(3)}) (C {(do_start)}) (C {(log_end_msg)} {($ VSub_QMark "$?")}) ] spids: [423 424 455 -1] ) (case_arm pat_list: [{(Lit_Other "*")}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:N) op: Equal rhs: {(/etc/init.d/) ($ VSub_Name "$NAME")} spids: [462] ) ] spids: [462] ) (SimpleCommand words: [ {(echo)} {(DQ ("Usage: ") ($ VSub_Name "$N") (" {start|stop|restart|reload|force-reload}"))} ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[475])] ) (C {(exit)} {(1)}) ] spids: [458 459 484 -1] ) ] spids: [306 312 486] ) (C {(exit)} {(0)}) ] )