#! /bin/sh ### BEGIN INIT INFO # Provides: brltty # Required-Start: mountkernfs # Required-Stop: # Should-Start: udev # Should-Stop: # Default-Start: S # Default-Stop: # Short-Description: Braille terminal driver # Description: Used to provide access to refreshable braille terminals. ### END INIT INFO set -e global DAEMON := '/sbin/brltty' global NAME := 'brltty' global DESC := ''Braille terminal driver'' test -f $DAEMON || exit 0 # /etc/brltty.conf may need to be propagated from the initramfs. (This is a # pretty awful hack.) if test -e /dev/.initramfs/brltty.conf && test -e /etc/default/brltty { mv /dev/.initramfs/brltty.conf /etc/brltty.conf sed -i -e 's/^RUN_BRLTTY=.*/RUN_BRLTTY=yes/' /etc/default/brltty } test -r /etc/default/brltty && source /etc/default/brltty # Edit /etc/default/brltty and set RUN_BRLTTY=yes to allow brltty to be # started. if test $RUN_BRLTTY != yes { exit 0 } set -e test -r /etc/default/locale && source /etc/default/locale test -n $LANG && export LANG source /lib/lsb/init-functions matchstr $1 { start { if test $RUNLEVEL = "S" -a $PREVLEVEL = "N" { if test $START_IN_INITRAMFS = "true" -o $START_IN_INITRAMFS = "yes" { if $0 status >/dev/null { $0 stop } else { log_warning_msg 'BRLTTY was not running, did you forget to invoke "update-initramfs -u"?' } } } log_daemon_msg "Starting $DESC" $NAME if start-stop-daemon --start --oknodo --exec $DAEMON -- $ARGUMENTS { log_end_msg 0 } else { log_end_msg 1 } } stop { log_daemon_msg "Stopping $DESC" $NAME if start-stop-daemon --stop --quiet --oknodo --retry 5 --exec $DAEMON { log_end_msg 0 } else { log_end_msg 1 } } restart|force-reload { log_daemon_msg "Restarting $DESC" $NAME start-stop-daemon --stop --quiet --retry 5 --exec $DAEMON if start-stop-daemon --start --quiet --exec $DAEMON -- $ARGUMENTS { log_end_msg 0 } else { log_end_msg 1 } } status { status_of_proc $DAEMON $NAME && exit 0 || exit $Status } * { echo "Usage: /etc/init.d/$NAME {start|stop|restart|force-reload|status}" > !2 exit 1 } } exit 0 (CommandList children: [ (C {(set)} {(-e)}) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:DAEMON) op:Equal rhs:{(/sbin/brltty)} spids:[42])] spids: [42] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:NAME) op:Equal rhs:{(brltty)} spids:[45])] spids: [45] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:DESC) op: Equal rhs: {(SQ <"Braille terminal driver">)} spids: [48] ) ] spids: [48] ) (AndOr children: [(C {(test)} {(-f)} {($ VSub_Name "$DAEMON")}) (C {(exit)} {(0)})] op_id: Op_DPipe ) (If arms: [ (if_arm cond: [ (Sentence child: (AndOr children: [ (C {(Lit_Other "[")} {(-e)} {(/dev/.initramfs/brltty.conf)} {(Lit_Other "]")}) (C {(Lit_Other "[")} {(-e)} {(/etc/default/brltty)} {(Lit_Other "]")}) ] op_id: Op_DAmp ) terminator: ) ] action: [ (C {(mv)} {(/dev/.initramfs/brltty.conf)} {(/etc/brltty.conf)}) (C {(sed)} {(-i)} {(-e)} {(SQ <"s/^RUN_BRLTTY=.*/RUN_BRLTTY=yes/">)} {(/etc/default/brltty)}) ] spids: [-1 94] ) ] spids: [-1 116] ) (AndOr children: [ (C {(Lit_Other "[")} {(-r)} {(/etc/default/brltty)} {(Lit_Other "]")}) (C {(.)} {(/etc/default/brltty)}) ] op_id: Op_DAmp ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(DQ ($ VSub_Name "$RUN_BRLTTY"))} {(KW_Bang "!") (Lit_Other "=")} {(yes)} {(Lit_Other "]")} ) terminator: ) ] action: [(C {(exit)} {(0)})] spids: [-1 156] ) ] spids: [-1 163] ) (C {(set)} {(-e)}) (AndOr children: [ (C {(Lit_Other "[")} {(-r)} {(/etc/default/locale)} {(Lit_Other "]")}) (C {(.)} {(/etc/default/locale)}) ] op_id: Op_DAmp ) (AndOr children: [ (C {(Lit_Other "[")} {(-n)} {(DQ ($ VSub_Name "$LANG"))} {(Lit_Other "]")}) (C {(export)} {(LANG)}) ] op_id: Op_DAmp ) (C {(.)} {(/lib/lsb/init-functions)}) (Case to_match: {(DQ ($ VSub_Number "$1"))} arms: [ (case_arm pat_list: [{(start)}] action: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(DQ ($ VSub_Name "$RUNLEVEL"))} {(Lit_Other "=")} {(DQ (S))} {(-a)} {(DQ ($ VSub_Name "$PREVLEVEL"))} {(Lit_Other "=")} {(DQ (N))} {(Lit_Other "]")} ) terminator: ) ] action: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(DQ ($ VSub_Name "$START_IN_INITRAMFS"))} {(Lit_Other "=")} {(DQ (true))} {(-o)} {(DQ ($ VSub_Name "$START_IN_INITRAMFS"))} {(Lit_Other "=")} {(DQ (yes))} {(Lit_Other "]")} ) terminator: ) ] action: [ (If arms: [ (if_arm cond: [ (Sentence child: (SimpleCommand words: [{($ VSub_Number "$0")} {(status)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(/dev/null)} spids: [290] ) ] ) terminator: ) ] action: [(C {($ VSub_Number "$0")} {(stop)})] spids: [-1 294] ) ] else_action: [ (C {(log_warning_msg)} { (SQ < "BRLTTY was not running, did you forget to invoke \"update-initramfs -u\"?" > ) } ) ] spids: [302 312] ) ] spids: [-1 281] ) ] spids: [-1 315] ) ] spids: [-1 249] ) ] spids: [-1 318] ) (C {(log_daemon_msg)} {(DQ ("Starting ") ($ VSub_Name "$DESC"))} {(DQ ($ VSub_Name "$NAME"))}) (If arms: [ (if_arm cond: [ (Sentence child: (C {(start-stop-daemon)} {(--start)} {(--oknodo)} {(--exec)} {($ VSub_Name "$DAEMON")} {(--)} {($ VSub_Name "$ARGUMENTS")} ) terminator: ) ] action: [(C {(log_end_msg)} {(0)})] spids: [-1 350] ) ] else_action: [(C {(log_end_msg)} {(1)})] spids: [358 366] ) ] spids: [216 217 369 -1] ) (case_arm pat_list: [{(stop)}] action: [ (C {(log_daemon_msg)} {(DQ ("Stopping ") ($ VSub_Name "$DESC"))} {(DQ ($ VSub_Name "$NAME"))}) (If arms: [ (if_arm cond: [ (Sentence child: (C {(start-stop-daemon)} {(--stop)} {(--quiet)} {(--oknodo)} {(--retry)} {(5)} {(--exec)} {($ VSub_Name "$DAEMON")} ) terminator: ) ] action: [(C {(log_end_msg)} {(0)})] spids: [-1 407] ) ] else_action: [(C {(log_end_msg)} {(1)})] spids: [415 423] ) ] spids: [372 373 426 -1] ) (case_arm pat_list: [{(restart)} {(force-reload)}] action: [ (C {(log_daemon_msg)} {(DQ ("Restarting ") ($ VSub_Name "$DESC"))} {(DQ ($ VSub_Name "$NAME"))} ) (C {(start-stop-daemon)} {(--stop)} {(--quiet)} {(--retry)} {(5)} {(--exec)} {($ VSub_Name "$DAEMON")} ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(start-stop-daemon)} {(--start)} {(--quiet)} {(--exec)} {($ VSub_Name "$DAEMON")} {(--)} {($ VSub_Name "$ARGUMENTS")} ) terminator: ) ] action: [(C {(log_end_msg)} {(0)})] spids: [-1 479] ) ] else_action: [(C {(log_end_msg)} {(1)})] spids: [487 495] ) ] spids: [429 432 498 -1] ) (case_arm pat_list: [{(status)}] action: [ (AndOr children: [ (C {(status_of_proc)} {(DQ ($ VSub_Name "$DAEMON"))} {(DQ ($ VSub_Name "$NAME"))}) (AndOr children: [(C {(exit)} {(0)}) (C {(exit)} {($ VSub_QMark "$?")})] op_id: Op_DPipe ) ] op_id: Op_DAmp ) ] spids: [501 502 528 -1] ) (case_arm pat_list: [{(Lit_Other "*")}] action: [ (SimpleCommand words: [ {(echo)} { (DQ ("Usage: /etc/init.d/") ($ VSub_Name "$NAME") (" {start|stop|restart|force-reload|status}") ) } ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[543])] ) (C {(exit)} {(1)}) ] spids: [531 532 552 -1] ) ] spids: [207 213 554] ) (C {(exit)} {(0)}) ] )