#! /bin/sh ### BEGIN INIT INFO # Provides: binfmt-support # Required-Start: $local_fs $remote_fs # Required-Stop: $local_fs $remote_fs # Default-Start: 2 3 4 5 # Default-Stop: # Short-Description: Support for extra binary formats # Description: Enable support for extra binary formats using the Linux # kernel's binfmt_misc facility. ### END INIT INFO global PATH := '/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin' global NAME := 'binfmt-support' global DESC := '"additional executable binary formats'" if test $[uname] != Linux { exit 0 } which update-binfmts >/dev/null !2 > !1 || exit 0 source /lib/lsb/init-functions test -r /etc/default/rcS && source /etc/default/rcS set -e global CODE := '0' matchstr $1 { start { if init_is_upstart { exit 1 } log_daemon_msg "Enabling $DESC" $NAME update-binfmts --enable || global CODE := $Status log_end_msg $CODE exit $CODE } stop { if init_is_upstart { exit 0 } log_daemon_msg "Disabling $DESC" $NAME update-binfmts --disable || global CODE := $Status log_end_msg $CODE exit $CODE } restart|force-reload { if init_is_upstart { exit 1 } $0 stop $0 start } * { global N := "/etc/init.d/$NAME" echo "Usage: $N {start|stop|restart|force-reload}" > !2 exit 1 } } exit 0 (CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:PATH) op: Equal rhs: {(/usr/local/sbin) (Lit_Other ":") (/usr/local/bin) (Lit_Other ":") (/sbin) (Lit_Other ":") (/bin) (Lit_Other ":") (/usr/sbin) (Lit_Other ":") (/usr/bin) } spids: [34] ) ] spids: [34] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:NAME) op:Equal rhs:{(binfmt-support)} spids:[47])] spids: [47] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:DESC) op: Equal rhs: {(DQ ("additional executable binary formats"))} spids: [50] ) ] spids: [50] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} { (DQ (CommandSubPart command_list: (CommandList children:[(C {(uname)})]) left_token: spids: [61 63] ) ) } {(KW_Bang "!") (Lit_Other "=")} {(Linux)} {(Lit_Other "]")} ) terminator: ) ] action: [(C {(exit)} {(0)})] spids: [-1 74] ) ] spids: [-1 81] ) (AndOr children: [ (SimpleCommand words: [{(which)} {(update-binfmts)}] redirects: [ (Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[88]) (Redir op_id:Redir_GreatAnd fd:2 arg_word:{(1)} spids:[91]) ] ) (C {(exit)} {(0)}) ] op_id: Op_DPipe ) (C {(.)} {(/lib/lsb/init-functions)}) (AndOr children: [ (C {(Lit_Other "[")} {(-r)} {(/etc/default/rcS)} {(Lit_Other "]")}) (C {(.)} {(/etc/default/rcS)}) ] op_id: Op_DAmp ) (C {(set)} {(-e)}) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:CODE) op:Equal rhs:{(0)} spids:[124])] spids: [124] ) (Case to_match: {(DQ ($ VSub_Number "$1"))} arms: [ (case_arm pat_list: [{(start)}] action: [ (If arms: [ (if_arm cond: [(Sentence child:(C {(init_is_upstart)}) terminator:)] action: [(C {(exit)} {(1)})] spids: [-1 146] ) ] spids: [-1 154] ) (C {(log_daemon_msg)} {(DQ ("Enabling ") ($ VSub_Name "$DESC"))} {(DQ ($ VSub_Name "$NAME"))}) (AndOr children: [ (C {(update-binfmts)} {(--enable)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:CODE) op: Equal rhs: {($ VSub_QMark "$?")} spids: [175] ) ] spids: [175] ) ] op_id: Op_DPipe ) (C {(log_end_msg)} {($ VSub_Name "$CODE")}) (C {(exit)} {($ VSub_Name "$CODE")}) ] spids: [137 138 189 -1] ) (case_arm pat_list: [{(stop)}] action: [ (If arms: [ (if_arm cond: [(Sentence child:(C {(init_is_upstart)}) terminator:)] action: [(C {(exit)} {(0)})] spids: [-1 202] ) ] spids: [-1 210] ) (C {(log_daemon_msg)} {(DQ ("Disabling ") ($ VSub_Name "$DESC"))} {(DQ ($ VSub_Name "$NAME"))} ) (AndOr children: [ (C {(update-binfmts)} {(--disable)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:CODE) op: Equal rhs: {($ VSub_QMark "$?")} spids: [231] ) ] spids: [231] ) ] op_id: Op_DPipe ) (C {(log_end_msg)} {($ VSub_Name "$CODE")}) (C {(exit)} {($ VSub_Name "$CODE")}) ] spids: [193 194 245 -1] ) (case_arm pat_list: [{(restart)} {(force-reload)}] action: [ (If arms: [ (if_arm cond: [(Sentence child:(C {(init_is_upstart)}) terminator:)] action: [(C {(exit)} {(1)})] spids: [-1 260] ) ] spids: [-1 268] ) (C {($ VSub_Number "$0")} {(stop)}) (C {($ VSub_Number "$0")} {(start)}) ] spids: [249 252 281 -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: [289] ) ] spids: [289] ) (SimpleCommand words: [ {(echo)} {(DQ ("Usage: ") ($ VSub_Name "$N") (" {start|stop|restart|force-reload}"))} ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[302])] ) (C {(exit)} {(1)}) ] spids: [285 286 311 -1] ) ] spids: [128 134 313] ) (C {(exit)} {(0)}) ] )